[]
        
(Showing Draft Content)

C1.Win.TouchToolKit.C1Magnify

C1Magnify Class

Represents the component which can be attached to any existing control, after long tap on the control, a magnifier will popup above the finger, and shows the info around the finger.

Inheritance
C1Magnify
Namespace: C1.Win.TouchToolKit
Assembly: C1.Win.TouchToolKit.8.dll
Syntax
[ToolboxBitmap(typeof(C1Magnify), "C1Magnify.png")]
public class C1Magnify : Component, IComponent, IDisposable, IExtenderProvider
Remarks

A form can attach two or more C1Magnify component, if has two or more fingers long tap on the attach control, only first magnifier popup.

Examples

The following code example shows how to use C1Magnify component.

You can copy the code to a exsit Windows Forms appliction. And set the form in the sample code as start form.

If you find a licenses error when run this code. Try to drag a C1Magnify component to a any Form from tool box can generate the licenses information to this project.

public class GcMagnifierDemo : Form
{
	private TextBox _magnifierTextBox;
	private GcMagnifier _gcMagnifierObj = new GcMagnifier();

	public GcMagnifierDemo()
	{
		InitializeComponent();

		// Enable GcMagnifier component to _firstTextBox.
		_gcMagnifierObj.SetEnableMagnifier(_magnifierTextBox, true);
		Console.WriteLine(_gcMagnifierObj.GetEnableMagnifier(_magnifierTextBox).ToString());

		// Set magnifier property
		SetGcMagnifier();
	}

	public void SetGcMagnifier()
	{
		// Set the duration from finger press to magnifier popup in millisecond
		_gcMagnifierObj.PopupDelay = 500;

		// Mouse right click message will be posted to the _firstTextBox when magnifier close
		_gcMagnifierObj.MessageWhenClose = MessageWhenClose.RightClick;

		// Mouse move message will be posted to the _firstTextBox when magnifier close
		 _gcMagnifierObj.MessageWhenMove = MessageWhenMove.Move;

		// Magnifier display the system cursor
		_gcMagnifierObj.ShowCursor = true;

		// Magnifier size in pixels
		_gcMagnifierObj.Size = new Size(100, 100);

		// Magnifier appearance
		_gcMagnifierObj.Shape = MagnifierShape.Rectangle;

		// Magnifier border width in pixels
		_gcMagnifierObj.BorderWidth = 10;

		// Magnifier background mode. If property value is BorderBackground.Custom,
		// user can to use BorderBackground property to set the background image.
		_gcMagnifierObj.BorderBackgroundMode = BorderBackground.Dark;

		// Magnifier zoom factor
		_gcMagnifierObj.ZoomFactor = 2f;

		// The magnifier will lock the move direction vertically and horizontally.
		_gcMagnifierObj.IsHorizontalRailEnabled = true;
		_gcMagnifierObj.IsVerticalRailEnabled = true;
	}

	private void InitializeComponent()
	{
		_magnifierTextBox = new TextBox();
		_magnifierTextBox.Text = "This is a TextBox";
		_magnifierTextBox.Location = new Point(20, 20);
		_magnifierTextBox.Size = new Size(160, 20);
		this.Controls.Add(_magnifierTextBox);
	}
}
Public Class GcMagnifierDemo
	Inherits Form
	Private _magnifierTextBox As TextBox
	Private _gcMagnifierObj As New GcMagnifier()

	Public Sub New()
		InitializeComponent()

		' Enable GcMagnifier component to _firstTextBox.
		_gcMagnifierObj.SetEnableMagnifier(_magnifierTextBox, True)
		Console.WriteLine(_gcMagnifierObj.GetEnableMagnifier(_magnifierTextBox).ToString())

		' Set magnifier property
		SetGcMagnifier()
	End Sub

	Public Sub SetGcMagnifier()
		' Set the duration from finger press to magnifier popup in millisecond
		_gcMagnifierObj.PopupDelay = 500

		' Mouse right click message will be posted to the _firstTextBox when magnifier close
		_gcMagnifierObj.MessageWhenClose = MessageWhenClose.RightClick

		' Mouse move message will be posted to the _firstTextBox when magnifier close
		_gcMagnifierObj.MessageWhenMove = MessageWhenMove.Move

		' Magnifier display the system cursor
		_gcMagnifierObj.ShowCursor = True

		' Magnifier size in pixels
		_gcMagnifierObj.Size = New Size(100, 100)

		' Magnifier appearance
		_gcMagnifierObj.Shape = MagnifierShape.Rectangle

		' Magnifier border width in pixels
		_gcMagnifierObj.BorderWidth = 10

		' Magnifier background mode. If property value is BorderBackground.Custom,
		' user can to use BorderBackground property to set the background image.
		_gcMagnifierObj.BorderBackgroundMode = BorderBackground.Dark

		' Magnifier zoom factor
		_gcMagnifierObj.ZoomFactor = 2.0F

		' The magnifier will lock the move direction vertically and horizontally.
		_gcMagnifierObj.IsHorizontalRailEnabled = True
		_gcMagnifierObj.IsVerticalRailEnabled = True
	End Sub

	Private Sub InitializeComponent()
		_magnifierTextBox = New TextBox()
		_magnifierTextBox.Text = "This is a TextBox"
		_magnifierTextBox.Location = New Point(20, 20)
		_magnifierTextBox.Size = New Size(160, 20)
		Me.Controls.Add(_magnifierTextBox)
	End Sub
End Class

Constructors

Name Description
C1Magnify()

Initializes a new instance of the C1Magnify class.

Properties

Name Description
BorderBackground

Gets or sets a value indicating the background image used for the border of the magnifier.

BorderBackgroundMode

Gets or sets a value indicating the background mode used for the border of the magnifier.

BorderWidth

Gets or sets a value indicating the border width of the magnifier in pixels.

IsHorizontalRailEnabled

Gets or sets a value indicating whether the magnifier will lock the move direction horizontally.

IsVerticalRailEnabled

Gets or sets a value indicating whether the magnifier will lock the move direction vertically.

MessageWhenClose

Gets or sets a value indicating which message will be posted to the attach control when magnifier closed.

MessageWhenMove

Gets or sets a value indicating which message will be posted to the attach control when magnifier is moving.

PopupDelay

Gets or sets a value indicating the duration from finger press to magnifier popup in millisecond.

Shape

Gets or sets a value indicating the appearance of the magnifier.

ShowCursor

Gets or sets a value indicating whether system cursor is displayed in the magnifier.

Size

Gets or sets a value indicating the size of the magnifier in pixels.

ZoomFactor

Gets or sets a value indicating the zoom factor of the magnifier.

Methods

Name Description
AboutBox()

Shows the product information window.

CanExtend(object)

Specifies whether this object can provide its extender properties to the specified object.

Dispose(bool)

Releases the unmanaged resources used by the Component and optionally releases the managed resources.

GetEnableMagnifier(Control)

Retrieves the C1Magnify associated with the specified control or not.

OnClosed(MagnifierEventArgs)

Raises the Closed event.

OnMagnifierShowing(MagnifierShowingEventArgs)

Raises the MagnifierShowing event.

OnMove(MagnifierEventArgs)

Raises the Move event.

SetEnableMagnifier(Control, bool)

Associates C1Magnify with the specified control.

Events

Name Description
Closed

Occurs when the magnifier is closed.

MagnifierShowing

Occurs when the magnifier is opening.

Move

Occurs when the magnifier is moving.