Pelles C forum

C language => Beginner questions => Topic started by: old_guy on November 16, 2012, 05:55:27 PM

Title: Complete Beginner - Looking to adapt example code
Post by: old_guy on November 16, 2012, 05:55:27 PM
Hi All,
i have found an example project called clock, which is almost perfect for something I need. 

All I want to do is increase the font size and make it bold. 

I have looked through the files but cannot see how to change these 2 properties.

I am not a C programmer but dabbled, many years ago with VB and expected to be able to find these 2 properties quite easily.  if someone could point me in the right direction i would appreciate it.

Regards
Old_Guy
Title: Re: Complete Beginner - Looking to adapt example code
Post by: CommonTater on November 16, 2012, 06:37:06 PM
If you have the source as a pelles C project...

Go into Project -> Zip Project Files and then attach the result to a message in the beginner's section so we can see what you've got.

Title: Re: Complete Beginner - Looking to adapt example code
Post by: old_guy on November 18, 2012, 09:46:53 AM
Hi,
Thanks for the reply.

I got the file from
http://www.pellesc.de/index.php?page=source&lang=en&group=3

I have attached the project file as you asked

I look forward to finding out how to solve this problem

Regards
Old_Guy
Title: Re: Complete Beginner - Looking to adapt example code
Post by: TimoVJL on November 18, 2012, 11:41:07 AM
In MainDlgProc create font for it:
Code: [Select]
...
  static HFONT hFont;
...
    case WM_INITDIALOG:
      hFont = CreateFont(18, -18, 0, 0, 700, 0, 0, 0, 0, 0, 0, 0, 0, TEXT("Arial"));
      SendMessage(GetDlgItem(hwndDlg, txt_Time), WM_SETFONT, (WPARAM)hFont, FALSE);
...
    case WM_CLOSE:
...
      DeleteObject(hFont);
...
Title: Re: Complete Beginner - Looking to adapt example code
Post by: CommonTater on November 20, 2012, 04:15:31 AM
Hi,
Thanks for the reply.

I got the file from
http://www.pellesc.de/index.php?page=source&lang=en&group=3 (http://www.pellesc.de/index.php?page=source&lang=en&group=3)

I have attached the project file as you asked

I look forward to finding out how to solve this problem

Regards
Old_Guy

Next time please follow instructions ...

Go to your menu ... Project -> Zip  Files ...  attach the resulting zip file to your message.

Also, as a beginner, you should probably read ... THIS (http://forum.pellesc.de/index.php?topic=4644.msg17797#msg17797) 
Starting off with other peoples code, in a Windows GUI program is not the way to learn C.
 
In any case, a copy of the example is attached with a nice big clock... it was simply a matter of changing the font size in the dialog box resource.