Signature text active color - change detection (in .Net)

In Vista with Aero turned on, the window title in the normal mode has text in black (written over a slightly light glass), and with the maximum title, white (written over a dark glass).

How to determine the current color of the window name?

PS I wrote a program for viewing after SystemColors.ActiveCaptionTextColor, but it remains unchanged in two modes.

0
source share
4 answers

The color of the system does not actually change. What you see is an Aero theme application to the window. There are thematic APIs available to get specific colors for the theme, but my experience was less stellar using them.

UPDATE FROM COMMENTS: Take a look at the VisualStyleRenderer and the GetColor method.

+1
source

I can't get VisualStyleRenderer to tell me anything.

You can choose between:

Because MaxCaption provides VisualStyleElement objects for each state of the window title bar maximum .

, . :

VisualStyleRenderer renderer = 
   new VisualStyleRenderer(VisualStyleElement.Window.MaxCaption.Active);
Color c = renderer.GetColor(ColorProperty.TextColor);

, Caption MaxCaption.

, :

alt text http://i41.tinypic.com/3994h.jpg

, , .

+1

SystemColorsChanged ?

    SystemColorsChanged += new EventHandler(Form1_SystemColorsChanged);

    void Form1_SystemColorsChanged(object sender, EventArgs e)
    {
        //try repainting or refreshing your application
    }

, , .

0

VisualStyleRenderer, , , -, Vista DWM (Desktop Window Manager) , . () .

Aero , TextColor , , DWM.

, Vista VisualStyleElement.Window.Caption.Active , SystemColors.ActiveCaptionTextColor ; , , .

So, is it possible that DWM applies an internal standard when rendering maximum window titles? If this were so, you would not be able to detect a change in the color of the title text "by design", rather, you would have to resort to observing the maximum state of the window as such and apply the default DWM.

0
source

Source: https://habr.com/ru/post/1711590/


All Articles