Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I clear graphics with solid colour?

Status
Not open for further replies.

WomanPro

Programmer
Nov 1, 2012
180
GR
Hello, how can I clear graphics with solid colour???
I tried clear method but I am getting error Value of type 'System.Drawing.SolidBrush' cannot be converted to 'System.Drawing.Color' and it's necessary to be solid.
Here is my code that I create graphics, but I need all the graphics disapear if cnt is greater than 1.

Private Sub Button1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseMove
Dim g As System.Drawing.Graphics
Dim brsh As SolidBrush
Dim points(CType(keyCoords(0), ArrayList).Count - 1) As Point
If cnt = 1 then
For i As Integer = 0 To CType(keyCoords(0), ArrayList).Count - 1
points(i) = CType(CType(keyCoords(0), ArrayList)(i), Point)
Next
g = PictureBox1.CreateGraphics()
brsh = New SolidBrush(Color.FromArgb(130, 255, 255, 0))
g.FillPolygon(brsh, points)
brsh.Dispose()
ElseIf cnt > 1 then
g.clear(brsh)
End If
End Sub
 
Why not just:

g.clear(Color.FromArgb(130, 255, 255, 0))
 
Thank you jges
but it doesn't work because it covers picturebox1 background image with the colour clear...
but it doesn't matter I tried the picturebox1.refresh method and it worked.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top