Aracılığıyla paylaş


Glyph.Bounds Özellik

Tanım

sınırlarını Glyphalır.

public:
 virtual property System::Drawing::Rectangle Bounds { System::Drawing::Rectangle get(); };
public virtual System.Drawing.Rectangle Bounds { get; }
member this.Bounds : System.Drawing.Rectangle
Public Overridable ReadOnly Property Bounds As Rectangle

Özellik Değeri

Rectangle

Rectangle öğesinin sınırlarını Glyphtemsil eden bir .

Örnekler

Aşağıdaki örnekte, belirli boyutlara ve konuma sahip bir karakter oluşturmak için öğesinin nasıl geçersiz kılınacağı Bounds gösterilmektedir. Bu kod örneği, sınıfı için BehaviorService sağlanan daha büyük bir örneğin parçasıdır.

public:
    virtual property Rectangle Bounds
    {
        Rectangle get() override
        {
            // Create a glyph that is 10x10 and sitting
            // in the middle of the control.  Glyph coordinates
            // are in adorner window coordinates, so we must map
            // using the behavior service.
            Point edge = behavior->ControlToAdornerWindow(control);
            Size size = control->Size;
            Point center = Point(edge.X + (size.Width / 2),
                edge.Y + (size.Height / 2));

            Rectangle bounds = Rectangle(center.X - 5,
                center.Y - 5, 10, 10);

            return bounds;
        }
    }
public override Rectangle Bounds
{
    get
    {
        // Create a glyph that is 10x10 and sitting
        // in the middle of the control.  Glyph coordinates
        // are in adorner window coordinates, so we must map
        // using the behavior service.
        Point edge = behaviorSvc.ControlToAdornerWindow(control);
        Size size = control.Size;
        Point center = new Point(edge.X + (size.Width / 2), 
            edge.Y + (size.Height / 2));

        Rectangle bounds = new Rectangle(
            center.X - 5,
            center.Y - 5,
            10,
            10);

        return bounds;
    }
}
Public Overrides ReadOnly Property Bounds() As Rectangle
    Get
        ' Create a glyph that is 10x10 and sitting
        ' in the middle of the control.  Glyph coordinates
        ' are in adorner window coordinates, so we must map
        ' using the behavior service.
        Dim edge As Point = behaviorSvc.ControlToAdornerWindow(control)
        Dim size As Size = control.Size
        Dim center As New Point(edge.X + size.Width / 2, edge.Y + _
            size.Height / 2)

        Dim bounds1 As New Rectangle(center.X - 5, center.Y - 5, 10, 10)

        Return bounds1
    End Get
End Property

Şunlara uygulanır

Ayrıca bkz.