J
jediknight
Hi,
I have a scrollable view which contains a picturebox.
I need to get the location of the top let hand corner of the view so I
can draw an icon.
When the picturebox is scrolled vertically I need the icon to remain in
the top left hand corner of the view.
At the moment whenever I scroll the picturebox down, the icon gets
hidden.
Thanks in advance.
private void pictureBox1_Paint(object sender,
System.Windows.Forms.PaintEventArgs e)
{
// Need to get the correct location otherwise the
rectangle will disappear when
// the picture is scrolled up
Rectangle boundingRect = new Rectangle(0, 0, 150, 50);
LinearGradientBrush myLinearGradientBrush = new LinearGradientBrush(
boundingRect,
Color.AliceBlue,
Color.Silver,
LinearGradientMode.ForwardDiagonal);
e.Graphics.FillRectangle(myLinearGradientBrush, boundingRect);
Rectangle rc = boundingRect;
rc.Inflate(-1,-1);
e.Graphics.DrawRectangle(new Pen(SystemColors.Highlight), rc);
}
I have a scrollable view which contains a picturebox.
I need to get the location of the top let hand corner of the view so I
can draw an icon.
When the picturebox is scrolled vertically I need the icon to remain in
the top left hand corner of the view.
At the moment whenever I scroll the picturebox down, the icon gets
hidden.
Thanks in advance.
private void pictureBox1_Paint(object sender,
System.Windows.Forms.PaintEventArgs e)
{
// Need to get the correct location otherwise the
rectangle will disappear when
// the picture is scrolled up
Rectangle boundingRect = new Rectangle(0, 0, 150, 50);
LinearGradientBrush myLinearGradientBrush = new LinearGradientBrush(
boundingRect,
Color.AliceBlue,
Color.Silver,
LinearGradientMode.ForwardDiagonal);
e.Graphics.FillRectangle(myLinearGradientBrush, boundingRect);
Rectangle rc = boundingRect;
rc.Inflate(-1,-1);
e.Graphics.DrawRectangle(new Pen(SystemColors.Highlight), rc);
}