TouchToolKit for WinForms | ComponentOne
Zooming Component / C1Zoom Control Events and Examples / Detecting Zooming
In This Topic
    Detecting Zooming
    In This Topic

    You can detect control bounds zooming by C1Zoom.ControlBoundsZooming event, and you can detect font size zooming by C1Zoom.ControlFontZooming event.

    Normally, ZoomPolicy is better way to share custom zoom behavior in multiple projects.

     

    In C1Zoom.ControlBoundsZooming event, you can cancel built-in control bounds zooming and you can implement your custom code for a control.

     

    [C#]

    private void c1Zoom1_ControlBoundsZooming(object sender, ControlBoundsZoomingEventArgs e)

    {

        if (e.TargetControl == button1)

        {

            e.Handled = true;

        }

    }

     

    [Visual Basic]

    Imports C1.Win.TouchToolKit

     

    Private Sub C1Zoom1_ControlBoundsZooming(sender As System.Object, e As ControlBoundsZoomingEventArgs) Handles C1Zoom1.ControlBoundsZooming

        If e.TargetControl Is Button1 Then

            e.Handled = True

        End If

    End Sub

     

    In C1Zoom.ControlFontZoming event, you can cancel built-in Font zooming and you can implement your custom code for a control. In the event, you need change default Font of target control because Control.Font property inherits parent control's Font setting if the Control.Font property is default. Also, C1Zoom.InnerPanel object need to be excluded.

     

    [C#]

    using C1.Win.TouchToolKit;

     

    private void Form1_Load(object sender, EventArgs e)

    {

        // There are 3 buttons on the Form, and change default font of a button

        button1.Font = new Font("MS UI Gothic", 9.0f);

    }

     

    private void c1Zoom1_ControlFontZooming(object sender, ControlFontZoomingEventArgs e)

    {

        if (e.TargetControl == button1)

        {

            e.Handled = true;

        }

    }

     

    [Visual Basic]

    Imports C1.Win.TouchToolKit

     

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

        ' There are 3 buttons on the Form, and change default font of a button

        Button1.Font = New Font("MS UI Gothic", 9.0F)

    End Sub

     

    Private Sub C1Zoom1_ControlFontZooming(sender As System.Object, e As ControlFontZoomingEventArgs) Handles C1Zoom1.ControlFontZooming

        If e.TargetControl Is Button1 Then

            e.Handled = True

        End If

    End Sub