RadioButtonRenderer.GetGlyphSize メソッド
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

Dim g As Graphics Dim state As RadioButtonState Dim returnValue As Size returnValue = RadioButtonRenderer.GetGlyphSize(g, state)
戻り値
オプション ボタンのグリフのサイズをピクセル単位で表す Size。


GetGlyphSize メソッドを使用して、オプション ボタン テキストの境界を判断するコード例を次に示します。このコード例は、RadioButtonRenderer クラスのトピックで取り上げているコード例の一部分です。
' Define the text bounds so that the text rectangle ' does not include the radio button. Public ReadOnly Property TextRectangle() As Rectangle Get Using g As Graphics = Me.CreateGraphics() With textRectangleValue .X = Me.ClientRectangle.X + _ RadioButtonRenderer.GetGlyphSize(g, _ RadioButtonState.UncheckedNormal).Width .Y = Me.ClientRectangle.Y .Width = Me.ClientRectangle.Width - _ RadioButtonRenderer.GetGlyphSize(g, _ RadioButtonState.UncheckedNormal).Width .Height = Me.ClientRectangle.Height End With End Using Return textRectangleValue End Get End Property
// Define the text bounds so that the text rectangle // does not include the radio button. public Rectangle TextRectangle { get { using (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; } return textRectangleValue; } }
// 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; } }

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- RadioButtonRenderer.GetGlyphSize メソッドのページへのリンク