Another implementation of the irregular dialog

xiaoxiao2021-03-06  66

Another realization of irregular dialog: Code operating results is as follows: to achieve this dialog irregular application of an important Bitmap dialog class --CBitmapDialog, through flexible use, arbitrarily shaped box can be achieved. I. CBITMAPDIALOG Introduction: CBitmapDialog is derived from cdialog and encapsulates the function of forming any shape dialog according to the bitmap. The implementation of the class is also very simple, mainly some load bitmaps, setting transparent color, etc., the most critical function is MakeWindowRGN, It generates the desired area object according to the bitmap, and then calls SETWINDOWRGN to set the window to the desired shape, please refer to the code of this article for the specific code of the MakeWindowRGN function. Second, the use of the CBITMAPDialog class introduces the use of the CBITMAPDIALOG class: 1. Run VC to establish a dialog-based application Bitmapdlg. Set the properties of the dialog to remove the border and title bar. 2. Insert bitmap. (Insert -> Resources -> Choose Bitmap) 3. Add the following code to the cbitmapdialogdlg :: OnNitDialog (): OnInitDialog ():

Loadbitmap (idb_bitmap1); // Load bitmap

SetTransparent (TRUE);

SetTranscolor (RGB (0,0,0)); // Remove the color settings of the shape

SetStatictTransparent (TRUE);

SetClickAnywheremove (TRUE); / / The mouse can be dragged the form.

4. Change the base class of CBITMAPDialogdlg to CBitmapDialog and change the corresponding message mapping. Please try it out!

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

New Post(0)