タイトル | : Re^5: AcceptButtonについて |
記事No | : 8708 |
投稿日 | : 2009/02/04(Wed) 21:54 |
投稿者 | : Abyss |
簡単ではないですが、一応自分で テスト用で作ってみた部品をUpします。 一部だけですが。
Imports System Imports System.Drawing Imports System.Windows.Forms Imports System.Drawing.Drawing2D
Public Class MyButton Inherits Button
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) Dim LineWeight As Integer Dim grfx As Graphics = e.Graphics Dim rect As Rectangle = ClientRectangle Dim Br As Brush Dim PgBr As PathGradientBrush Dim Pn As Pen Dim path As New GraphicsPath()
'MyBase.OnPaint(e)
grfx.SmoothingMode = SmoothingMode.AntiAlias ' : path.AddEllipse(rect) ' : PgBr = New PathGradientBrush(path) ' : ' : ' ボタンの表面 ... PgBr.SurroundColors = New Color() {SystemColors.ControlDark} grfx.FillRectangle(PgBr, rect)
' ボタンの外枠 ... Br = New SolidBrush(SystemColors.ControlDarkDark)
If IsDefault Then LineWeight = 4 Else LineWeight = 2 End If
Pn = New Pen(Br, grfx.DpiX / 72 * LineWeight) grfx.DrawEllipse(Pn, rect)
' 念のため ... Region = New Region(path)
End Sub End Class
|