GetVScrollBarPosition Method (GdViewer)
In This Topic
Gets the current position of the vertical scrollbar, in pixels, related to the document currently displayed in the GdViewer control.
The resulting coordinate corresponds to the actual document area of the currently displayed page.
Syntax
'Declaration
Public Function GetVScrollBarPosition() As Integer
public int GetVScrollBarPosition()
public function GetVScrollBarPosition(): Integer;
public function GetVScrollBarPosition() : int;
public: int GetVScrollBarPosition();
public:
int GetVScrollBarPosition();
Return Value
The current vertical coordinate of the vertical scrollbar, in pixels, related to the displayed document.
Example
How to get the current position of the scrollbars.
'We assume that the GdViewer1 control has been properly integrated.
If GdViewer1.DisplayFromFile("") = GdPictureStatus.OK Then
'The current position of both scrollbars after displaying the document
'according to your currently defined GdViewer control settings.
Dim x As Integer = GdViewer1.GetHScrollBarPosition()
Dim y As Integer = GdViewer1.GetVScrollBarPosition()
MessageBox.Show("The scrollbars are set to this position: " + x + ", " + y, "GdViewer.GetVScrollBarPosition")
If (x <> 0) OrElse (y <> 0) Then
'Setting the scrollbars to the required position.
GdViewer1.SetHScrollBarPosition(0)
GdViewer1.SetVScrollBarPosition(0)
MessageBox.Show("The scrollbars are now set to this position: 0, 0", "GdViewer.GetVScrollBarPosition")
End If
'Do your other stuff here.
GdViewer1.CloseDocument()
Else
MessageBox.Show("This file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.GetVScrollBarPosition")
End If
//We assume that the GdViewer1 control has been properly integrated.
if (GdViewer1.DisplayFromFile("") == GdPictureStatus.OK)
{
//The current position of both scrollbars after displaying the document
//according to your currently defined GdViewer control settings.
int x = GdViewer1.GetHScrollBarPosition();
int y = GdViewer1.GetVScrollBarPosition();
MessageBox.Show("The scrollbars are set to this position: " + x + ", " + y, "GdViewer.GetVScrollBarPosition");
if ((x != 0) || (y != 0))
{
//Setting the scrollbars to the required position.
GdViewer1.SetHScrollBarPosition(0);
GdViewer1.SetVScrollBarPosition(0);
MessageBox.Show("The scrollbars are now set to this position: 0, 0", "GdViewer.GetVScrollBarPosition");
}
//Do your other stuff here.
GdViewer1.CloseDocument();
}
else
{
MessageBox.Show("This file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.GetVScrollBarPosition");
}
Example
How to get the current position of the scrollbars.
'We assume that the GdViewer1 control has been properly integrated.
If GdViewer1.DisplayFromFile("") = GdPictureStatus.OK Then
'The current position of both scrollbars after displaying the document
'according to your currently defined GdViewer control settings.
Dim x As Integer = GdViewer1.GetHScrollBarPosition()
Dim y As Integer = GdViewer1.GetVScrollBarPosition()
MessageBox.Show("The scrollbars are set to this position: " + x + ", " + y, "GdViewer.GetVScrollBarPosition")
If (x <> 0) OrElse (y <> 0) Then
'Setting the scrollbars to the required position.
GdViewer1.SetHScrollBarPosition(0)
GdViewer1.SetVScrollBarPosition(0)
MessageBox.Show("The scrollbars are now set to this position: 0, 0", "GdViewer.GetVScrollBarPosition")
End If
'Do your other stuff here.
GdViewer1.CloseDocument()
Else
MessageBox.Show("This file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.GetVScrollBarPosition")
End If
//We assume that the GdViewer1 control has been properly integrated.
if (GdViewer1.DisplayFromFile("") == GdPictureStatus.OK)
{
//The current position of both scrollbars after displaying the document
//according to your currently defined GdViewer control settings.
int x = GdViewer1.GetHScrollBarPosition();
int y = GdViewer1.GetVScrollBarPosition();
MessageBox.Show("The scrollbars are set to this position: " + x + ", " + y, "GdViewer.GetVScrollBarPosition");
if ((x != 0) || (y != 0))
{
//Setting the scrollbars to the required position.
GdViewer1.SetHScrollBarPosition(0);
GdViewer1.SetVScrollBarPosition(0);
MessageBox.Show("The scrollbars are now set to this position: 0, 0", "GdViewer.GetVScrollBarPosition");
}
//Do your other stuff here.
GdViewer1.CloseDocument();
}
else
{
MessageBox.Show("This file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.GetVScrollBarPosition");
}
See Also