|
Hi i m working in MFC dialog based application i want to resize the window according to screen resolution ( i m using win XP)
so that the application must be maximized
and the controls be resized accordingly on initialization
plz guide
uzmeed
|
|
|
|
|
I think you can use GetSystemMetrics() to get screen size and use SetWindoPos() API to change the size of your dialogbox.
|
|
|
|
|
HI
thanks for ur answer but the controls in the dialog box are not resizing accordingly (like edit box, buttons )
i hope i will get the solution also
uzmeed
|
|
|
|
|
I suggest you take a look at this section on CP[^]. It contains some classes that helps you positioning the controls of a window when it is resized.
|
|
|
|
|
|
uzmeed wrote:
so that the application must be maximized
Isn't this just a matter of calling ShowWindow(SW_MAXIMIZE) ?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
HI all,
I m working on SDI type application.
i have an image stip,in my application i have many dialogs and formview all are of diffrent size.
i want to use image strip as a dialog or form banner.
so i want to stretch it horizontally according to dialog or form size.
please tell me how can i do this.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
How are you drawing the image and which control are you using?
The StretchBlt function can stretch an image.
|
|
|
|
|
Currently i m using a Text control as a banner,coz i want to display the dialog name at the center of banner.
can i also this for image,or use Picture control for image.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
You can only display text in a text control.
For an image, you will need a picture control.
|
|
|
|
|
I want to use both,text in the center of banner,and image at top upper side of dialog and form.
please tell me how can i do this.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Why don't you simply place a text box in the middle and a picture control at the top of the dialog?
|
|
|
|
|
ok,now please tell me how can i stretch the image?
please if possible please explain me with example.
thanks.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Use LoadImage to load the image.
Here you can specify the width and height needed.
Associate a CStatic object to the picture control.
Now use CStatic::SetBitmap to show the bitmap.
|
|
|
|
|
everything is working fine now,only one problem is there,image not displayed at back of text control.
i m place text control in top center,and stretch the image from top-left to top-rite.
its stretch succussfully,but the back of text contol hide some portion of image please tell me now wat can i do?
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
What if you "printed" the text on the image so that they are rendered together (as one)?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
The text control has a property called Transparent .
Set this to True .
|
|
|
|
|
CDC* dc=this->GetDC();
HDC memdc;
this->GetClientRect(&rect);
CBitmap bitmap;
bitmap.LoadBitmapA(IDB_HEADER);
BITMAP bm;
bitmap.GetBitmap(&bm);
int w = bm.bmWidth;
int h = bm.bmHeight;
memdc=::CreateCompatibleDC(dc->m_hDC);
::SelectObject(memdc,bitmap);
StretchBlt(dc->m_hDC,0,0,rect.Width(),50,memdc,0,0,w,h,SRCCOPY);
CString Title="";
m_Banner.GetWindowTextA(Title);
dc->SelectObject(m_Banner.GetFont());
dc->SetBkMode(TRANSPARENT);
dc->DrawText(Title, rect, DT_CENTER | DT_WORDBREAK);
i do like this.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
PLease help me.
i m stretching the image horizontally successfully.
i m using this code in OnPaint function.
when i change the DPI from 60 to 120,than than the form display with the vertical scrollbar,and when i scroll the form the stretched image is display distorted.
please help me how can i solve this.
thanks.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Hi All
How to Print Unicode characters/Strings . I am able to print ansi characters ,but unicode it shows "???" .
My code to draw text in print DC
DrawText(
pDC->m_hDC,
(LPCTSTR)str,
str.GetLength(),
rcDataRect,
DT_WORDBREAK| DT_VCENTER | DT_LEFT
);
thanks
Bruno
|
|
|
|
|
I guess you need to select that particular font into the device context.
|
|
|
|
|
|
Hi all..
i need to know how we can display the last saved data in the listbox after closing and opening the exe again..
plz help
|
|
|
|
|
Serialize the data. If you're using MFC, see Serialization[^]
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
sonualex wrote: ...the last saved data...
Since you are saving the data, why can you not restore it? Or did I misunderstand your question?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|