en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en nl en en en en de fr en en en en nl en en en en en en fr en en fr pt en en en en en en en nl en en en en en es en en en en fr en en en en nl en en en en en en fr en en fr pt en en en en en en en nl en en en en en en en en en en en nl en en en en en en en en en en en en en en en en en en en nl vi en fr en en zh fr en en en en en en es en en en en en en en nl en en en en en en en sv en en sv en en en en en en en nl fr en en en en en en en en en en nl en en en en en en en en en en en nl en en en en en en fr en en en en nl en en en en en en en en en en en fr en en fr pt en en en en en en en nl en en en en en en en en de en en en fr en en en en en en en en en pt en en en en en en
By logging into your account, you agree to our Privacy Policy, personal data processing and storage practices as described therein.
Forgot password or user name?
Search in titles only Search in PowerBASIC for Windows only
You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
All Time Today Last Week Last Month
All Discussions only Photos only Videos only Links only Polls only Events only
How can I use WM_CTLCOLORSTATIC to change background color of radio buttons? Please give me example code. Jeffrey.
Jeffrey, there have been a loty of examples for this posted on the BBS - try searching for 'ctlcolorstatic' and you should find a *lot* of examples.
Also, take a look at the SMTP.BAS example shipped with PB/DLL 6. There is an update for this file available from http://www.powerbasic.com/files/pub/pbwin/inet/smtp.zip
If you have not done so, download and install WIN32.HLP - this helpfile gives your the details of how this message (WM_CTLCOLORSTATIC) works. You can find the help file (it's an 8mb download) at http://www.powerbasic.com/files/pub/mstools/win32.zip
Join Date: Apr 2005
30 Apr 2000, 04:29 AM
Lance, I took a look at the SMTP.BAS example, took some code from it, put it in my subway stop program, edited it, and almost got it working but I think that the default font for controls is variable-width font, not fixed-width font. Here is part of the code:
callback function form1proc select case cbmsg case %wm_ctlcolorstatic settextcolor cbwparam,%black setbkcolor cbwparam,%white function=getstockobject(%null_brush) end select end function
[This message has been edited by Jeffrey Morris (edited April 30, 2000).]
Join Date: Aug 1998
30 Apr 2000, 06:08 AM
The %WM_CTLCOLORxxxxx messages have nothing to do with the actual font the controls use... To change the font you have to create a font and send a %WM_SETFONT message to each control that will need the font (usually you would create the font during %WM_INITDIALOG) - this makes it a one-time operation.
You also need to delete the font handle during %WM_DESTROY or you will cause a memory leak. Obviously this will require a STATIC or a GLOBAL variable to hold the font handle.
Jeffrey, you really need to get yourself an Windows programming book - all of these User Interface topics are well covered in such books. Take a look at the list of recommended titles in the FAQ forum.
Join Date: Apr 2005
30 Apr 2000, 08:22 AM
Lance, I have "Programming Windows Fifth Edition", WIN32 Programming" and "Visual BASIC Programmer's Guide to the WIN32 API" books but using PowerBASIC/DLL to write programs is still harder than using MS Visual BASIC to write programs. I tried several fonts in the C:\WINDOWS\FONTS directory but the only fixed-width font is "Courier New" font. I will have to search the Internet for fixed-width fonts. Jeffrey.
Join Date: Apr 1999
1 May 2000, 02:46 AM
There is a very good monospace font at the Microsoft site.
It is called monotype.com and it is free. I believe that Andy Anderson posted the exact URL over a year ago.
using PowerBASIC/DLL to write programs is still harder than using MS Visual BASIC to write programs
You are correct, and I agree if you are talking about GUI only. You really need to take six months or more of many hours a day to master the Windows API SDK style GUI programming.
I do not have that kind of time, so I used a third party product(EZGUI) and changing colors and fonts is now a breeze.
It is a basic question: Build -or- Buy ?
In this instance I choose Buy
Join Date: Feb 1999
1 May 2000, 03:58 AM
There are other Fixed Width fonts with Win95.
Terminal (A DOS type font with graphic characters)
Join Date: Aug 1998
1 May 2000, 10:54 AM
Why not try Lucida Consol if you need a true-type font
Join Date: Apr 2005
1 May 2000, 12:18 PM
Joe, Thanks for telling me about monotype.com file on MS web site. Writing programs for Windows in any language is harder than writing programs for DOS. Jeffrey.
Join Date: Apr 2005
1 May 2000, 12:20 PM
Chris, I tried some of the fonts that came with Windows 98 SE and most of them don't look good. Jeffrey.
Join Date: Apr 2005
1 May 2000, 12:22 PM
Fred, I tried Lucida Console font but it doesn't look good when upscaled. Jeffrey.
Join Date: Aug 1998
1 May 2000, 08:23 PM
Did you try using the standard fonts, ala GetStockObject() ?
If you ask for a particular font that is not available on the current PC, then Windows will substitute another font that closely matches the specifications, but it could be a completely different font.
Getting the font you actually *want* is almost an exact science... When you use CreateFont() or CreateFontIndirect() you are *asking* Windows to create a font as close to your spec's as possible, but the font you get is left to the mercy of Windows. If you do not specify the the font parameters exactly right (esp. the charset and family flags), you may end up with a completely different and unexpected font.
For example, if you specify %ANSI_CHARSET with certain "exotic" fonts, you'll get something else - usually using %DEFAULT_CHARSET is a better approach.
Further, you should discriminate between the types of font - device/raster fonts are often synthesized by the GDI so the results are often unpredictable or visually aweful. Where possible, stick to truetype fonts.
In summary, experimenting with font selection is something you should spend a bit of time on - you may think that one particular font looks terrible but you may not be actually getting the font you expected - as I noted, this is usually because you specified incorrect or sloppy font parameters to Windows.
In other words, your results may be misleading if you do not verify the font you get is actually what you requested. To query the current font that a control is using, get a DC to the control, and use the GetFaceName() or GetTextMetrics() API's to verify the results of your %WM_SETFONT code.
Finally, if you wish to distribute your apps to other people, verify that your font selection works identically on the different versions of WIndows. CreateFont()/CreateFontIndirect() in Windows 95 often returns a completely different font to Window 2000 when using exactly the same parameters. I found this out the hard way when I was initially developing DOSPRINT and DLLPRINT.
Join Date: Apr 2005
2 May 2000, 11:15 AM
Lance, If I use GetStockObject, I may not set the size of the font. I found out that I have to use font names that are spelled as shown in the font list box in MS Word or I will get wrong font. Jeffrey.
Copyright © 1998-2022 PowerBASIC Tools, LLC - All Rights Reserved.
Powered by vBulletin® Version 5.7.0
Copyright © 2022 vBulletin Solutions, Inc. All rights reserved.
All times are GMT-5. This page was generated at 10:13 PM.
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.