Table of Contents

Property ClientRect



Gets the rectangle that represents the client area of the SyntaxEdit control.

public virtual Rectangle ClientRect { get; }

Property Value



Here is how to use a ClientRect in the C# code:

public partial class Form1 : Form
    private void Form1_Load(object sender, EventArgs e)
        var syntaxEdit1 = new Alternet.Editor.SyntaxEdit(this.components);
        syntaxEdit1.PaintBackground += new System.Windows.Forms.PaintEventHandler(this.SyntaxEdit1_PaintBackground);

    private void SyntaxEdit1_PaintBackground(object sender, PaintEventArgs e)
        Rectangle r = syntaxEdit1.ClientRect;
        e.Graphics.FillRectangle(new System.Drawing.Drawing2D.LinearGradientBrush(r.Location, new Point(r.Right, r.Bottom), System.Drawing.Color.DarkBlue, System.Drawing.Color.WhiteSmoke), r);

Here is how to use a ClientRect in the Visual Basic code:

Partial Public Class Form1
    Inherits Form

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
        Dim syntaxEdit1 = New Alternet.Editor.SyntaxEdit(Me.components)
        AddHandler syntaxEdit1.PaintBackground, New System.Windows.Forms.PaintEventHandler(AddressOf Me.SyntaxEdit1_PaintBackground)
    End Sub

    Private Sub SyntaxEdit1_PaintBackground(ByVal sender As Object, ByVal e As PaintEventArgs)
        Dim r As Rectangle = syntaxEdit1.ClientRect
        e.Graphics.FillRectangle(New System.Drawing.Drawing2D.LinearGradientBrush(r.Location, New Point(r.Right, r.Bottom), System.Drawing.Color.DarkBlue, System.Drawing.Color.WhiteSmoke), r)
    End Sub
End Class


The client area of a control is the bounds of the SyntaxEdit control, excluding the nonclient elements such as scroll bars, borders, and page rulers.