SetHorizontalScrollBarPosition Method
In This Topic
Sets the required position of the horizontal scrollbar, in pixels, related to the document currently displayed in the GdViewer control. In other words, the horizontal scrollbar moves to the newly specified coordinate on the horizontal axis. This coordinate relates to the actual document area of the currently displayed page.
The Scroll event, respectively the PreviewScroll event, is raised if the scrollbar has moved.
Syntax
'Declaration
Public Sub SetHorizontalScrollBarPosition( _
ByVal As Double _
)
public void SetHorizontalScrollBarPosition(
double
)
public procedure SetHorizontalScrollBarPosition(
: Double
);
public function SetHorizontalScrollBarPosition(
: double
);
public: void SetHorizontalScrollBarPosition(
double
)
public:
void SetHorizontalScrollBarPosition(
double
)
Parameters
- NewPos
- The new horizontal coordinate, in pixels, where the horizontal scrollbar is to be moved.
If this value is out of the expected range, the toolkit sets the current value to the nearest one, means minimum or maximum one.
Example
How to set the new 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 Double = GdViewer1.GetHorizontalScrollBarPosition()
Dim y As Double = GdViewer1.GetVerticalScrollBarPosition()
MessageBox.Show("The scrollbars are set to this position: " + x + ", " + y, "GdViewer.SetHorizontalScrollBarPosition")
If (x <> 0) OrElse (y <> 0) Then
'Setting the scrollbars to the required position.
GdViewer1.SetHorizontalScrollBarPosition(0)
GdViewer1.SetVerticalScrollBarPosition(0)
MessageBox.Show("The scrollbars are now set to this position: 0, 0", "GdViewer.SetHorizontalScrollBarPosition")
End If
'Do your other stuff here.
GdViewer1.CloseDocument()
Else
MessageBox.Show("This file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SetHorizontalScrollBarPosition")
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.
double x = GdViewer1.GetHorizontalScrollBarPosition();
double y = GdViewer1.GetVerticalScrollBarPosition();
MessageBox.Show("The scrollbars are set to this position: " + x.ToString() + ", " + y.ToString(), "GdViewer.SetHorizontalScrollBarPosition");
if ((x != 0) || (y != 0))
{
//Setting the scrollbars to the required position.
GdViewer1.SetHorizontalScrollBarPosition(0);
GdViewer1.SetVerticalScrollBarPosition(0);
MessageBox.Show("The scrollbars are now set to this position: 0, 0", "GdViewer.SetHorizontalScrollBarPosition");
}
//Do your other stuff here.
GdViewer1.CloseDocument();
}
else
MessageBox.Show("This file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SetHorizontalScrollBarPosition");
Example
How to set the new 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 Double = GdViewer1.GetHorizontalScrollBarPosition()
Dim y As Double = GdViewer1.GetVerticalScrollBarPosition()
MessageBox.Show("The scrollbars are set to this position: " + x + ", " + y, "GdViewer.SetHorizontalScrollBarPosition")
If (x <> 0) OrElse (y <> 0) Then
'Setting the scrollbars to the required position.
GdViewer1.SetHorizontalScrollBarPosition(0)
GdViewer1.SetVerticalScrollBarPosition(0)
MessageBox.Show("The scrollbars are now set to this position: 0, 0", "GdViewer.SetHorizontalScrollBarPosition")
End If
'Do your other stuff here.
GdViewer1.CloseDocument()
Else
MessageBox.Show("This file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SetHorizontalScrollBarPosition")
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.
double x = GdViewer1.GetHorizontalScrollBarPosition();
double y = GdViewer1.GetVerticalScrollBarPosition();
MessageBox.Show("The scrollbars are set to this position: " + x.ToString() + ", " + y.ToString(), "GdViewer.SetHorizontalScrollBarPosition");
if ((x != 0) || (y != 0))
{
//Setting the scrollbars to the required position.
GdViewer1.SetHorizontalScrollBarPosition(0);
GdViewer1.SetVerticalScrollBarPosition(0);
MessageBox.Show("The scrollbars are now set to this position: 0, 0", "GdViewer.SetHorizontalScrollBarPosition");
}
//Do your other stuff here.
GdViewer1.CloseDocument();
}
else
MessageBox.Show("This file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SetHorizontalScrollBarPosition");
See Also