CTreeCtrl控件风格设置

 在窗口添加TreeControl控件,并关联CTreeCtrl类的m_tree对象后,在父窗口视图类OnInitialDialog方法添加代码设置Tree控件的style:

 

DWORD   dwStyles=GetWindowLong(m_tree.m_hWnd,GWL_STYLE);//获取树控制原风格 

dwStyles|=TVS_EDITLABELS|TVS_HASBUTTONS|TVS_HASLINES|TVS_LINESATROOT; 

SetWindowLong(m_tree.m_hWnd,GWL_STYLE,dwStyles);//设置风格

 

GetWindowLong:Windows 提供的用户接口,为获取特定窗口的信息。

 

LONG GetWindowLong(
  HWND
hWnd// handle to window
  int nIndex  // offset of value to retrieve
);

hWnd为窗口句柄;nIndex可取GWL_STYLE:获取窗口Style。

 

SetWindowLong:

LONG SetWindowLong(   HWND hWnd,       // handle to window
  int nIndex,      // offset of value to set
  LONG dwNewLong   // new value
);



 

 

你可能感兴趣的:(mfc,设置,界面,休闲,控件风格)