GetMouseLeftInDocument Method (GdViewer)
In This Topic
Returns the horizontal (X) coordinate (0-based) of the mouse cursor position located in the document area, in pixels,
related to the current page of the displayed document in the GdViewer control.
Syntax
'Declaration
Public Function GetMouseLeftInDocument() As Integer
public int GetMouseLeftInDocument()
public function GetMouseLeftInDocument(): Integer;
public function GetMouseLeftInDocument() : int;
public: int GetMouseLeftInDocument();
public:
int GetMouseLeftInDocument();
Return Value
The horizontal coordinate of the current mouse cursor position related to the document area, in pixels.
If you want to get the actual position in inches, just use PosInches = GdViewer.GetMouseLeftInDocument() / GdViewer.HorizontalResolution.
Example
How to zoom on the specified document area according to the mouse cursor position.
'We assume that the GdViewer1 control has been properly integrated.
Sub GdViewer1_MouseClick(ByVal sender As Object, ByVal e As MouseEventArgs)
Dim left As Integer = GdViewer1.GetMouseLeftInDocument()
Dim top As Integer = GdViewer1.GetMouseTopInDocument()
Dim width As Integer = 400, height As Integer = 200
GdViewer1.ZoomArea(left - width / 2, top - height / 2, width, height)
End Sub
//We assume that the GdViewer1 control has been properly integrated.
void GdViewer1_MouseClick(object sender, MouseEventArgs e)
{
int left = GdViewer1.GetMouseLeftInDocument();
int top = GdViewer1.GetMouseTopInDocument();
int width = 400, height = 200;
GdViewer1.ZoomArea(left - width/2, top - height/2, width, height);
}
Example
How to zoom on the specified document area according to the mouse cursor position.
'We assume that the GdViewer1 control has been properly integrated.
Sub GdViewer1_MouseClick(ByVal sender As Object, ByVal e As MouseEventArgs)
Dim left As Integer = GdViewer1.GetMouseLeftInDocument()
Dim top As Integer = GdViewer1.GetMouseTopInDocument()
Dim width As Integer = 400, height As Integer = 200
GdViewer1.ZoomArea(left - width / 2, top - height / 2, width, height)
End Sub
//We assume that the GdViewer1 control has been properly integrated.
void GdViewer1_MouseClick(object sender, MouseEventArgs e)
{
int left = GdViewer1.GetMouseLeftInDocument();
int top = GdViewer1.GetMouseTopInDocument();
int width = 400, height = 200;
GdViewer1.ZoomArea(left - width/2, top - height/2, width, height);
}
See Also