ITT Tech Student
Member
I'm working on my final project for school and me and my group decided to make a RPG maker. I have been put in charge of databasing and creating the character editor. I have been going nuts trying to figure out how to set the background color on my character sheet to transparent for display purposes and i finally figured it out.
basically im displaying two picture boxs:
the first shows the entire char sheet
the second pulls pictures parts of the first picture to display movement
here's the code maybe someone else will find it useful:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Static X As Integer = 0
Static Y As Integer = 0
Dim iLeft As Integer = 24 * X
Dim iTop As Integer = 32 * Y
X += 1
If X = 3 Then
Y += 1
X = 0
End If
If Y = 4 Then Y = 0
Dim img2 As Bitmap = Bitmap.FromFile("C:\Documents and Settings\ITT Tech Student\My Documents\Visual Studio 2005\Projects\CharacterStats\CharacterStats\res_viewer.bmp")
img2.MakeTransparent()
PictureBox1.Image = img2
PictureBox2.CreateGraphics.Clear(PictureBox2.BackColor)
PictureBox2.CreateGraphics().DrawImage(PictureBox1.Image, New Rectangle(0, 0, PictureBox2.Width, PictureBox2.Height), New Rectangle(iLeft, iTop, 24, 32), System.Drawing.GraphicsUnit.Pixel)
End Sub
basically im displaying two picture boxs:
the first shows the entire char sheet
the second pulls pictures parts of the first picture to display movement
here's the code maybe someone else will find it useful:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Static X As Integer = 0
Static Y As Integer = 0
Dim iLeft As Integer = 24 * X
Dim iTop As Integer = 32 * Y
X += 1
If X = 3 Then
Y += 1
X = 0
End If
If Y = 4 Then Y = 0
Dim img2 As Bitmap = Bitmap.FromFile("C:\Documents and Settings\ITT Tech Student\My Documents\Visual Studio 2005\Projects\CharacterStats\CharacterStats\res_viewer.bmp")
img2.MakeTransparent()
PictureBox1.Image = img2
PictureBox2.CreateGraphics.Clear(PictureBox2.BackColor)
PictureBox2.CreateGraphics().DrawImage(PictureBox1.Image, New Rectangle(0, 0, PictureBox2.Width, PictureBox2.Height), New Rectangle(iLeft, iTop, 24, 32), System.Drawing.GraphicsUnit.Pixel)
End Sub