RadioButtonRenderer::GetGlyphSize Method (Graphics^, RadioButtonState)
.NET Framework (current version)
Returns the size, in pixels, of the option button (also known as a radio button) glyph.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Parameters
- g
-
Type:
System.Drawing::Graphics^
The Graphics used to draw the option button.
- state
-
Type:
System.Windows.Forms.VisualStyles::RadioButtonState
One of the RadioButtonState values that specifies the visual state of the option button.
Return Value
Type: System.Drawing::SizeA Size that represents the size, in pixels, of the option button glyph.
This value is determined by the current visual style of the operating system.
The following code example uses the GetGlyphSize method to determine the bounds of the option button text. This code example is part of a larger example provided for the RadioButtonRenderer class.
// Define the text bounds so that the text rectangle
// does not include the radio button.
public:
property Rectangle TextRectangle
{
Rectangle get()
{
Graphics^ g = this->CreateGraphics();
textRectangleValue.X = ClientRectangle.X +
RadioButtonRenderer::GetGlyphSize(g,
RadioButtonState::UncheckedNormal).Width;
textRectangleValue.Y = ClientRectangle.Y;
textRectangleValue.Width = ClientRectangle.Width -
RadioButtonRenderer::GetGlyphSize(g,
RadioButtonState::UncheckedNormal).Width;
textRectangleValue.Height = ClientRectangle.Height;
delete g;
return textRectangleValue;
}
}
.NET Framework
Available since 2.0
Available since 2.0
Show: