RadioButtonRenderer.DrawRadioButton メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
オプション ボタン コントロール (ラジオ ボタンとも呼ばれます) を描画します。
オーバーロード
| 名前 | 説明 |
|---|---|
| DrawRadioButton(Graphics, Point, RadioButtonState) |
オプション ボタン コントロール (ラジオ ボタンとも呼ばれます) を、指定した状態と位置に描画します。 |
| DrawRadioButton(Graphics, Point, Rectangle, String, Font, Boolean, RadioButtonState) |
オプション ボタン コントロール (ラジオ ボタンとも呼ばれます) を、指定したテキストとオプションのフォーカス四角形を使用して、指定した状態と位置に描画します。 |
| DrawRadioButton(Graphics, Point, Rectangle, String, Font, TextFormatFlags, Boolean, RadioButtonState) |
オプション ボタン コントロール (ラジオ ボタンとも呼ばれます) を、指定したテキストとテキストの書式設定と、オプションのフォーカス四角形を使用して、指定した状態と位置に描画します。 |
| DrawRadioButton(Graphics, Point, Rectangle, String, Font, Image, Rectangle, Boolean, RadioButtonState) |
オプション ボタン コントロール (ラジオ ボタンとも呼ばれます) を、指定した状態と位置に、指定したテキストと画像を使用し、オプションのフォーカス四角形を使用して描画します。 |
| DrawRadioButton(Graphics, Point, Rectangle, String, Font, TextFormatFlags, Image, Rectangle, Boolean, RadioButtonState) |
オプション ボタン コントロール (ラジオ ボタンとも呼ばれます) を指定された状態と位置に描画します。指定されたテキスト、テキストの書式設定、および画像を使用する。とオプションのフォーカス四角形を使用します。 |
DrawRadioButton(Graphics, Point, RadioButtonState)
オプション ボタン コントロール (ラジオ ボタンとも呼ばれます) を、指定した状態と位置に描画します。
public:
static void DrawRadioButton(System::Drawing::Graphics ^ g, System::Drawing::Point glyphLocation, System::Windows::Forms::VisualStyles::RadioButtonState state);
public static void DrawRadioButton(System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Windows.Forms.VisualStyles.RadioButtonState state);
static member DrawRadioButton : System.Drawing.Graphics * System.Drawing.Point * System.Windows.Forms.VisualStyles.RadioButtonState -> unit
Public Shared Sub DrawRadioButton (g As Graphics, glyphLocation As Point, state As RadioButtonState)
パラメーター
- state
- RadioButtonState
オプション ボタンの表示状態を指定する RadioButtonState 値の 1 つ。
注釈
オペレーティング システムでビジュアル スタイルが有効になっていて、visual スタイルが現在のアプリケーションに適用されている場合、このメソッドは現在の表示スタイルでオプション ボタンを描画します。 それ以外の場合、このメソッドは従来のWindows スタイルでオプション ボタンを描画します。
適用対象
DrawRadioButton(Graphics, Point, Rectangle, String, Font, Boolean, RadioButtonState)
オプション ボタン コントロール (ラジオ ボタンとも呼ばれます) を、指定したテキストとオプションのフォーカス四角形を使用して、指定した状態と位置に描画します。
public:
static void DrawRadioButton(System::Drawing::Graphics ^ g, System::Drawing::Point glyphLocation, System::Drawing::Rectangle textBounds, System::String ^ radioButtonText, System::Drawing::Font ^ font, bool focused, System::Windows::Forms::VisualStyles::RadioButtonState state);
public static void DrawRadioButton(System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string radioButtonText, System.Drawing.Font font, bool focused, System.Windows.Forms.VisualStyles.RadioButtonState state);
public static void DrawRadioButton(System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string? radioButtonText, System.Drawing.Font? font, bool focused, System.Windows.Forms.VisualStyles.RadioButtonState state);
static member DrawRadioButton : System.Drawing.Graphics * System.Drawing.Point * System.Drawing.Rectangle * string * System.Drawing.Font * bool * System.Windows.Forms.VisualStyles.RadioButtonState -> unit
Public Shared Sub DrawRadioButton (g As Graphics, glyphLocation As Point, textBounds As Rectangle, radioButtonText As String, font As Font, focused As Boolean, state As RadioButtonState)
パラメーター
- focused
- Boolean
true フォーカスの四角形を描画するには、それ以外の場合は false。
- state
- RadioButtonState
オプション ボタンの表示状態を指定する RadioButtonState 値の 1 つ。
例
次のコード例では、カスタム コントロールの DrawRadioButton(Graphics, Point, Rectangle, String, Font, Boolean, RadioButtonState) メソッドのOnPaint メソッドを使用して、マウス ポインターの位置によって決まる状態でオプション ボタンを描画します。 このコード例は、 RadioButtonRenderer クラスに提供されるより大きな例の一部です。
// Draw the radio button in the current state.
protected:
virtual void OnPaint(PaintEventArgs^ e) override
{
__super::OnPaint(e);
RadioButtonRenderer::DrawRadioButton(e->Graphics,
ClientRectangle.Location, TextRectangle, this->Text,
this->Font, clicked, state);
}
// Draw the radio button in the checked or unchecked state.
protected:
virtual void OnMouseDown(MouseEventArgs^ e) override
{
__super::OnMouseDown(e);
if (!clicked)
{
clicked = true;
this->Text = "Clicked!";
state = RadioButtonState::CheckedPressed;
Invalidate();
}
else
{
clicked = false;
this->Text = "Click here";
state = RadioButtonState::UncheckedNormal;
Invalidate();
}
}
// Draw the radio button in the current state.
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
RadioButtonRenderer.DrawRadioButton(e.Graphics,
ClientRectangle.Location, TextRectangle, this.Text,
this.Font, clicked, state);
}
// Draw the radio button in the checked or unchecked state.
protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown(e);
if (!clicked)
{
clicked = true;
this.Text = "Clicked!";
state = RadioButtonState.CheckedPressed;
Invalidate();
}
else
{
clicked = false;
this.Text = "Click here";
state = RadioButtonState.UncheckedNormal;
Invalidate();
}
}
' Draw the radio button in the current state.
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
MyBase.OnPaint(e)
RadioButtonRenderer.DrawRadioButton(e.Graphics, _
Me.ClientRectangle.Location, TextRectangle, Me.Text, _
Me.Font, clicked, state)
End Sub
' Draw the radio button in the checked or unchecked state.
Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
MyBase.OnMouseDown(e)
If Not clicked Then
clicked = True
Me.Text = "Clicked!"
state = RadioButtonState.CheckedPressed
Invalidate()
Else
clicked = False
Me.Text = "Click here"
state = RadioButtonState.UncheckedNormal
Invalidate()
End If
End Sub
注釈
オペレーティング システムでビジュアル スタイルが有効になっていて、visual スタイルが現在のアプリケーションに適用されている場合、このメソッドは現在の表示スタイルでオプション ボタンを描画します。 それ以外の場合、このメソッドは従来のWindows スタイルでオプション ボタンを描画します。
適用対象
DrawRadioButton(Graphics, Point, Rectangle, String, Font, TextFormatFlags, Boolean, RadioButtonState)
オプション ボタン コントロール (ラジオ ボタンとも呼ばれます) を、指定したテキストとテキストの書式設定と、オプションのフォーカス四角形を使用して、指定した状態と位置に描画します。
public:
static void DrawRadioButton(System::Drawing::Graphics ^ g, System::Drawing::Point glyphLocation, System::Drawing::Rectangle textBounds, System::String ^ radioButtonText, System::Drawing::Font ^ font, System::Windows::Forms::TextFormatFlags flags, bool focused, System::Windows::Forms::VisualStyles::RadioButtonState state);
public static void DrawRadioButton(System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string radioButtonText, System.Drawing.Font font, System.Windows.Forms.TextFormatFlags flags, bool focused, System.Windows.Forms.VisualStyles.RadioButtonState state);
public static void DrawRadioButton(System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string? radioButtonText, System.Drawing.Font? font, System.Windows.Forms.TextFormatFlags flags, bool focused, System.Windows.Forms.VisualStyles.RadioButtonState state);
static member DrawRadioButton : System.Drawing.Graphics * System.Drawing.Point * System.Drawing.Rectangle * string * System.Drawing.Font * System.Windows.Forms.TextFormatFlags * bool * System.Windows.Forms.VisualStyles.RadioButtonState -> unit
Public Shared Sub DrawRadioButton (g As Graphics, glyphLocation As Point, textBounds As Rectangle, radioButtonText As String, font As Font, flags As TextFormatFlags, focused As Boolean, state As RadioButtonState)
パラメーター
- flags
- TextFormatFlags
TextFormatFlags値のビットごとの組み合わせ。
- focused
- Boolean
true フォーカスの四角形を描画するには、それ以外の場合は false。
- state
- RadioButtonState
オプション ボタンの表示状態を指定する RadioButtonState 値の 1 つ。
注釈
オペレーティング システムでビジュアル スタイルが有効になっていて、visual スタイルが現在のアプリケーションに適用されている場合、このメソッドは現在の表示スタイルでオプション ボタンを描画します。 それ以外の場合、このメソッドは従来のWindows スタイルでオプション ボタンを描画します。
適用対象
DrawRadioButton(Graphics, Point, Rectangle, String, Font, Image, Rectangle, Boolean, RadioButtonState)
オプション ボタン コントロール (ラジオ ボタンとも呼ばれます) を、指定した状態と位置に、指定したテキストと画像を使用し、オプションのフォーカス四角形を使用して描画します。
public:
static void DrawRadioButton(System::Drawing::Graphics ^ g, System::Drawing::Point glyphLocation, System::Drawing::Rectangle textBounds, System::String ^ radioButtonText, System::Drawing::Font ^ font, System::Drawing::Image ^ image, System::Drawing::Rectangle imageBounds, bool focused, System::Windows::Forms::VisualStyles::RadioButtonState state);
public static void DrawRadioButton(System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string radioButtonText, System.Drawing.Font font, System.Drawing.Image image, System.Drawing.Rectangle imageBounds, bool focused, System.Windows.Forms.VisualStyles.RadioButtonState state);
public static void DrawRadioButton(System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string? radioButtonText, System.Drawing.Font? font, System.Drawing.Image image, System.Drawing.Rectangle imageBounds, bool focused, System.Windows.Forms.VisualStyles.RadioButtonState state);
static member DrawRadioButton : System.Drawing.Graphics * System.Drawing.Point * System.Drawing.Rectangle * string * System.Drawing.Font * System.Drawing.Image * System.Drawing.Rectangle * bool * System.Windows.Forms.VisualStyles.RadioButtonState -> unit
Public Shared Sub DrawRadioButton (g As Graphics, glyphLocation As Point, textBounds As Rectangle, radioButtonText As String, font As Font, image As Image, imageBounds As Rectangle, focused As Boolean, state As RadioButtonState)
パラメーター
- focused
- Boolean
true フォーカスの四角形を描画するには、それ以外の場合は false。
- state
- RadioButtonState
オプション ボタンの表示状態を指定する RadioButtonState 値の 1 つ。
注釈
オペレーティング システムでビジュアル スタイルが有効になっていて、visual スタイルが現在のアプリケーションに適用されている場合、このメソッドは現在の表示スタイルでオプション ボタンを描画します。 それ以外の場合、このメソッドは従来のWindows スタイルでオプション ボタンを描画します。
適用対象
DrawRadioButton(Graphics, Point, Rectangle, String, Font, TextFormatFlags, Image, Rectangle, Boolean, RadioButtonState)
オプション ボタン コントロール (ラジオ ボタンとも呼ばれます) を指定された状態と位置に描画します。指定されたテキスト、テキストの書式設定、および画像を使用する。とオプションのフォーカス四角形を使用します。
public:
static void DrawRadioButton(System::Drawing::Graphics ^ g, System::Drawing::Point glyphLocation, System::Drawing::Rectangle textBounds, System::String ^ radioButtonText, System::Drawing::Font ^ font, System::Windows::Forms::TextFormatFlags flags, System::Drawing::Image ^ image, System::Drawing::Rectangle imageBounds, bool focused, System::Windows::Forms::VisualStyles::RadioButtonState state);
public static void DrawRadioButton(System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string radioButtonText, System.Drawing.Font font, System.Windows.Forms.TextFormatFlags flags, System.Drawing.Image image, System.Drawing.Rectangle imageBounds, bool focused, System.Windows.Forms.VisualStyles.RadioButtonState state);
public static void DrawRadioButton(System.Drawing.Graphics g, System.Drawing.Point glyphLocation, System.Drawing.Rectangle textBounds, string? radioButtonText, System.Drawing.Font? font, System.Windows.Forms.TextFormatFlags flags, System.Drawing.Image image, System.Drawing.Rectangle imageBounds, bool focused, System.Windows.Forms.VisualStyles.RadioButtonState state);
static member DrawRadioButton : System.Drawing.Graphics * System.Drawing.Point * System.Drawing.Rectangle * string * System.Drawing.Font * System.Windows.Forms.TextFormatFlags * System.Drawing.Image * System.Drawing.Rectangle * bool * System.Windows.Forms.VisualStyles.RadioButtonState -> unit
Public Shared Sub DrawRadioButton (g As Graphics, glyphLocation As Point, textBounds As Rectangle, radioButtonText As String, font As Font, flags As TextFormatFlags, image As Image, imageBounds As Rectangle, focused As Boolean, state As RadioButtonState)
パラメーター
- flags
- TextFormatFlags
TextFormatFlags値のビットごとの組み合わせ。
- focused
- Boolean
true フォーカスの四角形を描画するには、それ以外の場合は false。
- state
- RadioButtonState
オプション ボタンの表示状態を指定する RadioButtonState 値の 1 つ。
注釈
オペレーティング システムでビジュアル スタイルが有効になっていて、visual スタイルが現在のアプリケーションに適用されている場合、このメソッドは現在の表示スタイルでオプション ボタンを描画します。 それ以外の場合、このメソッドは従来のWindows スタイルでオプション ボタンを描画します。