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!

Call sub ERROR

Status
Not open for further replies.

umitsogut

Programmer
Feb 13, 2007
8
TR
Private Sub Form2_Paint(ByVal sender As Object, ByVal e As PaintEventArgs) Handles MyBase.Paint

Dim g As Graphics = e.Graphics
Dim blackBrush As Brush = Brushes.Black
Dim fillBrush As Brush = Brushes.Gray
Dim whitePen As Pen = Pens.White
Dim format As StringFormat = New StringFormat()
format.Alignment = StringAlignment.Center
format.LineAlignment = StringAlignment.Center

Dim pen As Pen = New Pen(Color.Blue, 4)

'**********************//////// KASA /////////*************************

fillBrush = Brushes.Tomato
pen = New Pen(Color.Black, 3)
'SOL KARE
g.FillPolygon(fillBrush, New PointF() {New PointF(120, 240), New PointF(350, 40), New PointF(350, 340), New PointF(120, 540)})
g.DrawPolygon(pen, New PointF() {New PointF(120, 240), New PointF(350, 40), New PointF(350, 340), New PointF(120, 540)})
'ARKA KARE
g.FillPolygon(fillBrush, New PointF() {New PointF(350, 40), New PointF(650, 40), New PointF(650, 340), New PointF(350, 340)})
g.DrawPolygon(pen, New PointF() {New PointF(350, 40), New PointF(650, 40), New PointF(650, 340), New PointF(350, 340)})
'ALT KARE
g.FillPolygon(fillBrush, New PointF() {New PointF(350, 340), New PointF(647, 340), New PointF(420, 540), New PointF(120, 540)})
g.DrawPolygon(pen, New PointF() {New PointF(350, 340), New PointF(650, 340), New PointF(420, 540), New PointF(120, 540)})


End Sub


'I WANT TO CALL THIS SUB ,PLEASE HELP ME
 
depends form where you want to call it. mybase.invalidate perhaps? or controlname.invalidate.

Christiaan Baes
Belgium

"My new site" - Me
 
ERROR

Argument not specified for parameter 'e' of 'Private Sub Form2_Paint(sender As Object, e As System.Windows.Forms.PaintEventArgs)'


WHAT DOES IT MEAN?
 
Use the word [tt]Nothing[/tt] for the second parameter - (and [tt]Me[/tt] (presumably you are repainting the current form) for the first)


Hope this helps.

[vampire][bat]
 
With your code as written, my previous suggestion won't work. However if you change the first line of your code

from:

[tt]Dim g As Graphics = e.Graphics[/tt]

to:

[tt]Dim g As Graphics = Me.CreateGraphics[/tt]

it should.

Hope this helps.

[vampire][bat]
 
All I have done is to suggest changing one line of your code and suggested a replacement for the line that produced the error message (where ever that is in your code), so I don't really understand your request.

Hope this helps.

[vampire][bat]
 
unitsogut,

I notice that you are new to tek-tips. I encourage you to read this article (faq796-2540), particularly point #4, because it will help you to get the most out of tek-tips.


-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
If you wanted to call the function, you could use:
Code:
Form2_Paint(Me, Me.CreateGraphics)
But, Most people use Me.Invalidate() because it will trigger other controls on the form to paint as well, giving better visual results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top