-
August 31st, 2021, 04:29 AM
#1
Resize the window to a button size
Hello, i want be able to resize the whole window to a first button size on that button click. And restore it's original size on next click. I hope that there are some implementations of this kind of functionality, but didn't find it yet.
Could someone share an example or describe the plan how to manage it nicely.
I thought that i should dinamicaly create all other subcontrols and remove them from the grid on button click, to be able to shrink window size to first button only.
Or maybe i can move all controls under the first button and make them invisible, so that only one that button was shown.
2021-08-31_11-32-23.jpg
-
September 8th, 2021, 03:58 PM
#2
Re: Resize the window to a button size
I have no idea how it would be implemented in WPF, however, there is a set Win32 API functions ( https://docs.microsoft.com/en-us/win...2/api/winuser/ ) that could be used to do this:
GetWindowRect
MoveWindow (or/and SetWindowPos)
ClientToScreen
ScreenToClient
Last edited by VictorN; September 8th, 2021 at 04:00 PM.
Victor Nijegorodov
-
September 9th, 2021, 05:46 AM
#3
Re: Resize the window to a button size
 Originally Posted by VictorN
I created a panel with only button, so on a click - i show that panel. resize window from the LEFT side (it is ease, Window.Width = btn.Width) and than move window positon on window.Width - btn.Width to the RIGHT.
So in fact i resize from the left size, but it looks like it is right side.
-
September 9th, 2021, 06:32 AM
#4
Re: Resize the window to a button size
 Originally Posted by Polazhenko
I created a panel with only button, so on a click - i show that panel. resize window from the LEFT side (it is ease, Window.Width = btn.Width) and than move window positon on window.Width - btn.Width to the RIGHT.
So in fact i resize from the left size, but it looks like it is right side.
Did you try it without "move window positon on window.Width - btn.Width to the RIGHT"?
Victor Nijegorodov
-
September 9th, 2021, 04:17 PM
#5
Re: Resize the window to a button size
 Originally Posted by VictorN
Did you try it without "move window positon on window.Width - btn.Width to the RIGHT"?
i have no clue, how to resize, moving left side of the window, resize button should be the first from the right side.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|