12-11-2009 06:30 AM
Hello out there,
I need to change a slider's orientation at run-time. However, there is no property to do this - in design mode you click on a separate 'link' which magically arrives at changing it.
Can this magic be made public?
Thanks for any hints and best regards
Helmut Giese
Solved! Go to Solution.
12-11-2009 06:54 AM
What you may want to try is having 2 controls, 1 in each orientation, and show 1 while hiding the other. You can also move them off screen but hiding them is probably easier. Of course, you would need some logic added to know which one to read/update or you could just read and write to both. I've used this method to overlay text and graphics controls on top of each other in the same display area of a form. I would switch between the two depending on what I needed to do. You couldn't tell the difference in appearance.
Tom
12-11-2009 08:25 AM
Hi Tom,
hey, a sneaky solution.:)
In my context it looks like quite some work though. I am implementing kind of a mini VS environment, where the end user will select GUI elements from a restricted set of components, configure them as needed, etc. and in the end have his 'design' run like a 'real' programmer had been working with Visual Studio.
So I would have to handle this show/hide business at (user) design time, too, which looks a bit complicated.
But if all else fails, I could try to go this route. Still, since it can be done from within Visual Studio, there should be a way to do it programmatically.
Thanks for an interesting idea.
Helmut - keeping fingers crossed - Giese
12-11-2009 09:16 AM
hello hgiese -
The main part of the 'magic' that is happening is in the ScalePosition property. You could mimic the "Invert Orientation" action taken on a vertical slide with the following code:
NickB
National Instruments
12-11-2009 11:10 AM
Hi Nick,
great - exactly what I needed.
In fact, I had tried the ScalePosition property but the result just didn't look at all 'right' - but I had not considered exchanging the values for width and height.
Many thanks and have nice weekend.
Helmut Giese