Advertisement
ASP_Volume3 Custom Controls/ Forms/ Menus #59130

Percent Bar - Transforms a PictureBox into a Percent Bar!

I thought this code might help those struggling to make a percent bar. This code transforms a normal picturebox into a Percent Bar (progress bar with % in the middle). Choose from 2 different borders.

AI

AIサマリー: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

ソースコード
original-source
Public Sub UpdateProgress(pic As PictureBox, ByVal Percent As Single, Optional ByVal Flat As Boolean = False)
 With pic
 'Configure PictureBox
 .AutoRedraw = True
 .Appearance = Flat + 1
 .ScaleWidth = 100
 .ForeColor = vbHighlight
 .BackColor = vbButtonFace
 .DrawMode = vbNotXorPen
 
 'Clear the PictureBox
 .Cls
 
 'Draw the text
 .CurrentX = (.ScaleWidth - .TextWidth(Int(Percent) & "%")) \ 2
 .CurrentY = (.ScaleHeight - .TextHeight(Int(Percent) & "%")) \ 2
 pic.Print Int(Percent) & "%"
 
 'Draw the progress
 pic.Line (0, 0)-(Percent, .ScaleHeight), , BF
 End With
End Sub
オリジナルのコメント (3)
Wayback Machineから復元