Solved

urgent help! how to change font ?

Posted on 2000-03-06
11
195 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
ID: 2590034
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
ID: 2590437
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
ID: 2590489
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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 3

Expert Comment

by:V_Bapat
ID: 2590502
Why do you need that?
0
 

Author Comment

by:greenbird
ID: 2590512
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
 

Author Comment

by:greenbird
ID: 2590515
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
ID: 2590522
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
ID: 2590578
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
ID: 2590609
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
ID: 2592052
You can mail me the code. My email id is vicky@miel.mot.com.
0
 

Author Comment

by:greenbird
ID: 2594024
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
font missing in acrobat 3 75
format the code in java 6 93
matchUp  challenge 6 60
Work with App store 7 51
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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…

776 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