Sizing/filling a rectangle

M

Morten Snedker

Hey folks,

I'm trying to make my own progressbar. The idea (for my test) is a
rectangle that is 1/60 filled with a color per second (so after a
minute it is all filled).

This is what I have so far:

Public Sub DrawRectangleFloat(ByVal e As PaintEventArgs)

Dim g As Graphics = e.Graphics 'get graphics object
Dim rpen As New Pen(System.Drawing.Color.Blue, 1)

Dim blueBrush As New SolidBrush(Color.Blue)

Dim myWidth As Integer
myWidth = (320 / 60) * iSecond

g.DrawRectangle(rpen, 15, 224, 320, 15)
g.FillRectangle(blueBrush, 15, 224, myWidth, 15)

End Sub


1.
On Timer_Tick I want to execute the above procedure, but I don't know
with what to call it: DrawRectangleFloat(?). What should be in the
paranthesis?

2.
It's kind of awkwad that I draw the rectangle each time. It should be
done once, and then only filled. But I don't know how to "save" it so
that I can refer to it...does it have a name, once drawn?


Am I on the right path at all? Thnx in advance!


Regards /Snedker
 

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