CheckBoxRenderer::GetGlyphSize Method (Graphics^, CheckBoxState)
.NET Framework (current version)
Returns the size of the check box glyph.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Parameters
- g
-
Type:
System.Drawing::Graphics^
The Graphics this operation will use.
- state
-
Type:
System.Windows.Forms.VisualStyles::CheckBoxState
One of the CheckBoxState values that specifies the visual state of the check box.
The size of the check box glyph 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 check box text. This code example is part of a larger example provided for the CheckBoxRenderer class.
// Calculate the text bounds, exluding the check box. Rectangle getTextRectangle() { Graphics ^g = this->CreateGraphics(); textRectangleValue.X = ClientRectangle.X + CheckBoxRenderer::GetGlyphSize(g, CheckBoxState::UncheckedNormal).Width; textRectangleValue.Y = ClientRectangle.Y; textRectangleValue.Width = ClientRectangle.Width - CheckBoxRenderer::GetGlyphSize(g, CheckBoxState::UncheckedNormal).Width; textRectangleValue.Height = ClientRectangle.Height; delete g; return textRectangleValue; }
.NET Framework
Available since 2.0
Available since 2.0
Show: