You can use the C1Magnify.MagnifierShowing event to change the Magnifier Window before the window is displayed. In the event, you can use different settings in different controls. Also, you can cancel showing the Magnifier Window when the e.Cancel property is set to True.
The following code shows a rectangular Magnifier window for a TextBox. It does not show the Magnifier window for NumericUpDown, but it shows a circular Magnifier window for other controls.
Visual Basic |
Copy Code
|
---|---|
Imports C1.Win.TouchToolKit Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load C1Magnify1.SetEnableMagnifier(TextBox1, True) C1Magnify1.SetEnableMagnifier(NumericUpDown1, True) End Sub Private Sub C1Magnify1_MagnifierShowing(sender As System.Object, e As C1.Win.TouchToolKit.MagnifierEventArgs) Handles C1Magnify1.MagnifierShowing If e.TargetControl Is TextBox1 Then Dim magnifier As C1Magnify = DirectCast(sender, C1Magnify) magnifier.Shape = MagnifierShape.Rectangle magnifier.Size = New Size(200, 30) ElseIf e.TargetControl Is NumericUpDown1 Then e.Cancel = True Else Dim magnifier As C1Magnify = DirectCast(sender, C1Magnify) magnifier.Shape = MagnifierShape.Circle magnifier.Size = New Size(100, 100) End If End Sub |
C# |
Copy Code
|
---|---|
using C1.Win.TouchToolKit;
private void Form1_Load(object sender, EventArgs e) { C1Magnify1.SetEnableMagnifier(textBox1, true); C1Magnify1.SetEnableMagnifier(numericUpDown1, true); }
private void C1Magnify1_MagnifierShowing(object sender, MagnifierEventArgs e) { if (e.TargetControl == textBox1) { C1Magnify magnifier = sender as C1Magnify; magnifier.Shape = MagnifierShape.Rectangle; magnifier.Size = new Size(200, 30); } else if (e.TargetControl == numericUpDown1) { e.Cancel = true; } else { C1Magnify magnifier = sender as C1Magnify; magnifier.Shape = MagnifierShape.Circle; magnifier.Size = new Size(100, 100); } } |