home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / os / mswindo / programm / misc / 1605 < prev    next >
Encoding:
Text File  |  1992-08-31  |  2.4 KB  |  70 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!wupost!darwin.sura.net!haven.umd.edu!wam.umd.edu!castanos
  3. From: castanos@wam.umd.edu (Jose Alberto Castanos)
  4. Subject: Re: Bold fonts only in Dialog boxes??
  5. Message-ID: <1992Sep1.001406.3485@wam.umd.edu>
  6. Sender: usenet@wam.umd.edu (USENET News system)
  7. Nntp-Posting-Host: rac2.wam.umd.edu
  8. Organization: University of Maryland, College Park
  9. References: <1992Aug27.090853.1@cortex>
  10. Date: Tue, 1 Sep 1992 00:14:06 GMT
  11. Lines: 57
  12.  
  13. In article <1992Aug27.090853.1@cortex> mboucher@cortex.prospect.com (Mike Boucher) writes:
  14. >Hey there,
  15. >
  16. >I'm using MS C 7.0 and SDK to create dialog box resources.  I include the line
  17. >
  18. >FONT 9, "Courier"
  19. >
  20. >So that I have a fixed width font.  What I get is Courier BOLD in the dialog.
  21. >I can only get "plain" courier in my Word Processor.  If I change the font to
  22. >something like Arial, I still get BOLD!!
  23. >
  24. >What can I do to get a "plain", fixed-width, MS supplied font?
  25. >
  26.  
  27.  
  28. The following example from the SDK does the trick, but you have to change the
  29. font of each control in the dialog box.  Is there a way to get a normal weight
  30. font using the FONT statement?
  31.  
  32.  
  33. From the SDK documentation:
  34. --------------------------
  35.  
  36. This example changes the font used by controls in a dialog box to a font
  37. that is not bold. 
  38.  
  39. HFONT hfontDlg;
  40. LOGFONT lFont;
  41.  
  42. case WM_INITDIALOG:
  43.  
  44.     /* Get dialog box font and create version that is not bold. */
  45.  
  46.     hfontDlg = (HFONT) NULL;
  47.     if ((hfontDlg = (HFONT) SendMessage(hdlg, WM_GETFONT, 0, 0L))) {
  48.         if (GetObject(hfontDlg, sizeof(LOGFONT), (LPSTR) &lFont)) {
  49.             lFont.lfWeight = FW_NORMAL;
  50.             if (hfontDlg = CreateFontIndirect((LPLOGFONT) &lFont)) {
  51.                 SendDlgItemMessage(hdlg, ID_CTRL1, WM_SETFONT,
  52.  
  53.                     (WPARAM) hfontDlg, 0);
  54.                 SendDlgItemMessage(hdlg, ID_CTRL2, WM_SETFONT,
  55.                     (WPARAM) hfontDlg, 0);
  56.                 .
  57.                 . /* Set font for remaining controls. */
  58.                 .
  59.             }
  60.         }
  61.     }
  62.     return TRUE;
  63.  
  64.  
  65. -------------------------------------------------------------------------------
  66. Jose A. Castanos       | Computer Science Dept. |"If a person never contradicts
  67. (castanos@wam.umd.edu) | University of Maryland | himself, it must be that he 
  68.                        | College Park, MD       | says nothing." -M. de Unamuno
  69. -------------------------------------------------------------------------------
  70.