Dialog - CEdit-Größe verändern von Dialog-Größe abhängig
- 
					
					
					
					
 Eine dumme Frage: wie bringe ich CEdit dazu seine Größe zu verändern, wenn ich Dialog-Größe ändere. 
 mit dem hier:void CMyDlg::OnSize(UINT nType, int cx, int cy) { CRect rect; CDialog::OnSize(nType, cx, cy); GetClientRect(rect);//und auch GetWindowRect und SetWindowPos m_ctlEdit.MoveWindow(0,rect.bottom-rect.top-(rect.bottom-rect.top)/10,rect.right-rect.left,(rect.bottom-rect.top)/10); }kann ich die Anwendung nicht mal starten, bekomme sofort ne Fehlermeldung. 
 Das hier läuft, aber irgendwie nicht richtig:void CMyDlg::OnSize(UINT nType, int cx, int cy) { CDialog::OnPaint(); CDialog::OnSize(nType, cx, cy); } void CMyDlg::OnPaint() { ... CRect rect; GetWindowRect(rect);//mit GetClientRect und SetWindowPos geht auch m_ctlEdit.MoveWindow(0,rect.bottom-rect.top-(rect.bottom-rect.top)/10,rect.right-rect.left,(rect.bottom-rect.top)/10);Bei codeguru und FAQ war ich schon, ich werde langsam wannsinnig... 
 
- 
					
					
					
					
 die erste version funktioniert. das problem ist nur, dass OnSize aufgerufen wird, bevor das fenster erstellt ist. 
 Ich würde das mit GetSafeHwnd überprüfen:void CMyDlg::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); if(!GetSafeHwnd()) return; CRect rect; GetClientRect(rect);//und auch GetWindowRect und SetWindowPos m_ctlEdit.MoveWindow(0,rect.bottom-rect.top-(rect.bottom-rect.top)/10,rect.right-rect.left,(rect.bottom-rect.top)/10); }
 
- 
					
					
					
					
 Oder http://www.akinstaller.de/ Dort gibt es für diese Sachen eine klasse und eine Lib 
 
- 
					
					
					
					
 das fenster wird sehr wohl erstellt, aber Edit selbst nicht. 
 Das läuft jetzt:void CMyDlg::OnSize(UINT nType, int cx, int cy) { CDialog::OnPaint(); CDialog::OnSize(nType, cx, cy); CEdit * ped=(CEdit *) GetDlgItem(IDC_EDIT1); if(!ped) return; CRect rect; GetClientRect(rect);//und auch GetWindowRect und SetWindowPos m_ctlEdit.MoveWindow(0,rect.bottom-rect.top-(rect.bottom-rect.top)/10,rect.right-rect.left,(rect.bottom-rect.top)/10); } void CMyDlg::OnPaint() { ... CRect rect; GetWindowRect(rect);//mit GetClientRect und SetWindowPos geht auch m_ctlEdit.MoveWindow(0,rect.bottom-rect.top-(rect.bottom-rect.top)/10,rect.right-rect.left,(rect.bottom-rect.top)/10);Das Problem ist nur meim Starten wird Edit nicht auf richtige Größe gesetzt. Erst nach min/max. Deswegen habe ich auch OnPaint() verwendet 
 Vielleicht gibts eine schönere Lösung..
 (Danke für den Anstoß)
 
- 
					
					
					
					
 http://www.akinstaller.de/ habe ich angeguckt, aber es ist gar nicht schlecht wenn man selber weiß wie es geht 
 
- 
					
					
					
					
 Da hast du recht images/smiles/icon_wink.gif