SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftMask/OCX 7.0 - Masked Edit Control
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftPrintPreview/DLL 2.0 - Print Preview Control (discontinued)
SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftDirectory 3.5 - File/Folder Control (discontinued)
SftMask/OCX 7.0 - Masked Edit Control
SftOptions 1.0 - Registry/INI Control (discontinued)
SftPrintPreview/OCX 1.0 - Print Preview Control (discontinued)
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftTabs/NET 6.0 - Tab Control (discontinued)
SftTree/NET 2.0 - Tree Control
The SFTTREE_OWNERDRAW structure is used as parameter for an application-supplied owner-draw function of type LPFNSFTTREE_OWNERDRAWPROC, which is called whenever an object needs to be rendered.
typedef struct tagSftTreeOwnerDraw { #define SFTTREE_OD_CALC 0 // calculate width & height (returned in DrawRect) #define SFTTREE_OD_PAINT 1 // paint in hDC int style; // callback function int itemType; // item to draw #define SFTTREE_OD_CELL 0 #define SFTTREE_OD_CELLTOOLTIP 1 #define SFTTREE_OD_ROWHEADER 2 #define SFTTREE_OD_COLHEADER 3 #define SFTTREE_OD_COLHEADEREND 4 #define SFTTREE_OD_ROWCOLHEADER 5 #define SFTTREE_OD_ROWCOLFOOTER 6 #define SFTTREE_OD_COLFOOTER 7 #define SFTTREE_OD_COLFOOTEREND 8 HDC hDC; // device context RECT DrawRect; // drawing rectangle int gap; // suggested gap size long index; // entry being painted short col; // column number BOOL fSelected; // non-zero if item selected - paint only BOOL fFlyby; // non-zero if flyby - paint only BOOL fFocus; // non-zero if item has focus rectangle - paint only UINT id; // control's ID HWND hwndCtl; // control's window handle BOOL fEnabled; // non-zero if window is enabled #if !defined(_WIN32_WCE) BOOL fThemed; // control is themed HINSTANCE hThemeDLL; // UXTHEME dll handle HANDLE hThemeHeader; // header theme HANDLE hThemeListview; // listview theme HANDLE hThemeTreeview; // treeview theme HANDLE hThemeButton; // button theme HANDLE hThemeCheckBox; // checkbox theme HANDLE hThemeSpin; // spin button theme HANDLE hThemeScrollbar; // scrollbar theme HANDLE hThemeFooter; // footer theme #endif } SFTTREE_OWNERDRAW, * LPSFTTREE_OWNERDRAW; typedef const SFTTREE_OWNERDRAW * LPCSFTTREE_OWNERDRAW;
Identifies the object to render.
SFTTREE_OD_CALC | The owner-draw callback is called to calculate the dimensions of the object. |
SFTTREE_OD_PAINT | The owner-draw callback is called to paint the object. |
Identifies the object.
SFTTREE_OD_CELL | A cell - index and col describe the cell |
SFTTREE_OD_CELLTOOLTIP | A ToolTip - index and col describe the cell |
SFTTREE_OD_ROWHEADER | A row header - index describes the item |
SFTTREE_OD_COLHEADER | A column header - col describes the column |
SFTTREE_OD_COLHEADEREND | The column header after the end of the last column (fixed-width only) |
SFTTREE_OD_ROWCOLHEADER | The row/column header |
SFTTREE_OD_ROWCOLFOOTER | The row/column footer |
SFTTREE_OD_COLFOOTER | The column footer - col describes the column |
SFTTREE_OD_COLFOOTEREND | The column footer after the end of the last column (fixed-width only) |
The device context.
Modifiable. If style is SFTTREE_OD_CALC, the callback returns the required dimensions in the DrawRect rectangle (the width and height are used). If style is SFTTREE_OD_PAINT, DrawRect describes the available output area where the object must be rendered.
A suggested horizontal gap size, usually used between text and pictures or between the edge of the object and text or pictures.
Defines the item.
Defines the column.
TRUE if the object is selected or pressed.
TRUE if the object should be rendered with flyby highlighting.
TRUE if the tree control has the input focus.
The window ID of the tree control.
The window handle of the tree control.
TRUE if the tree control is enabled.
TRUE if Windows themes are used to render the tree control.
The module handle of the already loaded Dll UxTheme.dll. This Dll contains all Windows theme rendering support offered by Windows and can be used to dynamically load entry points using GetProcAddress, if desired. If Windows themes are not used, this value is NULL.
An HTHEME handle of theme data for the Header class. If Windows themes are not used, this value is NULL.
An HTHEME handle of theme data for the ListView class. If Windows themes are not used, this value is NULL.
An HTHEME handle of theme data for the TreeView class. If Windows themes are not used, this value is NULL.
An HTHEME handle of theme data for the Button class. If Windows themes are not used, this value is NULL.
An HTHEME handle of theme data for the CheckBox class. If Windows themes are not used, this value is NULL.
An HTHEME handle of theme data for the Spin class. If Windows themes are not used, this value is NULL.
An HTHEME handle of theme data for the Scrollbar class. If Windows themes are not used, this value is NULL.
An HTHEME handle of theme data for the Header class. If Windows themes are not used, this value is NULL. Windows does not define a Footer class so the Header class is used by default.
The SFTTREE_OWNERDRAW structure is used as parameter for an application-supplied owner-draw function of type LPFNSFTTREE_OWNERDRAWPROC, which is called whenever an object needs to be rendered.
The callback receives control when an object needs to be rendered. The callback can then perform application specific rendering of the object. An application can render cells, cell ToolTips, row headers, column headers and the row/column header using the owner-draw function.
The SetOwnerDrawCallback function defines an application-supplied owner-draw function, which is called whenever an object needs to be rendered.
HFONT g_hFontVertical; /* Vertical font */ HBITMAP g_hBitmap; /* Sample bitmap */ // Miscellaneous bitmaps SFT_PICTURE m_aThreeItemPictures[3]; /* Three default item pictures, see SetPictures in online help */ //SFT_PICTURE m_OtherItemPicture; /* Another item picture, see SetItemPicture in online help */ BOOL CALLBACK Tree_OwnerDrawCallback(HWND hwnd, LPSFTTREE_OWNERDRAW lpInfo, SFTTREE_DWORD_PTR UserData); /**********************************************************************/ /* Frame Window Proc */ /**********************************************************************/ LRESULT CALLBACK SDI_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) {
m_Tree.RecalcHorizontalExtent(0, FALSE);/* Update horizontal scroll bar */ } } /**********************************************************************/ /* Ownerdraw Callback */ /**********************************************************************/ void CSampleView::OwnerDraw_Column_Header(LPSFTTREE_OWNERDRAW lpInfo) { // This function paints the column header using a vertical font // it even takes themes into consideration, so it's a bit more complicated // than the average application. // get general information about tree control and columns LPSFTTREE_COLUMN_EX lpCol;
See Also C/C++ API | Categories | Notifications