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

    You can use the C1Zoom.ControlAutoShowing event to determine the cancelation of the control's Auto Showing based on the cause of the event.

    For example, you can cancel the auto scroll of the Form when the control is partially displayed.

    Visual Basic
    Copy Code

    Imports C1.Win.TouchToolKit

     Private Sub C1Zoom1_ControlAutoShowing(sender As System.Object, e As ControlAutoShowingEventArgs) Handles C1Zoom1.ControlAutoShowing

        ' Do not auto scroll if a control is displayed

        If C1Zoom1.GetDisplayRectangle(e.Showinc1ontrol).Size = e.Showinc1ontrol.Size Then

            e.Cancel = True

        End If

         ' Do not auto scroll if a control is partial displayed

        If C1Zoom1.GetDisplayRectangle(e.Showinc1ontrol).IsEmpty Then

            e.Cancel = True

        End If

         ' Do not auto scroll if a control's most part is shown

        If C1Zoom1.GetDisplayRectangle(e.Showinc1ontrol).Size.Height > 30 Then

            e.Cancel = True

        End If

    End Sub

     

    C#
    Copy Code

    using C1.Win.TouchToolKit;

    private void C1Zoom1_ControlAutoShowing(object sender, ControlAutoShowingEventArgs e)

    {

        // Do not auto scroll if a control is displayed

        if (C1Zoom1.GetDisplayRectangle(e.Showinc1ontrol).Size == e.Showinc1ontrol.Size)

        {

            e.Cancel = true;

        }

     

        // Do not auto scroll if a control is partial displayed

        if (!C1Zoom1.GetDisplayRectangle(this.button1).IsEmpty)

        {

            e.Cancel = true;

        }

     

        // Do not auto scroll if a control's most part is shown

        if (C1Zoom1.GetDisplayRectangle(this.button1).Size.Height > 30)

        {

            e.Cancel = true;

        }

    }