📄 gfxlistctrl.h
字号:
public:
CGfxListTip wndToolTip;
int CellRectFromPoint(CPoint & point, RECT * cellrect, int * col) const;
// Drag column
void DragColumn(int &source, int &dest);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CGfxListCtrl)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
//}}AFX_VIRTUAL
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
virtual void DrawItemCategory(LPDRAWITEMSTRUCT lpDrawItemStruct);
// Implementation
public:
bool LinkRecordset(const char * cMainRecord, CDaoRecordset * ps, const char * cLinkRecord, const char * cTextField);
bool LinkRecordset(const int iColId, CDaoRecordset * ps, const int iLnk, const int iTxtLnk);
bool EnableMoveNext();
bool EnableMovePrev();
bool EnableMoveLast();
bool EnableMoveFirst();
void OnMovePrevRecord();
void OnMoveNextRecord();
void OnMoveLastRecord();
void OnMoveFirstRecord();
void ModifyExStyle(DWORD dwRemove, DWORD dwAdd, UINT dwRedraw = 0);
void DeleteAllColumns();
/**
*更新指定列表单元的显示
**/
void ModifyItemEx(const int iIndex, const int iSubItem, const long lData, CString &cs);
/**
*更新指定列表单元的显示
**/
void ModifyItemEx(const int iIndex, const int iSubItem, const long lData);
void DeleteItemEx(const int iIndex, const long lData);
/**
* 获取指定列表单元的显示文本
**/
void GetItemTextEx(const int idx, const int sub, CString &cs, const unsigned long *dwData = NULL);
int InsertItemEx(const int iIndex, const long lData);
void EnableCategoryView(const bool bEnab = true);
CGfxCategoryManager * GetCategoryManager();
CGfxCategoryManager * CreateCategoryManager();
/**
*获取列表控件中的列标题数据设置列标题数据集
**/
void RetrieveColumnData();
/**
*据列标题数据集建立列表控件的各列(重绘列表控件和列标题控件)
**/
void SetupColumnData();
CGfxColumnManager * GetColumnManager();
CGfxColumnManager * CreateColumnManager();
void EnableColumnDrag(const bool bEnableDrag = true);
bool IsColumnDragEnabled() const { return wndHeader.bEnableDrag; };
/**
* 获取列对应的子项索引
**/
int GetColumnIndex(const int iCol) const;
bool DoCopyInClipboard(const bool bOnlySel = true);
int GetColumnCount() const;
void ResetScrollBar();
void SetColumnImage(const int iCol, const int iImage);
void SetHeaderImageList(CImageList * pIma);
void SetSubItemImage(const int iItem, const int iSubItem, const int iIndex);
void RemoveAllSelection();
/**
*获取行索引为nItem、列索引为nCol的子项矩形(rcItem)
**/
void GetSubItemRect(const int nItem, const int nCol, CRect &rcItem);
/**
*确保列可见
**/
bool EnsureSubItemVisible(const int iSubItem);
/**
*确定点击位置所在的行索引和对应的列索引
**/
int HitTestEx(CPoint & point, int * col) const;
/**
*创建组合框控件以编辑指定条目子项
**/
//CGfxInCombo * ComboSubLabel(int nItem, int nCol, bool bEditable = false, bool bClick = true);
//我改为:(bClick=false只能从所给选项中选择,不能输入自定义选项;bClick=true可输入自定义选项)
CGfxInCombo * ComboSubLabel(int nItem, int nCol, bool bEditable = false, bool bClick = true);
/**
*创建编辑控件以编辑行索引为nItem、列索引为nCol的列表单元(bClick=flase表示在编辑控件中全选被编辑文本,bClick=true表示在编辑控件中不选任何内容)
**/
CRichEditCtrl * EditSubLabel(int nItem, int nCol, bool bClick = true);
void OnInit();
void ModifyFlag(const DWORD dwRemove, const DWORD dwAdd, const UINT dwRedraw);
DWORD GetFlag() const { return dwFlag; };
LPCTSTR MakeShortString(CDC* pDC, LPCTSTR lpszLong, int nColumnLen, int nOffset);
void MakeShortString(CDC* pDC, CString &cs, int nColumnLen, int nOffset);
int InsertColumnEx(int iPos, const char * cText, int iAlign, int iWidth, DWORD exData); // LVCFMT_LEFT
virtual ~CGfxListCtrl();
bool AskForInfo(LXHDREX * pLx, CDC *pDC);
long SendInfoExMsg(LXHDREX * pLx);
// Generated message map functions
afx_msg void OnGfxCustomizehead();
afx_msg void OnGfxFormatheader();
protected:
//{{AFX_MSG(CGfxListCtrl)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnPaint();
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
/**
*处理在列表控件中对列表单元的单击
**/
afx_msg void OnClick(NMHDR* pNMHDR, LRESULT* pResult);
/**
*处理LVN_ENDLABELEDIT通告以便使编辑框编辑的结果被接受,并更新列表控件的显示
**/
afx_msg void OnEndlabeledit(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
/**
*单击选中相应条目子项
**/
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnKeydown(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnUpdateGfxCustomizehead(CCmdUI* pCmdUI);
afx_msg void OnUpdateGfxFormatheader(CCmdUI* pCmdUI);
afx_msg void OnGfxSortasc();
afx_msg void OnUpdateGfxSortasc(CCmdUI* pCmdUI);
afx_msg void OnGfxSortdesc();
afx_msg void OnUpdateGfxSortdesc(CCmdUI* pCmdUI);
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
afx_msg BOOL OnQueryNewPalette();
afx_msg void OnPaletteChanged(CWnd* pFocusWnd);
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
//}}AFX_MSG
afx_msg LRESULT OnSetTextColor(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnSetTextBkColor(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnSetBkColor(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnSetImageList(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnUserTab(WPARAM wParam, LPARAM lParam);
afx_msg void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
// afx_msg void OnDblclk(NMHDR* pNMHDR, LRESULT* pResult);
DECLARE_MESSAGE_MAP()
};
inline void CGfxListCtrl::SetAutoPreviewHeight(const int iHeight)
{
iAutoPreviewHeight = iHeight;
if (GetSafeHwnd())
{
if (GetFocus() != this) SetFocus();
if (pCategoryManager == NULL)
{
Invalidate();
CRect rc;
GetWindowRect( &rc );
WINDOWPOS wp;
wp.hwnd = m_hWnd;
wp.cx = rc.Width();
wp.cy = rc.Height();
wp.flags = SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOZORDER;
SendMessage(WM_WINDOWPOSCHANGED, 0, (LPARAM)&wp);
}
}
};
inline int CGfxListCtrl::GetAutoPreviewHeight() const
{ return iAutoPreviewHeight; };
inline void CGfxListCtrl::SetPrintFlag(const DWORD dwf)
{ dwPrintFlag = dwf; }
inline void CGfxListCtrl::SetPrintName(const char * name)
{ csPrintName = name; };
inline void CGfxListCtrl::SetMargins(const int left, const int top, const int right, const int bottom)
{ rcMarginMM.SetRect(left,top,right,bottom); }
inline void CGfxListCtrl::SetBlendBitmap(const bool bBlend)
{ bBlendBitmap = bBlend; }
inline void CGfxListCtrl::SetNumeric(const int iCol)
{ dwhNumeric |= (1 << iCol); };
inline void CGfxListCtrl::SetValute(const int iCol)
{ dwhValute |= (1 << iCol); };
inline void CGfxListCtrl::SetEditCol(const int iCol)
{ dwhEdit |= (1 << iCol); };
inline void CGfxListCtrl::SetComboCol(const int iCol)
{ dwhCombo |= (1 << iCol); };
inline void CGfxListCtrl::SetComboExCol(const int iCol)
{ dwhComboEx |= (1 << iCol); };
inline void CGfxListCtrl::SetExColRequest(const int iCol)
{ wdhExInfoOnCol |= (1 << iCol); };
inline void CGfxListCtrl::DontDrawSortArrow(const int iCol)
{ wndHeader.dwDontShowSortArrow |= (1 << iCol); };
inline bool CGfxListCtrl::NeedColExInfo(const int iCol) const
{
if (dwFlag&fExInfo)
{
if (dwFlag&fExInfoOnRow) return iCol == 0 ? true : false;
if (dwFlag&wdhExInfoOnCol) return wdhExInfoOnCol & (1 << GetColumnIndex(iCol)) ? true : false;
return true;
}
return false;
};
inline void CGfxListCtrl::SetItemImageList(CImageList * pList)
{ pItemImageList = pList; };
inline void CGfxListCtrl::SetExInfoCallback(long (CWnd::*fpExInfoFun)(LXHDREX *))
{ m_fpExInfoFun = fpExInfoFun; };
inline void CGfxListCtrl::SetCategoryCallback(void (CWnd::*fpCategoryFun)(CGfxCategoryManager * , long &))
{ m_fpCategoryFun = fpCategoryFun; };
inline void CGfxListCtrl::SetGetTextCallback(void (CWnd::*fpGetTextCallback)(int , int, long, CString &))
{ m_fpGetTextCallback = fpGetTextCallback; };
inline void CGfxListCtrl::SetDaoCategoryCallback(void (CWnd::*fpDaoCategoryFun)(CGfxCategoryManager *))
{ m_fpDaoCategoryFun = fpDaoCategoryFun; };
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_GFXLISTCTRL_H__31F5CEA8_E5CA_11D1_86E7_000000000000__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -