PushPin class pushpin class author: PJ Naughter class improvements, using comments, examples of: Gong Jianwei Gong Jianwei Technology Home ◆ ◆◆
The PushPin class can make the Properties dialog icout button in VC6, modified the original class in the sample program, and can truly "nail" in the upper layer, keep visible. Used in VC6, the program Can run at 9X / ME / 2K. It is recommended to give you a try, have a good work, don't forget to send me a copy. First download the source program: Download (including the sample program I made) is ok, if you are a friend of the VC, first follow the sample program, the old bird has to look at the program. 1. New project: Newly built a dialog-based PushpinTest project in VC6, and add a button control in the dialog box (the button in the top left of the dialog) IDC_Button_Visible, special attention: To put the PROPERTIES-> In Style, select Ower Draw, Bitmap, Notify property. 2. Insert the class file in the project: put the pushpin.cpp and putilers Copy to the project folder (Note: If you want to do it with me, you have a Keep visible function, just in the sample program, COPY Do not use the original author's class file, because the class file in the sample program is improved) Click Project-> Add to Project-> Files, select Pushpin.cpp and Pushpin.h files in the File Selection dialog box. Click OK; how, see the CPUSHPINBUTTON class in ClassView. Open CLASSWIZARD If you do not see the CPUSHPINBUTTON class, you can close the ClassWizard (do not turn off the VC), delete the pushpintest.clw file under the project folder, open ClassWizard, you will see the prompt: "The classwizard database doesn't exist, .. ..., would you like to build it from your source files? ", choose Yes, a dialog box, click Add All, click OK, ok, you can see the CPUSHPINBUTTON class in ClassWizard. And in the sample program in the sample program I do, in the unpinned.bmp import to the project, the corresponding ID is: IDB_PINNED_BITMAP, IDB_UNPINNED_BITMAP. 3. Add a button control IDC_BUTTON_VISIBLE CPushPinButton first control variable, plus the PushPinTestDlg.h:. #Include "PushPin.h" open ClassWizard-> Member Variable CPushPinButton add a control variable using ClassWizard IDC_BUTTON_VISIBLE m_ctrlPushPin 4. add IDC_BUTTON_VISIBLE Bn_clicked message processing function, with the default name onbuttonvisible (), add the following code in the function:
void CPushPinTestDlg :: OnButtonVisible () {m_ctrlPushPin.ProcessClick (); m_bVisible = m_bVisible; if (m_bVisible) {SetWindowPos (& wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);!} else {SetWindowPos (& wndBottom, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOREDRAW); BringWindowToTop ();}} where m_bVisible is BOOL type variable, you can join in CPushPinTestDlg ClassView right-click, Add Member variable in and CPushPinTestDlg class constructor Add M_BVisible = FALSE:
Cpushpintestdlg :: cpushpintestdlg (cpushpintestdlg (cwnd * pparent / * = null * /): cdialog (cpushpintestdlg :: IDd, pparent) {..... m_bvisible = false;}
Datual, build -> run, okay? Do you have any questions?