CheckBoxRenderer.GetGlyphSize(Graphics, CheckBoxState) Yöntem
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Onay kutusu karakteri boyutunu döndürür.
public:
static System::Drawing::Size GetGlyphSize(System::Drawing::Graphics ^ g, System::Windows::Forms::VisualStyles::CheckBoxState state);
public static System.Drawing.Size GetGlyphSize (System.Drawing.Graphics g, System.Windows.Forms.VisualStyles.CheckBoxState state);
static member GetGlyphSize : System.Drawing.Graphics * System.Windows.Forms.VisualStyles.CheckBoxState -> System.Drawing.Size
Public Shared Function GetGlyphSize (g As Graphics, state As CheckBoxState) As Size
Parametreler
- state
- CheckBoxState
CheckBoxState Onay kutusunun görsel durumunu belirten değerlerden biri.
Döndürülenler
Size Onay kutusu karakteri boyutunu temsil eden bir.
Örnekler
Aşağıdaki kod örneği, onay kutusu metninin sınırlarını belirlemek için yöntemini kullanır GetGlyphSize . Bu kod örneği, sınıfı için CheckBoxRenderer sağlanan daha büyük bir örneğin parçasıdır.
// 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;
}
// Calculate the text bounds, exluding the check box.
public Rectangle TextRectangle
{
get
{
using (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;
}
return textRectangleValue;
}
}
' Calculate the text bounds, exluding the check box.
Public ReadOnly Property TextRectangle() As Rectangle
Get
Using g As Graphics = Me.CreateGraphics()
With textRectangleValue
.X = Me.ClientRectangle.X + _
CheckBoxRenderer.GetGlyphSize(g, _
CheckBoxState.UncheckedNormal).Width
.Y = Me.ClientRectangle.Y
.Width = Me.ClientRectangle.Width - _
CheckBoxRenderer.GetGlyphSize(g, _
CheckBoxState.UncheckedNormal).Width
.Height = Me.ClientRectangle.Height
End With
End Using
Return textRectangleValue
End Get
End Property
Açıklamalar
Onay kutusu karakteri boyutu, işletim sisteminin geçerli görsel stiline göre belirlenir.
Şunlara uygulanır
Geri Bildirim
https://aka.ms/ContentUserFeedback.
Çok yakında: 2024 boyunca, içerik için geri bildirim mekanizması olarak GitHub Sorunları’nı kullanımdan kaldıracak ve yeni bir geri bildirim sistemiyle değiştireceğiz. Daha fazla bilgi için bkz.Gönderin ve geri bildirimi görüntüleyin