PaintEventArgs what do i use for e in this code?

D

David

This Button1_Click will call the DrawarcFloat sub what do
I use for arguments for the call?

Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click

call DrawArcFloat(What goes here?)
End Sub
Public Sub DrawArcFloat(ByVal e As PaintEventArgs)
' Create pen.
Dim blackPen As New Pen(Color.Black, 3)
' Create coordinates of rectangle to bound
ellipse.
Dim x As Single = 0.0F
Dim y As Single = 0.0F
Dim width As Single = 100.0F
Dim height As Single = 200.0F
' Create start and sweep angles on ellipse.
Dim startAngle As Single = 45.0F
Dim sweepAngle As Single = 270.0F
' Draw arc to screen.
e.Graphics.DrawArc(blackPen, x, y, width, height,
startAngle, _
sweepAngle)
End Sub
 
K

Ken Tucker [MVP]

Hi,

Controls have a creategraphics method. Why dont you try something
like this.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim g As Graphics = Button1.CreateGraphics

' Create pen.

Dim blackPen As New Pen(Color.Black, 3)

' Create coordinates of rectangle to bound ellipse.

Dim x As Single = 0.0F

Dim y As Single = 0.0F

Dim width As Single = 100.0F

Dim height As Single = 200.0F

' Create start and sweep angles on ellipse.

Dim startAngle As Single = 45.0F

Dim sweepAngle As Single = 270.0F

' Draw arc to screen.

g.DrawArc(blackPen, x, y, width, height, startAngle, _

sweepAngle)

End Sub



Ken
 
R

Richard

This Button1_Click will call the DrawarcFloat sub what do
I use for arguments for the call?

Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click

call DrawArcFloat(What goes here?)
End Sub
Public Sub DrawArcFloat(ByVal e As PaintEventArgs)

You'd have to Dim up a variable of type PaintEventArgs and pass it.
Depending on what your doing it may be easier to maybe easier to call

Control.Invalidate or Form.Invalidate

This will automatically force a repaint of the control/form it's
called on and if you override OnPaint within it's code, you'll have
all the "e" you need... which should keep you happy.

hth
Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top