Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Dialog Boxes

marshallc
Beginner
1,481 Views
I know this is going to probably sound like a really stupid question, but is there a way to change the colors on the dialog boxes, buttons, fontsin Intel Visual Fortran? I'm using the .NET interface, and I do not see a way to change the colors in the dialog boxes or even the fonts. I know that in Visual Basic.NET and Visual C++ there is a way to do this. Is this functionality unavailable in IVF?
0 Kudos
6 Replies
anthonyrichards
New Contributor III
1,481 Views
IIRC, It was not available in Compaq Visual Fortran (which I have) and so is probably not available in IVF. I found I could change static text background, edit/list box background colours, but dialog and button colours are fixed by the system andcould not be changed from their default colours by an application. AFIK, you can only change the colour of ALL '3-D' objects (dialogs, window frames, buttons etc.)to the same colour using Start...Settings...Control Panel...Display...Appearance interactively.
0 Kudos
Steven_L_Intel1
Employee
1,481 Views
How do you change this in MSVC? Typically, dialog box colors and fonts are specified by the user, as Anthony suggests.
0 Kudos
marshallc
Beginner
1,481 Views
Oops... I guess Visual C++ doesn't have it, but Visual Basic definitely does. I just thought it weird that you aren't allowed to make that kind of a property change. Why wouldn't you include something like that in other languages? It adds to the flexibility of the language or IDE, right? Or is the a bigger picture I'm not seeing? Would there be a disadvantage to allowing that kind of modification to a dialog box or other visual interface?
0 Kudos
Steven_L_Intel1
Employee
1,481 Views
I have a hard time believing it is a language issue. The Win32 API is the Win32 API. Perhaps there is some extended resource setting, but the resource editor you use with Fortran is the MS editor. Perhaps they added something special for VB?
0 Kudos
Jugoslav_Dujic
Valued Contributor II
1,481 Views
marshallc,
You can't set the colors in design-time (in resource editor). If VB can do it, that's because it has its own dialog box/form window class. Dialog and control colors are implemented in a clumsy way in windows API -- for most controls, there's no (equivalent of) WM_SETCOLOR/WM_SETBKCOLOR. Instead, the colors should be adjusted by handling WM_CTLCOLOR* messages and setting the colors by selecting brush on given DC. If you're not careful, you can easily get a GDI resource leak.

I developed a custom solution long time ago by tweaking DFLOGM module and calling it XFLOGM. Later, that solution became a part of my Xeffort library, but written from scratch.

See here as the starting point.

Jugoslav
0 Kudos
anthonyrichards
New Contributor III
1,481 Views

See these links about changing system parameters, such as dialog box background, button colours. You need to use GetSysColor and SetSysColor API functions. Remember, they are system colors, so the colors will change inALL the objects of a given type that you modify, not just those connected with your application.

Otherwise, Jugoslav describes the way to go where you have to be able to intercept thewindows messageto draw a control, from the control ID get a handle to its window, get its device context (DC), change the brush to the colour you want , release the DC and pass on the message to draw the control to the default window procedure. I think all this requires sub-classing each control in each dialogfor whichyou want to choose the color,(during processing of the WM_CREATE message for the dialog) which means inserting your own procedure into the windows message loop for a dialog window using SetWindowLong, doing the above and then passing the message on to the default windows procedure.


http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/systemparametersinfo.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/getsyscolor.asp

Message Edited by anthonyrichards on 11-09-2005 01:31 AM

0 Kudos
Reply