#2
梦幻倩影2016-10-07 10:18
|
Dim i, X0, Y0 As Integer
Dim Ox As New Bitmap(Me.Width, Me.Height) '创建位图,用窗体的大小
Dim Kos As Graphics = Graphics.FromImage(Ox) '根据位图创建Graphics,这个是gdi+的封装
Dim pen1 As New Pen(Color.Black, 3) '声明画笔,黑色,3像素宽度
Dim Vs As RectangleF '声明矩形,用来绘制在指定位置和大小
X0 = Me.Width / 2 '定义圆心坐标于窗体的中心(x0,y0)
Y0 = Me.Height / 2
Kos.SmoothingMode = Drawing2D.SmoothingMode.HighQuality '开启抗锯齿。
For i = 50 To 150 Step 10 '将此处的10变为1可以绘出圆环
pen1.Color = Color.FromArgb(255, 250 - i, i, i) '改变画笔颜色
' Llo.Color = Color.FromArgb(255, 128, 128, 128)
Vs.X = X0 - i 'x坐标
Vs.Y = Y0 - i 'Y坐标
Vs.Width = i * 2 '宽度
Vs.Height = i * 2 '高度
Kos.DrawEllipse(pen1, Vs) '绘制园
Next
Me.BackgroundImage = Ox '将位图做为窗体的背景图