The form has a different style when displayed from the MMC snap-in.

I show the dialog in the MMC snap-in. When a dialog is called from the results pane, it has a Windows theme.

Screenshot of buttons when called from the result pane

However, when a dialog is called from the context menu of the context menu area, it has a different style.

Screenshot of buttons when called from context menu

Capture is written in C ++, and the dialog box is a form of C #. C ++ code calls C # code through COM.

+4
source share
1 answer

Call Application.EnableVisualStyles()allows you to create visual styles for your application. In an application, a method is usually called in the method of Mainyour application. But in this case, you can call Application.EnableVisualStyles()in the form constructor:

public Form1()
{
    InitializeComponent();
    Application.EnableVisualStyles();
}

Method Application.EnableVisualStyles

. , , . , . , EnableVisualStyles() ; , EnableVisualStyles() .

+1

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


All Articles