- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Anthony Richards for a very clear exposition on subclassing and colouring dialogue box controls. It has explained at last what this subclassing is all about. I have modified BackColour to make it easier to follow the steps in colouring the controls, using a function that may be called to colour a dialogue controls windows background colour, text background colour and text colour.
The function CtrlColoursCtrlColours(hdcControl, hControl, BackBrushColour, BackColour, TextColour, HideTextBack) is called from MyDlgProc with a typical call:
! BLUE brush for window background, BLUE text background, YELLOW text.
MyDlgProc = CtrlColours(wParam, lParam, RGB(0, 0, 255), RGB(0, 0, 255), RGB(255,255,0))
The first two input arguments are the last two arguments of MyDlgProc:
The three colours are the controls windows background colour, text background colour and text colour respectively. HideTextBack is a flag which if set, hides the text background colour. The last four arguments are optional.
Instead of the RGB function, I personally prefer to use colour values eg #FF00FF rather than RGB(255, 0, 255) for your PURPLE, but my favourite method is to use my library file CVFColours.f90 that contains the values of the 140 HTML colours, so that the function call above may be:
MyDlgProc = CtrlColours(wParam, lParam, BLUE, BLUE, YELLOW)
(Dont forget that HTML colours are in RGB order, but CVF colours are in BGR order, so that BLUE = #FF0000).
I attach a zip file with the modified f90 files - other files are unchanged.
Bear of Little Brain
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A single query: is 'HideTextBack' an optional argument? Otherwise it is missing from the function call.
Anyway, please continue to feel free to do what you will with the code that I posted.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
case (IDC_STATIC_SCROLLBAR)
! YELLOW brush for window background, TRANSPARENT text background.
MyDlgProc = CtrlColours(wParam, lParam, RGB(255, 255, 0), HideTextBack = .TRUE.)
I have always wanted to customise the dialogue boxes that I use, so I will be busy subclassing as so well explained by you.
Bear
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page