Re: How do I make a custom progress bar?
Posted: Sun Jun 06, 2010 4:47 am
:o still no posts O_O
Sharing, Teaching and Supporting coders of all ages and levels since 2009
https://www.codenstuff.com/forum/
Dim gfx As Graphics
Dim percent As Integer = 0
PictureBox1.BorderStyle = BorderStyle.FixedSingle
PictureBox1.Image = New Bitmap(PictureBox1.Width, PictureBox1.Height)
gfx = Graphics.FromImage(PictureBox1.Image)
percent += 10
gfx.FillRectangle(Brushes.Black, New RectangleF(0, 0, PictureBox1.Width / 100 * percent, PictureBox1.Height))
PictureBox1.Refresh()
lawrence12 wrote:but where do I put that code in?You put the code in your Form1.vb file.
The Post you posted included a code in it but no instructions, meaning no details or stuff, so I didn't learn anything :|
mandai wrote:Oh Im sorry but Im not that advanced yet.lawrence12 wrote:but where do I put that code in?You put the code in your Form1.vb file.
The Post you posted included a code in it but no instructions, meaning no details or stuff, so I didn't learn anything :|
You diddn't ask for detail in your request (in fact you diddn't even explain how it should be custom). If you know what the types and functions are for then it should be easy to understand.
CodenStuff wrote:Hello,Well I was looking for a stylish one :|
You need to add a Button control and PictureBox control to your form and then use the code like:
Add under "Public Class Form":
Code: Select allInside the "Form_Load" event:Dim gfx As Graphics Dim percent As Integer = 0
Code: Select allInside the "Button_Click" event:PictureBox1.BorderStyle = BorderStyle.FixedSingle PictureBox1.Image = New Bitmap(PictureBox1.Width, PictureBox1.Height) gfx = Graphics.FromImage(PictureBox1.Image)
Code: Select allIve added it into the project below to demonstrate mandai code.percent += 10 gfx.FillRectangle(Brushes.Black, New RectangleF(0, 0, PictureBox1.Width / 100 * percent, PictureBox1.Height)) PictureBox1.Refresh()
Download: