Tag controls in VC5

zhaozj2021-02-11  194

Tag controls in VC5

In VC5, the label control is supported by the CTABCTRL class. To make a label control, there are several steps: 1. Add TabCtrl in the resourceView tab (the second item on the Label Control of VC5) (for example, name myTabCtrl). Second, the last CTabCtrl variable is associated with the label control of the ClassWizard (for example, name myTab). Third, add a project for the label control. Fourth, until this, a label control is done. You can now add a message to the label control with ClassWizard. The following focuses on the method of adding a project as tag control. The CTabctrl class has a member function insertItem, its prototype is: BOOL INSERTITEM (INT NITEM, TC_ITEM * PTABCTRLITEM); where the first parameter is the serial number of the project, this serial number will be called another member function getCursel () when calling CTabCtrl As a return value. With getcurseel (), the setcursel (int NItem), the SetCursel function changes the currently selected item in the label control, where Nitem is the serial number of the item. The key to InsertItem is the second parameter PTABCTRLITEM. This is a pointer to the TC_Item structure. The TC_Item structure is defined as follows: typedef struct_tc_item {uint mask; / / Type of tag control type uint lnreserved1; // VC reserved, do not use uint lnreserved2; // VC, do not use LPSTR PSZText; // Tag Control item INT CCHTextMax ; // PSZText length Int iimage; // Tag control graphics serial number LParam lParam; // Used data} Tc_Item; in programming, only Mask, PszText, iimage is only used, and three member variables. 1.mask Specifies the type of tag control. It can be the following three values: TCIF_Text PSZText Members Valid TCIF_IMAGE IIMAGE Members Valid TCIF_PARAM iPaRam members are valid If you want to use multiple properties, you should use a bit or operator "|" connection. For example, to make PSZText and iiMAGE members are valid, use TCIF_Text | TCIF_IMAGE as the value of Mask. 2. Project text of the psztext tag control can directly give a string value. The type of label control must have TCIF_Text. 3. IIMAGE tag control graphics serial number, which is a member variable that must be used for tag controls. This tag control must have TCIF_Image. When assigning values, just assign these three (sometimes two) variables. Here is to introduce you to IIMAGE. IIMAGE stores the graphics serial number of the project. The graphics corresponding to this serial number (possibly icon and bitmap) will be displayed on the left of the tag control project text. These graphics can be arbitrary, but must be as large. The iimage of each item of the label control forms a sequence, which is managed by another class CImageList. Please see the usage of CImageList below.

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

New Post(0)