【发布时间】:2018-11-27 08:47:15
【问题描述】:
进度条的最大值为 10。
所以我需要在运行进度之前绘制十个没有填充颜色的块。
编辑:添加代码
Public Class MyProgressBar
Inherits ProgressBar
Public Sub New()
Me.ForeColor = Color.Red
End Sub
Protected Overrides Sub OnPaint(e As PaintEventArgs)
MyBase.OnPaint(e)
For i as integer = 1 to 10
Dim g As Graphics = e.Graphics
Dim widthScale As Integer = Me.Width/10
g.DrawRectangle(Pens,Me.Left+(i*widthScale ),Me.Top, Me.Width / 10, Me.Height)
End For
End Sub
End Class
我尝试覆盖 OnPaint() 但它不起作用。
【问题讨论】:
-
你的问题是什么?你尝试了什么?你的代码在哪里?
-
我尝试覆盖 OnPaint()。但它不起作用。
标签: vb.net visual-studio-2015 progress-bar