Solved

urgent help! how to change font ?

Posted on 2000-03-06
11
193 Views
Last Modified: 2013-12-03
Hi,

i write some words on a button, now i wantt o change their font... how to do that? since i am new to VC++ and now not much time left for my project, could u pls provide some detailed help? thanks a  lot!
0
Comment
Question by:greenbird
  • 6
  • 4
11 Comments
 
LVL 3

Expert Comment

by:akalmani
Comment Utility
Hi GreenBird !!
 IF u are having owner draw button  then set the font in the OnDrawItem() for the device context.
If u are not having owner draw buttons then get the pointer to CButton by
CButton *pButton = (CButton *)GetDlgItem(IDC_BUTTON);
CFont Font();//create the font object according to u r need using create
pButton->SetFont(Font,TRUE);
The third method is to have u r button class derived from CButton and set the font in OnCreate() of it.
0
 
LVL 3

Accepted Solution

by:
V_Bapat earned 10 total points
Comment Utility
In DrawItem() do this:

CDC dc;
dc.Attach(lpDrawItemStruct->hDC);
CFont myFont;
myFont.CreateFont(20, 0, 0, 0, FW_NORMAL, 0, 0, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, "Impact");
dc.SelectObject(&myFont);

This will display text in 'Impact' font. You can change parameters in CreateFont() to suit your needs.

All the best.

Vicky
0
 

Author Comment

by:greenbird
Comment Utility
Hi,

thanks... but just now i found that it is a static control, not a button... sorry.... Vicky, in ur code, where is the id or name of the button/static text control?

thanks a lot!
0
 
LVL 3

Expert Comment

by:V_Bapat
Comment Utility
Why do you need that?
0
 

Author Comment

by:greenbird
Comment Utility
Hi,

actually i have a program , on the main window i will display the title of my program " Diabetic Eye Disease Analysis System". i dunno how to make it nice, i just use a static text control to display it (with backgrounds).... and i need to make the font  bigger.... that is why i use it...

sigh that my interface is quite "ugly" :)

so how to do it?
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Author Comment

by:greenbird
Comment Utility
Hi,

actually i have a program , on the main window i will display the title of my program " Diabetic Eye Disease Analysis System". i dunno how to make it nice, i just use a static text control to display it (with backgrounds).... and i need to make the font  bigger.... that is why i use it...

sigh that my interface is quite "ugly" :)

so how to do it?

Vicky, sorry for another request, if u have time, are u able to make a nice title (maybe displayed in static text control or button or whatever....only for display purpose) for me? if u are busy, ignore it, it is ok... thanks a lot!
0
 

Author Comment

by:greenbird
Comment Utility
hi, Vicky

my project presentation is on this coming thursday. i had gained much much help from EE. without ur help, i can not finish my project... really appreciate the great help u had given...
(however i hered that my evaluators are famous killers, hope they will not put me in a hard position. god bless me.)

have a nice day!
0
 
LVL 3

Expert Comment

by:V_Bapat
Comment Utility
What do you mean by "on the main window i will display the title of my program"? Do you mean you have to show the title only once or it should be displayed in the background?

Since you don't have much time, You would have to explain the things in detail. Put as much info as possible for me to understand the things properly.

All the best.

Vicky
0
 

Author Comment

by:greenbird
Comment Utility
Hi, Vicky,

i have anotehr qn now:

ok. have u ever used the JPeg.cpp ? ( i think in MSDN? anyway i got it from otehrs). i use it to load an iamge file as background... however the problem is that the image is not displayed properly(such as if u use an image for ur web background, it is displayed as what it is like, but in my program, the pixel is stretched... therefore the screen is not nice..)
do u know how to solve it? i can post the code later...

the above is not relevant to the previous qn yet :) i can change the font now, so ignore the fone qn now.

so vicky now my problem is that could u pls help me find the problem when loading the background image? i f u need the code, i can email it to u.

thanks a lot!
0
 
LVL 3

Expert Comment

by:V_Bapat
Comment Utility
You can mail me the code. My email id is vicky@miel.mot.com.
0
 

Author Comment

by:greenbird
Comment Utility
Hi, Vicky,

i do not have time now. i just let it be bah... have to pratice for presentation now... anyway thanks a lot! really thanks for ur great help!

bye...
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now