Back to Devexpress

LayoutControl.Refresh() Method

windowsforms-devexpress-dot-xtralayout-dot-layoutcontrol-509648f9.md

latest2.3 KB
Original Source

LayoutControl.Refresh() Method

Updates the layout control.

Namespace : DevExpress.XtraLayout

Assembly : DevExpress.XtraLayout.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
public override void Refresh()
vb
Public Overrides Sub Refresh

Remarks

The Refresh method recalculates all the graphical information of the layout control and then redraws it.

Example

The following code custom paints a label embedded in the LayoutControl. This label displays the count variable’s value. When the count changes, call the LayoutControl.Refresh method to redraw the label (fire the BaseLayoutItem.CustomDraw event).

csharp
int count = 0;
Font myFont = new Font("Tahoma", 12, FontStyle.Bold);
private void simpleLabelItem1_CustomDraw(object sender, DevExpress.XtraLayout.ItemCustomDrawEventArgs e) {
    e.Cache.DrawString("COUNT=" + count.ToString(), myFont, Brushes.Blue, e.Bounds);
    e.Handled = true;
}

private void button1_Click(object sender, EventArgs e) {
    count++;
    layoutControl1.Refresh();
}
vb
Dim count As Integer = 0
Dim myFont As New Font("Tahoma", 12, FontStyle.Bold)
Private Sub SimpleLabelItem1_CustomDraw(sender As Object, e As DevExpress.XtraLayout.ItemCustomDrawEventArgs) Handles SimpleLabelItem1.CustomDraw
    e.Cache.DrawString("COUNT=" + count.ToString(), myFont, Brushes.Blue, e.Bounds)
    e.Handled = True
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    count = count + 1
    layoutControl1.Refresh()
End Sub

See Also

LayoutControl Class

LayoutControl Members

DevExpress.XtraLayout Namespace