Scrolled object positioning
-
Can anyone help as I am having a little trouble.. I have a panel with AutoScroll = True. I have added a panel to this control which is bigger than the parent, so scroll bars appear. Then I add another panel calculating the position using
panelPos = PanelList.Count * APanel.Height; APanel.Location = new System.Drawing.Point(30, 38 + panelPos);
When the scroll box is not scrolled adding panels puts each one directly below the next as I want. But if the parent is scrolled down then the position is wrong (the new panel is added too low down) by an offset. I thought the answer would be in the AutoScrollPosition property but I haven't been succesful in making it work. Any ideas? TIA Luke -
Can anyone help as I am having a little trouble.. I have a panel with AutoScroll = True. I have added a panel to this control which is bigger than the parent, so scroll bars appear. Then I add another panel calculating the position using
panelPos = PanelList.Count * APanel.Height; APanel.Location = new System.Drawing.Point(30, 38 + panelPos);
When the scroll box is not scrolled adding panels puts each one directly below the next as I want. But if the parent is scrolled down then the position is wrong (the new panel is added too low down) by an offset. I thought the answer would be in the AutoScrollPosition property but I haven't been succesful in making it work. Any ideas? TIA LukeIf you look at the documentation for the
AutoScrollPosition
property, it states that negative values are returned for theX
andY
properties of thePoint
returned from the property if a user has scrolled away from the starting position (0,0). Make sure you negate these values before factoring them into your new position for child panels. See DirectX 9.0 - Get Ambient with DirectSound[^] which should contain a sample like this (judging by the way the program works).-----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----