|
Just set the font size as mentioned below with m_Font as member.
Doing so will increase the height of the combo box according to the font size and font type
To increase the width, you can SetWindowPos or MoveWindow functions .
CDC *pDC = GetDC();
LOGFONT lFont;
memset(&lFont, 0, sizeof(lFont));
lFont.lfHeight = 34;
lFont.lfWeight = FW_NORMAL;
lFont.lfOutPrecision = OUT_TT_ONLY_PRECIS;
strcpy( lFont.lfFaceName, _T("Lucida Sans Unicode"));
m_Font.CreateFontIndirect(&lFont);
m_pComBo->SetFont(&m_Font);
Величие не Бога может быть недооценена.
modified on Thursday, October 29, 2009 4:15 AM
|
|
|
|
|
You may send the WM_SETFONT message to the the combo's edit box (that is another window), i.e.:
- call
GetComboBoxInfo [^] to obtain the handle of the edit box ( hwndItem member of the COMBOBOXINFO struct ). - Send the
WM_SETFONT message using the found handle.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I tried using the below code..
COMBOBOXINFO cbi;
cbi.cbSize = sizeof(COMBOBOXINFO);
m_ComboBox.GetComboBoxInfo(&cbi);
::SendMessage(cbi.hwndItem,WM_SETFONT,(WPARAM)pFont->m_hObject,TRUE);
::SendMessage(cbi.hwndCombo,WM_SETFONT,(WPARAM)pFont->m_hObject,TRUE);
::SendMessage(cbi.hwndList,WM_SETFONT,(WPARAM)pFont->m_hObject,TRUE);
Where pFont is a CFont* in which im having the bigger font..
All are changed except the Font in the selected item in the combobox..
The font in the selected item of Combobox is also changed but when i click on the combobox the font of the selected item is changing to older font ie small font...
Please help me regarding the same..
|
|
|
|
|
can u make CFont* pFont to be member of the class.
Величие не Бога может быть недооценена.
|
|
|
|
|
still the it"s giving the same problem...
the font of the selecteditem in the combobox changing to olderfont when clicking on the combobox
|
|
|
|
|
When i changed the property of combobox from CBS_DROPDOWNLIST to CBS_DROPDOWN while creating combobox dynamically....but the CBS_DROPDOWN gives editablecombo which is not accepted in my case..
|
|
|
|
|
The other thing I would recommend you look at is MapDialogRect[^], so you can use dialog box units, just like you would if you're doing a resource driven layout, and get them transformed to pixels like CreateWindow uses.
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Hi All,
Can anybody tell me how to retreive IP address of a server pc from client pc.
Regards,
Abinash
|
|
|
|
|
Just refer [^]
Величие не Бога может быть недооценена.
|
|
|
|
|
Hi
How to print content of a txt file using VC++.
Thanks in advance
|
|
|
|
|
|
Hi can anybody give a sample for WritePrinter function , i am confused about getting handle to the printer ,which is obtained by using OpenPrinter function.
OpenPrinter("Printer_Name" ,&pHandle ,NULL )
From the above code ,I am confused about getting printer name, 'cos
suppose I am using more than one printers ,it is not possible to hardcode the printer name.How to get selected printer name?
thanks 
|
|
|
|
|
Use GetDefaultPrinter() to get the name of the default printer. If you want the user to select a different printer, use PrintDlg() .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Thanks 
|
|
|
|
|
The steps:
1. StartDocPrinter
2. StartPagePrinter
3. WritePrinter
4. EndPagePrinter
5. repeat 2, 3, 4 for as many pages as necessary
6. EndDocPrinter
When you are trying to print a text file directly to a printer, there will be no format information such as font, color, etc sent to the printer. The printer will use its default font to print the text file in its natural text flow. The result is not pretty.
|
|
|
|
|
Hi
How to format data before printing ?
thanks
|
|
|
|
|
To format text you have to print it in graphics mode. Get the printer DC and output to that DC. That way you can choose your font, size, etc. and arrange text to appropriate locations.
|
|
|
|
|
One way would be to use ShellExecute(hWnd, "name of txt file", "print", ...) .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
thanks 
|
|
|
|
|
Hi All,
Is there any spl reason to use CSingleLock and CDoubleLock objects and give the reference of a sync objects , whereas we can directly lock the resource by using CCriticalSection Lock and UnLock methods...
Please clarify me on this ..............
Thanks,
Hari
|
|
|
|
|
Hi all,
My code is like this:
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
fstream f;
char strMsg[512];
char buf[512];
while(1)
{
f.open("c:\\1.txt", ios::in|ios::out|ios::app );
if(f.is_open())
{
int i=0;
char s[512];
memcpy(s,"hello",512);
i = strlen(s);
f<<s<<std::endl;
f.seekg(0, ios::beg);
while(f.getline(strMsg, 512))
{
int i=0;
char s[512] = "";
memcpy(s,"hello",512);
i = strlen(s);
f <<s <<std::endl;
}
f.close();
}
}
}
starting, the file database.txt is empty.
The first "f<
|
|
|
|
|
Hi.
Some comments:
1.) I see an infinite while loop without any conditional breakage. Why do you need this?
2.) You are calling strlen on a char array without a NULL terminator. You should probably use strcpy instead of memcpy.
xbottle wrote: but the second "f<<s<<std::endl" can="" not="" write="" database="" to="" the="" 1.txt="" file.<="" blockquote="">
Your second while loop will never be true on the second pass because you are at the end of the file after you write to the file. However if you fix this it will cause an infinite loop. I would suggest that you redesign your logic flow.
Update your code and come back for a second analysis.
Best Wishes,
-David Delaune
modified on Thursday, October 29, 2009 1:16 AM
|
|
|
|
|
thanks for your answer.
1.)This is a part of my code.In my code ,it’s a thread code.So I use an infinite while loop.
2.)you let me use strcpy instead of memcpy ,I have used strcpy instead of memcpy.But I think it’s not the reason that I can’t write the file.
3.) My second while loop is really true on the second pass.
I’m not sure the reason. Before my second while loop, “f.seekg(0, ios::beg)”seek the begin of the file,maybe that’s why I’m not at the end of the file after I write to the file.
|
|
|
|
|
xbottle wrote: 1.)This is a part of my code.In my code ,it’s a thread code.So I use an infinite while loop.
Ok, but how do you plan to end the thread?
xbottle wrote: 2.)you let me use strcpy instead of memcpy ,I have used strcpy instead of memcpy.But I think it’s not the reason that I can’t write the file.
It could cause the application to crash. Always NULL terminate your char arrays before calling CRT functions such as strlen.
xbottle wrote: 3.) My second while loop is really true on the second pass.
I’m not sure the reason. Before my second while loop, “f.seekg(0, ios::beg)”seek the begin of the file,maybe that’s why I’m not at the end of the file after I write to the file.
Ok, I understand you now. The EOF bit has probably been set. Add this at the bottom of your second while loop:
if(f.eof())
f.clear();
Best Wishes,
-David Delaune
|
|
|
|
|
thx.
I probably found the reason.
<br />
#include <iostream><br />
#include <fstream><br />
using namespace std;<br />
int main()<br />
{ <br />
fstream f; <br />
char strMsg[512];<br />
char buf[512];<br />
while(1)<br />
{<br />
f.open("c:\\1.txt", ios::in|ios::out|ios::app );<br />
if(f.is_open()) <br />
{ <br />
int i=0; <br />
char s[512]; <br />
memcpy(s,"hello",512); <br />
i = strlen(s); <br />
f.seekp( 0, ios_base::end );<br />
f<<s<<std::endl; <br />
f.seekg(0, ios::beg); <br />
while(f.getline(strMsg, 512)) <br />
{ <br />
int i=0; <br />
char s[512] = ""; <br />
memcpy(s,"hello",512); <br />
i = strlen(s); <br />
f.seekp( 0, ios_base::end );<br />
f <<s <<std::endl; <br />
} <br />
f.close(); <br />
} <br />
}<br />
}<br />
I add "f.seekp( 0, ios_base::end );" before I write the data.
The code find the end of the file,then "f <<s <<std::endl; "can write the data successful.
|
|
|
|