摘要: SetItemText用法CListCtrl::SetItemTextBOOL SetItemText( int nItem, int nSubItem, LPTSTR lpszText );Return ValueNonzero if successful; otherwise zero.ParametersnItemIndex of the item whose text is to be set.nSubItemIndex of the subitem, or zero to set the item label.lpszTextPointer to a string that cont 阅读全文
posted @ 2011-08-11 10:04 role 阅读(10099) 评论(1) 推荐(0) 编辑
摘要: 在编程中经常用到GetCurSel()不知道什么意思总结下:CComboBox::GetCurSelint GetCursor( ) const;返回值:返回组合框中列表框中当前选中的项的下标。如果没有选中项,则返回CB_ERR。说明:本函数用于取得组合框中当前选中的项的下标。CComboBox::SetCurSelint SetCurSel( int nSelect );返回值:调用成功时返回选中的项的下标。如果nSelect大于列表中项的个数,则返回CB_ERR。如果nSelect为-1,则清除当前的选择并返回CB_ERR。参数: nSelect 指定要选中的字符串的下标。如果为-1,则清 阅读全文
posted @ 2011-08-10 20:07 role 阅读(8587) 评论(0) 推荐(0) 编辑
摘要: 保存到表中:UpdateData(true); if(m_name.IsEmpty()) { MessageBox("姓名不能为空。","提示",MB_ICONINFORMATION); return; }else if(m_contact_name.IsEmpty()) { MessageBox("联系人姓名不能为空。","提示",MB_ICONINFORMATION); return; } CString sex,marriage; m_sex.GetLBText(m_sex.GetCurSel(),sex); 阅读全文
posted @ 2011-08-10 19:38 role 阅读(975) 评论(0) 推荐(0) 编辑
摘要: //添加工具条if (!m_wndtoolbar.CreateEx(this,TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_ALIGN_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS ,CRect(4,4,0,0)) ||!m_wndtoolbar.LoadToolBar(IDR_TOOLBAR)){MessageBox("创建工具栏失败!", "错误", MB_ICONSTOP);return FALSE;}m_wndtoolbar.ShowWindow(SW_SHOW);Repositio 阅读全文
posted @ 2011-08-10 19:33 role 阅读(259) 评论(0) 推荐(0) 编辑
摘要: 工具栏图标的设置代码BOOL CMainFrame::CreateExToolBar(){ CImageList img; CString str; if(!m_wndReBar.Create(this)) { return -1; } if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC)) { return -1; } m_wndToolBar.GetToolBarCtrl().SetBu 阅读全文
posted @ 2011-08-10 17:44 role 阅读(2890) 评论(0) 推荐(0) 编辑
摘要: CComboBox::CreateBOOL Create( DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID );CBS_AUTOHSCROLLAutomatically scrolls the text in the edit control to the right when the user types a character at the end of the line. If this style is not set, only text that fits within the rectangular 阅读全文
posted @ 2011-08-06 16:35 role 阅读(1229) 评论(0) 推荐(0) 编辑
摘要: //已验证过void CCadersRosterView::OnContextMenu(CWnd* pWnd, CPoint point) { //右键弹出菜单项 CMenu m_datamenu; m_datamenu.LoadMenu(IDR_DATA); CMenu*m_subdatamenu=m_datamenu.GetSubMenu(0); CPoint pt; GetCursorPos(&pt); ASSERT( m_subdatamenu != NULL ); POSITION poslist=m_list.GetFirstSelectedItemPosition(); 阅读全文
posted @ 2011-08-05 21:28 role 阅读(220) 评论(0) 推荐(0) 编辑
摘要: //已验证过//已验证过 void CCadersRosterView::OnContextMenu(CWnd* pWnd, CPoint point) { //右键弹出菜单项 CMenu m_datamenu; m_datamenu.LoadMenu(IDR_DATA); CMenu*m_subdatamenu=m_datamenu.GetSubMenu(0); CPoint pt; GetCursorPos(&pt); ASSERT( m_subdatamenu != NULL ); POSITION poslist=m_list.GetFirstSelectedItemPosit 阅读全文
posted @ 2011-08-05 21:02 role 阅读(327) 评论(0) 推荐(0) 编辑
摘要: 【实现步骤】 1. 当鼠标点击表格控件的某一格时,首先判断该列的属性,是直接编辑呢,还是用下拉列表进行选择。 2. 显示隐藏的文本控件或者下拉列表控件,显示的位置和大小与选中格的位置大小完全相同,这样可以覆盖选中格 3. 将选中格的内容填到文本控件或者下拉列表控件中 4. 修改完毕后,将新的内容填到选中格中,同时隐藏文本控件或者下拉列表控件。 【主要程序段及说明】 变量定义: CComboBox m_ChangeCombo;--下拉列表控件,初始时不可见 CEdit m_Change;---------------文本控件,初始时不可见 CSring m_sChange;----------- 阅读全文
posted @ 2011-08-05 11:01 role 阅读(1283) 评论(0) 推荐(0) 编辑
摘要: 1:新建一个基于对话框的mfc应用程序,添加个列表框,并对其进行报告顶端的设置,添加个菜单子菜单为降序升序, 并为其添加响应函数void CMyPopMenuDlg::OnMenuitemasc() {// TODO: Add your command handler code hereLoadBookInfo(false);}void CMyPopMenuDlg::OnMenuitemdesc() {// TODO: Add your command handler code hereLoadBookInfo(TRUE);}增加消息响应函数:(响应鼠标右键)void CMyPopMenuDl 阅读全文
posted @ 2011-07-29 09:18 role 阅读(441) 评论(0) 推荐(0) 编辑