I have a dialog that has some controls on it. The following image shows a printscreen of that dialog:
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.