Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dialog Boxes, Help. Please.

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Upon reading data from database onto a readonly dialog box, fonts seems light, can someone pls help me and tell me how i can change edit boxes on a dialog box, to highlight fonts, and how i can change certain font colour in edit boxes.
Please, Please Help
 
after all i didnot have use the wizard. It was only that the function was not call upon dialog initia.
You were right i was missing ON_WM_CTLCOLOR().
Thanks, Thanks Mat.

Mat, i checked hlp in VC++ for command that i can use with this program to "BOLD" the font i have but didnt find a CDC function. Can you pls shed some light on this if possible.

Thanks again.
 
1. Add CFont m_font; in your dlg class;

2. put the following code in OnInitDialog()

LOGFONT lf; // Used to create the CFont.
memset(&lf, 0, sizeof(LOGFONT)); // Clear out structure.
lf.lfHeight = 50; // Request a 50-pixel-high font
lf.lfWidth = 40;
lf.lfWeight = FW_BOLD ; // Bold
lf.lfItalic = 1; // Italic
strcpy(lf.lfFaceName, "Arial"); // with face name "Arial".
m_font.CreateFontIndirect(&lf); // Create the font.

// Use the font to paint a control. This code assumes
// a control named IDC_TEXT1 in the dialog box.
GetDlgItem(IDC_EDIT1)->SetFont(&m_font);
 
Mat, it seems to be working but i cannot see what i am typing ot whats been printed in the edit box, tried highlighting the edit box but would not let me.
I am using color function as above, could this have any effect on, OR am i missing sothing to up the edit box.
Without the bold statement the text in the edit box is visble.

Help, some light pls.
thanks
 
I think it's working. But the edit box is too small for you to see the text. try to reduce the font size or enlarge the box.
 
I tried with Font size 8 and no width, it looks like it is default to background color, upon highlighting i can see black cursor flashing but no text..
t have truned off color function and stll cannot even see what i am typing.
Its typing but not visiable.


 
I tried with Font size 8 and no width, it looks like it is default to background color, upon highlighting i can see black cursor flashing but no text..
t have truned off color function and stll cannot even see what i am typing.
Its typing, but not visiable.


 
please check if you clear the lf structure properly.

or try this,

LOGFONT LogFont;
GetFont()->GetLogFont(&LogFont);
LogFont.lfHeight = 48;
LogFont.lfWeight = FW_BOLD;
m_font.CreateFontIndirect(&LogFont);
GetDlgItem(IDC_EDIT1)->SetFont(&m_font);

remember you have to define m_font as a member of your dialog.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top