Sizing my dialog
-
Hello All I am using a dialog as my main window, and I set it to center to screen I had put that code in the this->CenterWindow(CWnd::GetDesktopWindow()); //code here to set dialog size. on the OnInitDialog and i dont know how to set width and height of the dialog without using "SetWindowPos" and i have another issue i want to resize my window and keep it in the center of screen all of that in runtime, due some user clicks. any help?
-
Hello All I am using a dialog as my main window, and I set it to center to screen I had put that code in the this->CenterWindow(CWnd::GetDesktopWindow()); //code here to set dialog size. on the OnInitDialog and i dont know how to set width and height of the dialog without using "SetWindowPos" and i have another issue i want to resize my window and keep it in the center of screen all of that in runtime, due some user clicks. any help?
A-M-S-S wrote:
and i dont know how to set width and height of the dialog without using "SetWindowPos"
Why do you dislike
SetWindowPos
?A-M-S-S wrote:
and i have another issue i want to resize my window and keep it in the center of screen all of that in runtime, due some user clicks.
Can't you handle
WM_MOVE
message?If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
A-M-S-S wrote:
and i dont know how to set width and height of the dialog without using "SetWindowPos"
Why do you dislike
SetWindowPos
?A-M-S-S wrote:
and i have another issue i want to resize my window and keep it in the center of screen all of that in runtime, due some user clicks.
Can't you handle
WM_MOVE
message?If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain ClarkeCPallini wrote:
-- Iain Clarke
I'm a sig! Fame at last! Iain.
Iain Clarke appearing in spite of being begged not to by CPallini.
-
Hello All I am using a dialog as my main window, and I set it to center to screen I had put that code in the this->CenterWindow(CWnd::GetDesktopWindow()); //code here to set dialog size. on the OnInitDialog and i dont know how to set width and height of the dialog without using "SetWindowPos" and i have another issue i want to resize my window and keep it in the center of screen all of that in runtime, due some user clicks. any help?
A-M-S-S wrote:
and i dont know how to set width and height of the dialog without using "SetWindowPos"
How about
MoveWindow()
?"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
CPallini wrote:
-- Iain Clarke
I'm a sig! Fame at last! Iain.
Iain Clarke appearing in spite of being begged not to by CPallini.
Iain Clarke wrote:
I'm a sig
Yes, you're a sig_nore_, my friend. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
Hello All I am using a dialog as my main window, and I set it to center to screen I had put that code in the this->CenterWindow(CWnd::GetDesktopWindow()); //code here to set dialog size. on the OnInitDialog and i dont know how to set width and height of the dialog without using "SetWindowPos" and i have another issue i want to resize my window and keep it in the center of screen all of that in runtime, due some user clicks. any help?
You can use of MoveWindow on the WM_SIZE event.
-
A-M-S-S wrote:
and i dont know how to set width and height of the dialog without using "SetWindowPos"
Why do you dislike
SetWindowPos
?A-M-S-S wrote:
and i have another issue i want to resize my window and keep it in the center of screen all of that in runtime, due some user clicks.
Can't you handle
WM_MOVE
message?If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain ClarkeU can Use this OnInit....
CRect Rect; GetParentFrame()->GetWindowRect(&Rect); GetParentFrame()->SetWindowPos( NULL,0,0,900 ,200 ,SWP_NOMOVE | SWP_NOZORDER); SIZE size; size.cx=Rect.Width(); size.cy=Rect.Height()/2; SetScaleToFitSize(size);
"The Ultimate Limit Is Only Your Imagination."