标题:自定義圓
只看楼主
adair
Rank: 3Rank: 3
等 级:新手上路
威 望:9
帖 子:250
专家分:0
注 册:2005-9-3
 问题点数:0 回复次数:0 
自定義圓

Private bg As Color Public Property bgcolor() As Color Get bgcolor = bg End Get Set(ByVal Value As Color) bg = Value End Set End Property

Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)

Dim graphics As Graphics = e.Graphics Dim penWidth As Integer = 1 Dim pen As Pen = New Pen(Color.Black, 1)

Dim fontHeight As Integer = 10 Dim font As Font = New Font("Arial", fontHeight)

Dim brush As SolidBrush = New SolidBrush(bg) graphics.FillEllipse(brush, 0, 0, Width, Height) Dim textBrush As SolidBrush = New SolidBrush(Color.Black)

graphics.DrawEllipse(pen, CInt(penWidth / 2), _ CInt(penWidth / 2), Width - penWidth, Height - penWidth)

graphics.DrawString(Text, font, textBrush, penWidth, _ Height / 2 - fontHeight) End Sub

2005-09-21 18:29



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-28269-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015516 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved