0

I have a dialog that has some controls on it. The following image shows a printscreen of that dialog:

enter image description here

I succeeded in processing the WM_SIZE message for moving the OK button to have the same margins ( see the following lines of code):

RECT rc;
int buttonWidth;
int buttonHeight;

::GetWindowRect(GetDlgItem(hDlg, IDOK), &rc);
buttonWidth = rc.right - rc.left;
buttonHeight = rc.bottom - rc.top;

::GetClientRect(hDlg, &rc);

MoveWindow(GetDlgItem(hDlg, IDOK), rc.right - buttonWidth - 8, rc.bottom - buttonHeight - 8, buttonWidth, buttonHeight, TRUE);

But if the text of a label, for example the Text label is longeer than the label can contain with that dimensions, I don't know how to resize its width. For a better understanding of what I want to do, you should note that I want to obtain the same behavior as with the anchors in a C# Winforms Project.

Victor
  • 13,914
  • 19
  • 78
  • 147
  • 1
    You might get some ideas at http://stackoverflow.com/a/5739620/5987 – Mark Ransom Feb 04 '13 at 21:18
  • Thank you for your research. I understand that code, but I don't know if I can transform it to work with Win32, and if I can, I don't know how. (I am not to "old" in Visual C++ programming). – Victor Feb 05 '13 at 17:48

0 Answers0