Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You could set a <a href="http://blogs.msdn.com/toub/archive/2006/05/03/589468.aspx" rel="nofollow noreferrer">mouse hook</a> when the mouse button is pressed and unhook it when the mouse button is released. In the hook callback, you can watch the mouse position and resize the control as appropriate.</p> <p><b>Edit:</b> </p> <p>You could instead use a special control which the user can drag to hold the scroll position in the bottom right-hand corner of the parent container. The user could drag the control to make the area bigger and, if you are not using anchor or dock settings, you can manually adjust the size of your controls to fill the parent area.</p> <p>I implemented something like this a while back for a project I did. I made it triangular and look like similar to the "grip" on a <code>ToolStrip</code>. Here's some code fragments from the <code>ScrollHolder</code> control:</p> <pre><code>public ScrollHolder() { this.Size = new Size(21, 21); this.BackColor = SystemColors.Control; } protected override void OnPaint(PaintEventArgs e) { Point bottomLeft = new Point(0, this.Height); Point topRight = new Point(this.Width, 0); Pen controlDark = SystemPens.ControlDark; Pen controlLightLight = SystemPens.ControlLightLight; Pen controlDark2Px = new Pen(SystemColors.ControlDark, 2); Point bottomRight = new Point(this.Width, this.Height); e.Graphics.DrawLine( controlLightLight, bottomLeft.X, bottomLeft.Y - 2, bottomRight.X, bottomRight.Y - 2); e.Graphics.DrawLine(controlDark, bottomLeft, topRight); e.Graphics.DrawLine( controlLightLight, bottomLeft.X + 1, bottomLeft.Y, topRight.X, topRight.Y + 1); e.Graphics.DrawLine(controlDark2Px, bottomLeft, bottomRight); e.Graphics.DrawLine(controlDark2Px, bottomRight, topRight); int xNumberOfGripDots = this.Width / 4; for (int x = 1; x &lt; xNumberOfGripDots; x++) { for (int y = 1; y &lt; 5 - x; y++) { DrawGripDot(e.Graphics, new Point( this.Width - (y * 4), this.Height - (x * 4) - 1)); } } } private static void DrawGripDot(Graphics g, Point location) { g.FillRectangle( SystemBrushes.ControlLightLight, location.X + 1, location.Y + 1, 2, 2); g.FillRectangle(SystemBrushes.ControlDark, location.X, location.Y, 2, 2); } protected override void OnResize(EventArgs e) { this.SetRegion(); base.OnResize(e); } private void SetRegion() { GraphicsPath path = new GraphicsPath(); path.AddPolygon(new Point[] { new Point(this.Width, 0), new Point(this.Width, this.Height), new Point(0, this.Height) }); this.Region = new Region(path); } </code></pre> <p>As far as the actual behavior implementation goes, you will probably want to:</p> <ul> <li>Scroll to the scroll holder when it is moved outside the visible area:</li> <li>When scrolling to the scroll holder, slow it down by calling <code>Thread.Sleep</code> for a short time (such as 50 ms).</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload