[]
        
(Showing Draft Content)

C1.Win.TouchToolKit.C1ZoomPanel.ScrollLocation

ScrollLocation Property

ScrollLocation

Gets or sets the scroll location of the panel.

Declaration
[Browsable(false)]
public Point ScrollLocation { get; set; }
Property Value
Type Description
Point

A Point value that represents the scroll location of the panel in pixels.

Remarks

The ScrollLocation property represents the location of the visible portion of a the panel. Use this property to change the portion of the control that is displayed.

note

The X and Y coordinate values retrieved are negative if the control has scrolled away from its starting position (0,0). When you set this property, you must always assign positive X and Y values to set the scroll position relative to the starting position. For example, if you have a horizontal scroll bar and you set x and y to 200, you move the scroll 200 pixels to the right; if you then set x and y to 100, the scroll appears to jump the left by 100 pixels, because you are setting it 100 pixels away from the starting position. In the first case, ScrollLocation returns {-200, 0}; in the second case, it returns {-100,0}.

If the set value bigger than scrollable maximum value, the ScrollLocation will adjust the value to maximum value automatically. And also, if the set value smaller than scrollable minimum value, the ScrollLocation will adjust the value to minimum value automatically.

Examples

The following code example shows how to use this property.

This code example is part of a larger example provided for the ScrollIndicatorMode property.

public class GcZoomScrollDemo : Form
{
	private Button _scrollButton;
	private GcZoom _gcZoom1 = new GcZoom();

	public GcZoomScrollDemo()
	{
		InitializeComponent();

		_gcZoom1.Target = this;

		_scrollButton.Click += _scrollButton_Click;
	}

	void _scrollButton_Click(object sender, EventArgs e)
	{
		_gcZoom1.ScrollLocation = new Point(0, 0);
	}

	private void InitializeComponent()
	{
		_scrollButton = new Button();
		_scrollButton.Size = new Size(200, 25);
		_scrollButton.Text = "Scroll to (0, 0)";
		_scrollButton.Location = new Point(20, 110);
		this.Controls.Add(_scrollButton);
	}
}
Public Class GcZoomScrollDemo
	Inherits Form
	Private _scrollButton As Button
	Private _gcZoom1 As New GcZoom()

	Public Sub New()
		InitializeComponent()

		_gcZoom1.Target = Me

		AddHandler _scrollButton.Click, AddressOf _scrollButton_Click
	End Sub

	Private Sub _scrollButton_Click(sender As Object, e As EventArgs)
		_gcZoom1.ScrollLocation = New Point(0, 0)
	End Sub

	Private Sub InitializeComponent()
		_scrollButton = New Button()
		_scrollButton.Size = New Size(200, 25)
		_scrollButton.Text = "Scroll to (0, 0)"
		_scrollButton.Location = New Point(20, 110)
		Me.Controls.Add(_scrollButton)
	End Sub
End Class