With the help of this wonderful forum I managed to draw rotated stuff on a wxGCDC, which is wonderful.
Now I have custom wxPanel "buttons" to select parts of an image, in this case the arrow buttons can be clicked to select a row/column of circles:
The image can be rotated, as seen here, now how can I rotate the wxPanel buttons accordingly? I have a rotation center point from the image and I know how many degrees in which direction. I can calculate the right position with basic (co)sinus, but can I rotate the wxPanel itself?
rotate a wxPanel Topic is solved
Re: rotate a wxPanel
I believe a wxPanel nor any other child window cannot be rotated, at least on MSW. AFAIK, only top level windows can have a shape where the window sides are not parallel with the screen sides but they still cannot be rotated.
I do not think I have ever seen a rotated window in my life. Aren't things like this usually done with custom drawing (including e.g. WPF controls with transforms) instead of using native windows?
I do not think I have ever seen a rotated window in my life. Aren't things like this usually done with custom drawing (including e.g. WPF controls with transforms) instead of using native windows?
-
- Ultimate wxWidgets Guru
- Posts: 539
- Joined: Fri May 22, 2009 8:52 am
- Location: Bremen, Germany
Re: rotate a wxPanel
A custom drawing would be possible of course, but it would be quite an effort to incorporate button feeling with mouseover and cursor change to show the user that a certain area is clickable.
Re: rotate a wxPanel
I understand that no one wants to re-invent a wxButton. But assuming I was not wrong, what is the alternative?
Re: rotate a wxPanel
Hi,
You can also try using OpenGL.
Thank you.
You can also try using OpenGL.
Thank you.
-
- Ultimate wxWidgets Guru
- Posts: 539
- Joined: Fri May 22, 2009 8:52 am
- Location: Bremen, Germany
Re: rotate a wxPanel
thank you for your tip!
while starting to implement a mouse sensitive bitmap with all the button images on it, I realized there is a performance advantage compared to having a lot of single buttons. It could happen in my case that I need to create and display >100 and that takes a while with wxPanel based controls. So I am happy with this new approach.
while starting to implement a mouse sensitive bitmap with all the button images on it, I realized there is a performance advantage compared to having a lot of single buttons. It could happen in my case that I need to create and display >100 and that takes a while with wxPanel based controls. So I am happy with this new approach.
-
- Ultimate wxWidgets Guru
- Posts: 539
- Joined: Fri May 22, 2009 8:52 am
- Location: Bremen, Germany
Re: rotate a wxPanel
I did not read this properly the first time. What do you mean by "wpf controls"? My approach would be to calculate if the mouse is over a painted button area on the bitmap?
Re: rotate a wxPanel
WPF is Microsoft's (not only) GUI library for Windows, available from .NET. It allows applying various transformations incl. rotation to the controls but all the controls are custom-drawn by the library, it does not use the native Win32 controls. I just used WPF as a rare GUI example where the controls can be rotated, but they are not the native Win32 controls wxWidgets uses.
-
- Ultimate wxWidgets Guru
- Posts: 539
- Joined: Fri May 22, 2009 8:52 am
- Location: Bremen, Germany
Re: rotate a wxPanel
okay, good to know, thanx! i do not use .net though.PB wrote: ↑Wed Jan 29, 2020 10:02 am WPF is Microsoft's (not only) GUI library for Windows, available from .NET. It allows applying various transformations incl. rotation to the controls but all the controls are custom-drawn by the library, it does not use the native Win32 controls. I just used WPF as a rare GUI example where the controls can be rotated, but they are not the native Win32 controls wxWidgets uses.