CEdit & CDialog
-
Hi all, how can i resize my CEdit, (with GetRect & MoveWindow) automatically, when the Main CDialog will be resized?????? On the Main CDialog i want to scale the CEdit to 0,0 cause i dont want a thick border =p ___ How can i manage this?? Please help me!! Thanx and bye b4ckup :confused:
-
Hi all, how can i resize my CEdit, (with GetRect & MoveWindow) automatically, when the Main CDialog will be resized?????? On the Main CDialog i want to scale the CEdit to 0,0 cause i dont want a thick border =p ___ How can i manage this?? Please help me!! Thanx and bye b4ckup :confused:
Maybe I could help, but I can't clearly understand your need? :) Post some code lines here! "Socrates is a man. All men are mortal. Therefore Socrates is mortal." -- Aristotle (syllogism) Cheers Masoud SamimiGo!
-
Maybe I could help, but I can't clearly understand your need? :) Post some code lines here! "Socrates is a man. All men are mortal. Therefore Socrates is mortal." -- Aristotle (syllogism) Cheers Masoud SamimiGo!
aehm ;) k .. I have a little dialog based prog with an edit control in there. the edit control should turn up on the upper left @ x = 0 and y = 0, without a border =p _____ ok???? and: when i resize the dialog, the edit control should also resize. here´s what i think (i know that dont works): BOOL CMp3insDlg::OnInitDialog() { CDialog::OnInitDialog(); CRect rect; CEdit* ce = (CEdit*)GetDlgItem(IDC_EDIT); ce->GetWindowRect(&rect); ce->MoveWindow(&rect); return TRUE; } when i throw the code into: void CMp3insDlg::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); } my programm crashes!! yeah, i know i´m stupid, please help me ;) (if you wish i can send you an email with a screenshot from an other programm, where you can see what i mean) thanX
-
aehm ;) k .. I have a little dialog based prog with an edit control in there. the edit control should turn up on the upper left @ x = 0 and y = 0, without a border =p _____ ok???? and: when i resize the dialog, the edit control should also resize. here´s what i think (i know that dont works): BOOL CMp3insDlg::OnInitDialog() { CDialog::OnInitDialog(); CRect rect; CEdit* ce = (CEdit*)GetDlgItem(IDC_EDIT); ce->GetWindowRect(&rect); ce->MoveWindow(&rect); return TRUE; } when i throw the code into: void CMp3insDlg::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); } my programm crashes!! yeah, i know i´m stupid, please help me ;) (if you wish i can send you an email with a screenshot from an other programm, where you can see what i mean) thanX
Hi! :) I tried this last night and it worked:
void CSizeEditDlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);CEdit\* ce = (CEdit\*)GetDlgItem(IDC\_EDIT1); ::MoveWindow(ce->GetSafeHwnd(), 50 , 50, 200, 65 ,TRUE); // However, you must get the size of your dlg rect and do some calcs // to move the window according to the sizing value of dlg! // Just some extra test/show how you can get/use the m\_Hwnd to be safe! :) ::SetWindowText(ce->GetSafeHwnd(),"Hi There! I am being resized! :-)");
}
The above works fine, but better yet I suggest you use the CResizableDialog by Paolo Messina here on CP! Its here: http://www.codeproject.com/dialog/resizabledialog.asp It is realy Nice! :-D Good Luck! "Socrates is a man. All men are mortal. Therefore Socrates is mortal." -- Aristotle (syllogism) Cheers Masoud Samimi Go!
-
Hi! :) I tried this last night and it worked:
void CSizeEditDlg::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);CEdit\* ce = (CEdit\*)GetDlgItem(IDC\_EDIT1); ::MoveWindow(ce->GetSafeHwnd(), 50 , 50, 200, 65 ,TRUE); // However, you must get the size of your dlg rect and do some calcs // to move the window according to the sizing value of dlg! // Just some extra test/show how you can get/use the m\_Hwnd to be safe! :) ::SetWindowText(ce->GetSafeHwnd(),"Hi There! I am being resized! :-)");
}
The above works fine, but better yet I suggest you use the CResizableDialog by Paolo Messina here on CP! Its here: http://www.codeproject.com/dialog/resizabledialog.asp It is realy Nice! :-D Good Luck! "Socrates is a man. All men are mortal. Therefore Socrates is mortal." -- Aristotle (syllogism) Cheers Masoud Samimi Go!
hey! Many thanx .. the CResizableDialog works very fine ;p that´s what i want!! .. and thanx for your fast help!! ------------------------------------------------------------------------------- ok here´s how i made it: void CMyDlg::OnSize(UINT nType, int cx, int cy) { CResizableDialog::OnSize(nType, cx, cy); CRect rect; CEdit* ce = (CEdit*)GetDlgItem(IDC_EDIT); ce->GetWindowRect(&rect); ::MoveWindow(ce->GetSafeHwnd(), 0, 0, rect.right, rect.bottom, TRUE); //hehe rect.right and rect.bottom .. that´s all ;) } bye b4ckup (:
-
hey! Many thanx .. the CResizableDialog works very fine ;p that´s what i want!! .. and thanx for your fast help!! ------------------------------------------------------------------------------- ok here´s how i made it: void CMyDlg::OnSize(UINT nType, int cx, int cy) { CResizableDialog::OnSize(nType, cx, cy); CRect rect; CEdit* ce = (CEdit*)GetDlgItem(IDC_EDIT); ce->GetWindowRect(&rect); ::MoveWindow(ce->GetSafeHwnd(), 0, 0, rect.right, rect.bottom, TRUE); //hehe rect.right and rect.bottom .. that´s all ;) } bye b4ckup (:
Thankx to you as well! My pleasure! ;-D Programming is fun! Especially when things work! Enjoy! :-D "Socrates is a man. All men are mortal. Therefore Socrates is mortal." -- Aristotle (syllogism) Cheers Masoud Samimi Go!