15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Dialog control selection colors

Paul E. Rosen -- prosen@fte.com
Tuesday, December 31, 1996

Environment: MSVC 4.2b, NT 4.0

I am using OnCtlColor() in my CFormView to change any field that has been
changed by the user to red. I can determine which fields have been changed
easily enough. And I can change the color of the text in a control easily
enough. This works fine when the control does not have the focus.

However, when the control is focused and the text in the control is selected,
the standard selection colors are used to display the control.

I realize that these colors are set in the control panel on a system wide
basis, but is there any way that I can mess with them for an individual
control?

Anyone have another suggestion for making CEdit and CComboBox controls look a
little different even when all the text in them is selected? I'm not wedded to
the idea of changing text color, but I do want to make controls that have been
changed look different than controls that have not been changed.

TIA,







Lee Thompson -- lee@mail1.nai.net
Wednesday, January 01, 1997

Hi,

Have you thought about changing the background color instead of the text
color?  Handle OnCtlColor, check pWndpassed to it, and when it is being
called for one of the edit windows you want to highlight, use
pDC->SetBkColor(RGB(whatever,whatever,ehwatever) and also return an
HBRUSH of the same color.  This way even when text is selected, the user
will still see the background color.

Lee Thompson




| Вернуться в корень Архива |