Changer la couleur d'un petit cercle (dot) contenues dans le radio bouton rouge?

Comment puis-je changer la couleur d'un petit cercle (dot) contenues dans le radio bouton rouge dans l'utilisation de l'Application Winform VB.NET ou C#?

Égard, & Merci,
Dewi

==========================================================

Je vais partager, peut être utile à d'autres. Ce programme fonctionne.

Imports System.Drawing.Drawing2D
Public Class Form1
Public Class MyRadioButton
Inherits RadioButton
Private m_OnColor As Color
Private m_OffColor As Color
Public Sub New(ByVal On_Color As Color, ByVal Off_Color As Color)
m_OnColor = On_Color
m_OffColor = Off_Color
SetStyle(ControlStyles.SupportsTransparentBackColor, True)
BackColor = Color.Transparent
End Sub
Public Property OnColor() As Color
Get
Return m_OnColor
End Get
Set(ByVal value As Color)
m_OnColor = value
End Set
End Property
Public Property OffColor() As Color
Get
Return m_OffColor
End Get
Set(ByVal value As Color)
m_OffColor = value
End Set
End Property
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
MyBase.OnPaint(e)
Dim g As Graphics = e.Graphics
g.SmoothingMode = SmoothingMode.AntiAlias
Dim dotDiameter As Integer = ClientRectangle.Height - 17
Dim innerRect As New RectangleF(1.8F, 7.8F, dotDiameter, dotDiameter)
If Me.Checked Then
g.FillEllipse(New SolidBrush(OnColor), innerRect)
Else
g.FillEllipse(New SolidBrush(OffColor), innerRect)
End If
g.DrawString(Text, Font, New SolidBrush(ForeColor), dotDiameter + 17, 1)
End Sub
End Class
Dim objRadio As New MyRadioButton(Color.Blue, Color.Red)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
objRadio.Location = New Point(100, 100)
objRadio.Visible = True
Me.Controls.Add(objRadio)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If objRadio.Checked Then
objRadio.Checked = False
Else
objRadio.Checked = True
End If
End Sub
End Class
InformationsquelleAutor Dewi | 2011-06-23