Real color buttons in VC ++!

zhaozj2021-02-16  31

Realize the true color button:

Use the MFC infrastructure control:

First, insert the picture to the resource: If the ID is (idb_bmp), you can insert 256 colors, 16-bit color or higher colored pictures.

Second, add a variable to the button, type: cBitmapButton (need to manually change)

Third, add the following code in the initializer:

((CbitmapButton *) getdlgitem (ID)) -> loadbitmaps (button is displayed when the button is available,

The button is used to press the ID of the button,

The ID of the image is displayed when the button is not available.

The button is pressed when the button is not available;

((CbitmapButton *) getdlgitem (button ID)) -> Invalidate (TRUE); (cBitmapButton *) getdlgitem (button ID)) -> sizetocontent ();

Fourth, the properties of the Set button -> Styles-> Owner Draw is open.

Use the ActiveX control:

First, right click on the window to select INSERT ACTIVEX Control, select the Microsoft Forms 2.0 Image Control 3 in the ActiveX Control List, click OK, right-click in the inserted control to modify its properties (style, Pictures, mouse styles, etc.) Four, you can add a message function as the Button control, and the message is more abundant. Chengdu Bozhong Network Company Gan Yu OICQ: 6048010

转载请注明原文地址:https://www.9cbs.com/read-22040.html

New Post(0)