Public Sub drawDotAt35Minutes(ByVal onObj As PictureBox, ByVal e As Windows.Forms.PaintEventArgs)
Const clockInset As Integer = 100 ' distance from clock edge to box edge
Const dotRadius As Integer = 15 ' size of the dot
Dim smallDim As Integer ' smaller of width and height of box
Dim clockRadius As Integer ' radius of the clock
Dim centerX As Integer ' x for center of the clock
Dim centerY As Integer ' y for center of the clock
Dim x As Integer ' x position of dot
Dim y As Integer ' y position of dot
Dim brush As New SolidBrush(Color.Blue) 'brush
Dim brush1 As New SolidBrush(Color.Black)
' calculate the center of the clock and its radius so it fits in the box
centerX = onObj.Width / 2
centerY = onObj.Height / 2
smallDim = onObj.Width
If (onObj.Height < smallDim) Then
smallDim = onObj.Height
End If
clockRadius = smallDim / 2 - clockInset
' calculate the position of the dot
x = centerX 'clockX(35, clockRadius - dotRadius)
y = centerY + 0 ' clockY(35, clockRadius - dotRadius)
' draw a filled black circle
e.Graphics.FillEllipse(brush1, x, y, dotRadius, dotRadius)
e.Graphics.FillRectangle(brush, x, y + 20, dotRadius, dotRadius)
End Sub
用于在picturesBox 里面画图的方法~~
Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
drawDotAt35Minutes(PictureBox1, e)
End Sub
用于在form加载时,加载方法 drawDotAt35 Minutes。
更多画图参考: http://www.host01.com/article/Net/00020005/056151545005180.htm
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
另外一种画图的方法。。
对于直线,参数的含义发生了变化~~
直线:第一个是代表画笔,后面依次是x1,y1(起点坐标),X2,Y2(终点坐标)
其他图形:x1,y1 决定了中心位置, X2,Y2 ,相当于radius
1万+

被折叠的 条评论
为什么被折叠?



