Assumes a Form with a Panel on it., Does the Mutex have to be within the
address of a thread start address ?
Cheers - OHM
'----------- *************** ----------------
Private endProgram As Boolean = False
Dim image1 As Image = Image.FromFile( "..\Images\gun. bmp")
Dim image2 As Image = Image.FromFile( "..\Images\Inva der.bmp")
Dim space As Graphics
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim Thread1 As New Threading.Threa d(AddressOf Me.WriteImage1)
Dim Thread2 As New Threading.Threa d(AddressOf Me.WriteImage2)
space = Panel1.CreateGr aphics()
Thread1.Start()
Thread2.Start()
End Sub
Private Sub WriteImage1()
While Not endProgram
DrawImage(space , image1, New Point(10, 10))
End While
End Sub
Private Sub WriteImage2()
While Not endProgram
DrawImage(space , image2, New Point(50, 50))
End While
End Sub
Public Sub DrawImage(ByVal g As Graphics, ByVal i As Image, ByVal p As
Point)
Dim m As New Threading.Mutex
m.WaitOne()
g.DrawImage(i, p)
m.ReleaseMutex( )
End Sub
--
OHM ( Terry Burns ) * Use the following to email me *
Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
Next
Process.Start(" mailto:" & New String(ch))
--
address of a thread start address ?
Cheers - OHM
'----------- *************** ----------------
Private endProgram As Boolean = False
Dim image1 As Image = Image.FromFile( "..\Images\gun. bmp")
Dim image2 As Image = Image.FromFile( "..\Images\Inva der.bmp")
Dim space As Graphics
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim Thread1 As New Threading.Threa d(AddressOf Me.WriteImage1)
Dim Thread2 As New Threading.Threa d(AddressOf Me.WriteImage2)
space = Panel1.CreateGr aphics()
Thread1.Start()
Thread2.Start()
End Sub
Private Sub WriteImage1()
While Not endProgram
DrawImage(space , image1, New Point(10, 10))
End While
End Sub
Private Sub WriteImage2()
While Not endProgram
DrawImage(space , image2, New Point(50, 50))
End While
End Sub
Public Sub DrawImage(ByVal g As Graphics, ByVal i As Image, ByVal p As
Point)
Dim m As New Threading.Mutex
m.WaitOne()
g.DrawImage(i, p)
m.ReleaseMutex( )
End Sub
--
OHM ( Terry Burns ) * Use the following to email me *
Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
Next
Process.Start(" mailto:" & New String(ch))
--
Comment