Mantain a control position fixed when scrolling a panel?

Well, it is technically possible, you just need to adjust the control position when the panel scrolls. For example: public partial class Form1 : Form { public Form1() { InitializeComponent(); mPicturePos = pictureBox1. Location; } Point mPicturePos; private void panel1_Scroll(object sender, ScrollEventArgs e) { pictureBox1.

Location = mPicturePos; } } However, you'll see that the control will start doing the pogo when you scroll the panel. The problem here is that Windows is being too helpful. It scrolls the content of the window itself with a fast bitblt, then sends a paint request for only the parts of the window that needs to be repainted It does this directed by a system option named "Show window contents while dragging", available in Appearance + Effects dialog of the Display applet in Control Panel.

You cannot reasonably turn this option off, it has system-wide effects. On Win7 it isn't even exposed anymore There is no good workaround for this, other than a simple one: don't put the control in the panel. Just make sure it is located on top of the panel.

That can be a bit tricky in the designer, put it next to the panel (Bring To Front if necessary) and edit the Location property by hand.

Well, it is technically possible, you just need to adjust the control position when the panel scrolls. For example: public partial class Form1 : Form { public Form1() { InitializeComponent(); mPicturePos = pictureBox1. Location; } Point mPicturePos; private void panel1_Scroll(object sender, ScrollEventArgs e) { pictureBox1.

Location = mPicturePos; } } However, you'll see that the control will start doing the pogo when you scroll the panel. The problem here is that Windows is being too helpful. It scrolls the content of the window itself with a fast bitblt, then sends a paint request for only the parts of the window that needs to be repainted.It does this directed by a system option named "Show window contents while dragging", available in Appearance + Effects dialog of the Display applet in Control Panel.

You cannot reasonably turn this option off, it has system-wide effects. On Win7 it isn't even exposed anymore. There is no good workaround for this, other than a simple one: don't put the control in the panel.

Just make sure it is located on top of the panel. That can be a bit tricky in the designer, put it next to the panel (Bring To Front if necessary) and edit the Location property by hand.

I think instead of pictureBox1 in my example I should use panel2... but. I tried your code - any change. I need to keep the label not the panel2(PictureBox in your code) – serhio Dec 24 '09 at 15:01 Erm, my advice was to not put the control in the panel.

– Hans Passant Dec 24 '09 at 15:14 In the real example, my panel is a user control that generates (creates and Controls. Add) some labels in its left side. The panel scrolls, but I need to keep the labels always visible.

I will complete the question with this information. – serhio Dec 28 '09 at 9:24 Simple: don't add the labels to the panel, add them to the UserControl. – Hans Passant Dec 28 '09 at 10:08 @nobugs: :) my panel is the user control that generate labels... maybe I need to 'retrieve' the panel(UsCtrl)'s parent but I never can be sure what the parent is and what is located in the place where I would like to place my labels.. – serhio Dec 28 '09 at 14:35.

Have a look at this it is related to your question.. But I have no idea whether it would solve your prob anyhow give a try stackoverflow.com/questions/1919997/main... and this one stackoverflow.com/questions/332788/maint....

Thanks, Pandiya. Unfortunately, any of these threads does not facilitate my problem. I can't use a TableLayoutPanel, the label1 should be strongly inside the panel2.

Nor the ThreeView case is not the mine. – serhio Dec 24 '09 at 11:56.

Public Form1() { this. InitializeComponent(); panel2. Paint += new PaintEventHandler(panel2_Paint); } void panel2_Paint(object sender, PaintEventArgs e) { label1.

Location = new Point(-panel1. AutoScrollPosition. X, label1.Location.

Y); }.

Well, it is technically possible, you just need to adjust the control position when the panel scrolls. However, you'll see that the control will start doing the pogo when you scroll the panel. The problem here is that Windows is being too helpful.

It scrolls the content of the window itself with a fast bitblt, then sends a paint request for only the parts of the window that needs to be repainted. It does this directed by a system option named "Show window contents while dragging", available in Appearance + Effects dialog of the Display applet in Control Panel. You cannot reasonably turn this option off, it has system-wide effects.

On Win7 it isn't even exposed anymore. There is no good workaround for this, other than a simple one: don't put the control in the panel. Just make sure it is located on top of the panel.

That can be a bit tricky in the designer, put it next to the panel (Bring To Front if necessary) and edit the Location property by hand.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions