CTreeCtrl::SetExtendedStyle
Sets the extended styles for the current tree-view control.
DWORD SetExtendedStyle(
DWORD dwExMask,
DWORD dwExStyles
);
Parameters
Parameter |
Description |
---|---|
[in] dwExMask |
A bitmask that specifies which styles in the current tree-view control are affected by this method. If this parameter is zero, it is ignored and the value of the dwExStyles parameter is assigned to the tree-view control. Specify zero or a bitwise combination (OR) of styles described in Tree-View Control Extended Styles. |
[in] dwExStyles |
A bitmask that specifies which styles in the current tree-view control to set or clear. To set a combination of styles, specify a bitwise combination (OR) of styles described in Tree-View Control Extended Styles. To clear a set of styles, specify zero. |
Return Value
A value that contains the previous extended control styles.
Remarks
This method clears the styles specified in the dwExMask parameter, then sets the styles specified in the dwExStyles parameter. Only the extended styles that correspond to the bits in dwExMask change.
This method sends the TVM_SETEXTENDEDSTYLE message, which is described in the Windows SDK.
Requirements
Header: afxcmn.h
This method is supported in Windows XP and later.
Additional requirements for this method are described in Build Requirements for Windows Vista Common Controls.
Example
The following code example defines a variable, m_treeCtrl, that is used to access the current tree-view control. The code example also defines an unsigned integer and several HTREEITEM variables. These variables are used in the next example.
public:
// Variable to access tree control.
CTreeCtrl m_treeCtrl;
// Variable to access splitbutton control.
CSplitButton m_splitbutton;
// Accessibility identifier
UINT accIdUS;
// HTREEITEMs
HTREEITEM hCountry;
HTREEITEM hPA;
HTREEITEM hWA;
The following code example adds the TVS_EX_AUTOHSCROLL extended style to the current tree-view control. In an earlier section of the code example, which is not shown, we created a tree-view that consists of a root country/region node for the United States, subnodes for the states of Pennsylvania and Washington, and tree items for cities in those states. We intentionally made the tree-view control narrow so that it must automatically scroll to display the tree item that has the focus.
m_treeCtrl.SetExtendedStyle(TVS_EX_AUTOHSCROLL, TVS_EX_AUTOHSCROLL);