VS2013 MFC Combox/ListCtrl 控件使用技巧

1.ComBox控件排序问题 sort属性
ComBox控件 在属性data中添加内容时 ,并不是按照管理员;医生;售药员;所有成员顺序,把sort 改为 false即可

2.ListCtrl控件 属性设置
报表设置:只能用ModifyStyle
其他风格:SetExtendedStyle

//m_tree.SetExtendedStyle(m_tree.GetExtendedStyle() | LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT | LVS_REPORT);//此处设置报表不好用
	m_tree.SetExtendedStyle(m_tree.GetExtendedStyle() | LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT );
	m_tree.ModifyStyle(0, LVS_REPORT);//设置报表格式必须使用modifystyle 使用上面的函数没有作用

3.ListCtrl 当列的宽度超过ListCtrl控件时 并没有显示水平滚动条:
操作:只进行表头的初始化,未出现水平滚动条:

CString head[] = { TEXT("药品代号"), TEXT("药品名称"), TEXT("药品类别"),
		TEXT("库存数目"), TEXT("出厂公司"), TEXT("产地"),
		TEXT("出厂时间"), TEXT("保质期(月)"), TEXT("单价(元)") };
	int nLen = sizeof(head) / sizeof(head[0]);
	for (int i = 0; i < nLen;i++)
	{
		m_tree.InsertColumn(i, head[i], LVCFMT_LEFT,80);
	}

**原因:**在只初始化控件表头,并没有给控件赋值时,是不会显示水平滚动条的,如果想实现出现滚动条,就随便插入一条数据内容
m_tree.InsertItem(0, NULL);即可

CString head[] = { TEXT("药品代号"), TEXT("药品名称"), TEXT("药品类别"),
		TEXT("库存数目"), TEXT("出厂公司"), TEXT("产地"),
		TEXT("出厂时间"), TEXT("保质期(月)"), TEXT("单价(元)") };
	int nLen = sizeof(head) / sizeof(head[0]);
	for (int i = 0; i < nLen;i++)
	{
		m_tree.InsertColumn(i, head[i], LVCFMT_LEFT,80);
		
		//m_tree.SetColumnWidth(80, LVSCW_AUTOSIZE_USEHEADER);//不管用
	}
	m_tree.InsertItem(0, NULL);

4.ComBox控件清空所有选项为ResetContent();

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
MFC开发过程序所需的ModifyStyle(needDelStyle,needAddStyle,SWP_FRAMECHANGED); Sytel: WS_BORDER Creates a window that has a border. WS_CAPTION Creates a window that has a title bar (implies the WS_BORDER style). Cannot be used with the WS_DLGFRAME style. WS_CHILD Creates a child window. Cannot be used with the WS_POPUP style. WS_CHILDWINDOW Same as the WS_CHILD style. WS_CLIPCHILDREN Excludes the area occupied by child windows when you draw within the parent window. Used when you create the parent window. WS_CLIPSIBLINGS Clips child windows relative to each other; that is, when a particular child window receives a paint message, the WS_CLIPSIBLINGS style clips all other overlapped child windows out of the region of the child window to be updated. (If WS_CLIPSIBLINGS is not given and child windows overlap, when you draw within the client area of a child window, it is possible to draw within the client area of a neighboring child window.) For use with the WS_CHILD style only. WS_DISABLED Creates a window that is initially disabled. WS_DLGFRAME Creates a window with a double border but no title. WS_GROUP Specifies the first control of a group of controls in which the user can move from one control to the next with the arrow keys. All controls defined with the WS_GROUP style FALSE after the first control belong to the same group. The next control with the WS_GROUP style starts the next group (that is, one group ends where the next begins). WS_HSCROLL Creates a window that has a horizontal scroll bar. WS_ICONIC Creates a window that is initially minimized. Same as the WS_MINIMIZE style. WS_MAXIMIZE Creates a window of maximum size. WS_MAXIMIZEBOX Creates a window that has a Maximize button. WS_MINIMIZE Creates a window that is initially minimized. For use with the WS_OVERLAPPED style only. WS_MINIMIZEBOX Creates a window that has a Minimize button. WS_OVERLAPPED Creates an overlapped window. An overlapped window usually has a caption a

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值