Tuesday 15 March 2011

.net - Visual basic circular progress bar -



.net - Visual basic circular progress bar -

i'm trying create software ui , i'm not professional in vb ... how can create circular progress bar ?

for example

how drawing own using gdi+.

you can convert own usercontrol later started. should self explanatory:

private sub form2_paint(sender object, e painteventargs) handles me.paint drawprogress(e.graphics, new rectangle(5, 5, 60, 60), 40) drawprogress(e.graphics, new rectangle(80, 5, 60, 60), 80) drawprogress(e.graphics, new rectangle(155, 5, 60, 60), 57) end sub private sub drawprogress(g graphics, rect rectangle, percentage single) 'work out angles each arc dim progressangle = csng(360 / 100 * percentage) dim remainderangle = 360 - progressangle 'create pens utilize arcs using progresspen new pen(color.lightseagreen, 2), remainderpen new pen(color.lightgray, 2) 'set smoothing high quality improve output g.smoothingmode = drawing2d.smoothingmode.antialias 'draw bluish , white arcs g.drawarc(progresspen, rect, -90, progressangle) g.drawarc(remainderpen, rect, progressangle - 90, remainderangle) end using 'draw text in centre working out how big , adjusting co-ordinates accordingly using fnt new font(me.font.fontfamily, 14) dim text string = percentage.tostring + "%" dim textsize = g.measurestring(text, fnt) dim textpoint new point(cint(rect.left + (rect.width / 2) - (textsize.width / 2)), cint(rect.top + (rect.height / 2) - (textsize.height / 2))) 'now have values draw text g.drawstring(text, fnt, brushes.black, textpoint) end using end sub

output

.net vb.net user-interface progress-bar circular

No comments:

Post a Comment