Property sheets moving buttons, Why this don't works ?
Hi,
I have one property sheet wit only one button ( Ok button), and I want to move it to the right ( put it in the help button position), I have make a little test with this:
CRect rectBtn;
pOkButton->GetWindowRect(rectBtn);
rectBtn.left = rectBtn.left+5;
rectBtn.right = rectBtn.right+5;
pOkButton->MoveWindow(rectBtn);
But then when the property sheet is shown, the button is not shown !, What have I made wrong ? Is another way to do it easier ?
Thanks, Bye !
Braulio
Re: Property sheets moving buttons, Why this don't works ?
GetWindowRect returns screen coordinates.
MoveWindow expects coordinates relative to the parent window.
You are actually moving the button off the property sheet.
After calling GetWindowRect, call ScreenToClient.. like this:CRect rectBtn;
pOkButton->GetWindowRect(rectBtn);
ScreenToClient(&rectBtn);
rectBtn.left = rectBtn.left+5;
rectBtn.right = rectBtn.right+5;
pOkButton->MoveWindow(rectBtn);
Rgds,
Brian