Search code examples
.net-4.0c#-4.0controlslocationtabpage

Adding control to a location on a tabpage which has a scrollbar


I have a TabPage with a number of different slider controls on it (some custom range slider controls some normal TrackBar controls). When the user ticks or de-ticks certain checkboxes it deletes all the controls and re-constructs them again (according to what is required - a amount of range sliders and b amount of Trackbars).

I have a problem though, because the TabPage has a vertical scrollbar, it takes the initial x,y location to be 0,0 at the point where the user has scrolled to. So if the user scrolls down, ticks a box all the controls get located at lower points than where they should be.

Is there a way to change the initial location points to the actual tab page 0,0?

Or is there a way to change a control (which has the same properties) to another control type instead of delete and add one?


Solution

  • To answer my own question, I saved the current locations of the current controls and used that to reconstruct the new controls.