Partager via


InkPicture.MarginX Property

InkPicture.MarginX Property

Gets or sets the margins along the x-axis, in pixels.

Definition

Visual Basic .NET Public Property MarginX As Integer
C# public int MarginX { get; set; }
Managed C++ public: __property int* get_MarginX();
public: __property void set_MarginX(int*);

Property Value

System.Int32. The margins along the x-axis, in pixels.

This property is read/write.

DefaultMargin property Default. The DefaultMargin field of the InkPicture control.
Int32 The application-defined margins along the x-axis.

Exceptions

COMException Leave Site:
InvalidOperationException Leave Site: Margins cannot be changed while the InkCollector is enabled
ObjectDisposedException Leave Site:

Remarks

This margin provides a buffer around the edge of the ink window. The DefaultMargin field specifies the default margin that the MarginX property uses.

This property is most commonly used with nonintegrated tablet devices. The buffer gives users a margin of error when writing on a device that may not map directly to the size of the display screen.

A positive margin extends outside the bounds of the InkPicture control, a negative margin extends inside the bounds of the control, and a value of zero produces no margin. Ink is collected if the stroke starts within the margin.

This behavior does not clip the ink. The bounds of the control are either the GetWindowInputRectangle property or the client rectangle for the window.

The margin is effective only within the application's window. If the pen is applied outside the application's window, then the application loses focus and cannot collect ink.

Note: Ink collection on the InkPicture control must be disabled before setting this property. To disable ink collection on the InkPicture control, set the InkEnabled property to false. You can then set the MarginX property, and re-enable ink collection on the control by setting the InkEnabled property to true.

Examples

[C#]

This C# example sets the x-axis margin of a window rectangle for an InkPicture control, theInkPicture, to five pixels.

theInkPicture.MarginX = 5;

[Visual Basic .NET]

This Microsoft® Visual Basic® .NET example sets the x-axis margin of a window rectangle for an InkPicture control, theInkPicture, to five pixels.

theInkPicture.MarginX = 5

See Also