|
|
|
![]() |
|
Strumenti |
![]() |
#1 |
Senior Member
Iscritto dal: Jul 2005
Città: San Marino
Messaggi: 309
|
[APIwin32] Dimensione 100% elemento
C'è uno stile che imposta larghezza, o altezza, di un'elemento al 100 per cento dentro al quale è contenuto (es. DialogBox)?
Un'altra domanda, posso impostare (sempre tramite resource) un elemento come finestra padre di altri elementi (ad esempio la GroupBox finestra padre di due RadioButton), in modo che poi le coordinate x e y dei figli non dipendono dalla DialogBox ma dal padre? Grazie ![]()
__________________
![]() ![]() |
![]() |
![]() |
![]() |
#2 | ||
Senior Member
Iscritto dal: Nov 2005
Città: TO
Messaggi: 5206
|
Quote:
Comunque puoi sempre farlo tu da programma. Usi la GetClientRect() per ottenere la dimensione dell'area client della dialog box e poi sposti/ridimensioni l'elemento. Quote:
__________________
Andrea, SCJP 5 (91%) - SCWCD 5 (94%) |
||
![]() |
![]() |
![]() |
#3 |
Senior Member
Iscritto dal: Jul 2005
Città: San Marino
Messaggi: 309
|
Aspettavo la tua risposta
![]() Io quindi quando dovrei utilizzare tale funzione? Come risposta ad un messaggio che mi dice che la dialog è stata creata? Grazie ancora ![]()
__________________
![]() ![]() |
![]() |
![]() |
![]() |
#4 | ||
Senior Member
Iscritto dal: Nov 2005
Città: TO
Messaggi: 5206
|
Quote:
![]() Quote:
Se poi la tua dialog box ha lo stile di resize, dovresti gestire il messaggio WM_SIZE che ti arriva quando la dialog viene ridimensionata.
__________________
Andrea, SCJP 5 (91%) - SCWCD 5 (94%) |
||
![]() |
![]() |
![]() |
#5 | |
Senior Member
Iscritto dal: Jul 2005
Città: San Marino
Messaggi: 309
|
Quote:
![]()
__________________
![]() ![]() |
|
![]() |
![]() |
![]() |
#6 | |
Senior Member
Iscritto dal: Nov 2005
Città: TO
Messaggi: 5206
|
Quote:
Codice:
BOOL GetCtlRect (HWND hWnd, INT iIdCtl, LPRECT lprc) { BOOL bRet = FALSE; RECT rc; if (GetWindowRect (GetDlgItem (hWnd, iIdCtl), &rc)) { MapWindowPoints (NULL, hWnd, (LPPOINT) &rc, 2); *lprc = rc; bRet = TRUE; } return bRet; } BOOL MoveCtl (HWND hWnd, INT iIdCtl, INT iPosX, INT iPosY) { BOOL bRet = FALSE; if (SetWindowPos (GetDlgItem (hWnd, iIdCtl), NULL, iPosX, iPosY, 0, 0, SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER)) bRet = TRUE; return bRet; } BOOL ResizeCtl (HWND hWnd, INT iIdCtl, INT iWidth, INT iHeight) { BOOL bRet = FALSE; if (SetWindowPos (GetDlgItem (hWnd, iIdCtl), NULL, 0, 0, iWidth, iHeight, SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER)) bRet = TRUE; return bRet; } Codice:
RECT rcClient, rcEdit; GetClientRect (hDlg, &rcClient); GetCtlRect (hDlg, IDC_EDIT_TESTO, &rcEdit); MoveCtl (hDlg, IDC_EDIT_TESTO, 0, rcEdit.top); ResizeCtl (hDlg, IDC_EDIT_TESTO, rcClient.right, rcEdit.bottom - rcEdit.top + 1);
__________________
Andrea, SCJP 5 (91%) - SCWCD 5 (94%) |
|
![]() |
![]() |
![]() |
#7 | |
Senior Member
Iscritto dal: Jul 2005
Città: San Marino
Messaggi: 309
|
Quote:
Grazie, poi provo a darci un'occhiata ![]()
__________________
![]() ![]() |
|
![]() |
![]() |
![]() |
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 11:29.