event Refreshing ()
Notifies your application when the pages are about to be refreshed.

TypeDescription
(fit-to-page) The Refreshing event notifies your application once the pages are about to be updated for previewing or printing. The Refresh event occurs once the pages are previewed or printed.  Use the Refreshing event to prepare the object to be printed, as changing particular properties, options and so on, so the print preview will be updated based on the new values. If you are changing properties of the object to be printed, you can restore their values during the Refresh event, after the pages were updated, when changes are not longer required. 

Syntax for Refreshing event, /NET version, on:

private void Refreshing(object sender)
{
}

Private Sub Refreshing(ByVal sender As System.Object) Handles Refreshing
End Sub

Syntax for Refreshing event, /COM version, on:

private void Refreshing(object sender, EventArgs e)
{
}

void OnRefreshing()
{
}

void __fastcall Refreshing(TObject *Sender)
{
}

procedure Refreshing(ASender: TObject; );
begin
end;

procedure Refreshing(sender: System.Object; e: System.EventArgs);
begin
end;

begin event Refreshing()
end event Refreshing

Private Sub Refreshing(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Refreshing
End Sub

Private Sub Refreshing()
End Sub

Private Sub Refreshing()
End Sub

LPARAMETERS nop

PROCEDURE OnRefreshing(oPrint)
RETURN

Syntax for Refreshing event, /COM version (others), on:

<SCRIPT EVENT="Refreshing()" LANGUAGE="JScript">
</SCRIPT>

<SCRIPT LANGUAGE="VBScript">
Function Refreshing()
End Function
</SCRIPT>

Procedure OnComRefreshing 
	Forward Send OnComRefreshing 
End_Procedure

METHOD OCX_Refreshing() CLASS MainDialog
RETURN NIL

void onEvent_Refreshing()
{
}

function Refreshing as v ()
end function

function nativeObject_Refreshing()
return

For instance, let's say that you need to provide the FitToPage feature for the eXG2antt chart control. The following samples show different implementations.

The following VB sample changes the UnitWidth property of the eXG2ant's Chart object so, the entire chart is printed to the page:

With Print1
    Dim l As Long
    With G2antt1.Chart
        l = .UnitWidth
        .UnitWidth = (Print1.ClientWidth - .PaneWidth(False)) / .CountVisibleUnits()
    End With
    Set .PrintExt = G2antt1.Object
    .Preview
    G2antt1.Chart.UnitWidth = l
End With

The sample has the disadvantage that once the user changes the Page's setup during Previewing the code is not re-executed, so the chart is displayed as it is on the screen. In order to update the UnitWidth property once the page's setup is changed, we need to handle the Refreshing and Refresh events as shown in the following VB sample:

Dim nUnitWidth As Long

Private Sub Print1_Refreshing()
    With G2antt1.Chart
        nUnitWidth = .UnitWidth
        .UnitWidth = (Print1.ClientWidth - .PaneWidth(False)) / .CountVisibleUnits()
    End With
End Sub

Private Sub Print1_Refresh()
    G2antt1.Chart.UnitWidth = nUnitWidth
End Sub

Private Sub Preview_Click()
    With Print1
        Set .PrintExt = G2antt1.Object
        .Preview
    End With
End Sub

The sample changes the UnitWidth property of the Chart during the Refresing event, so the chart fits to page, and restores the UnitWidth's value when the Refresh event is invoked. 

The following VB/NET sample changes the UnitWidth property so the chart fits to page:

Dim nUnitWidth As Long

Private Sub Exprint1_RefreshingEvent(ByVal sender As System.Object) Handles Exprint1.RefreshingEvent
    With Exg2antt1.Chart
        nUnitWidth = .UnitWidth
        .UnitWidth = (Exprint1.ClientWidth - .get_PaneWidth(False)) / .CountVisibleUnits()
    End With
End Sub

Private Sub Exprint1_RefreshEvent(ByVal sender As System.Object) Handles Exprint1.RefreshEvent
    Exg2antt1.Chart.UnitWidth = nUnitWidth
End Sub

Private Sub Preview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Preview.Click
    Exprint1.PrintExt = Exg2antt1
    Exprint1.Preview()
End Sub