C++ Code_Slider
|
主题 |
|
1. 2. 3. 4. 5. |
|
属性 |
|
滑块控件属性设置 //代码设置属性 |
|
代码:: |
|
/////////////////////////////////////////////////////////////////////////////
// CProject02Dlg dialog
//class CProject02Dlg : public CDialog
//{
// Construction
//public:
// CProject02Dlg(CWnd* pParent = NULL); // standard constructor
COLORREF m_clColor;
// Dialog Data 在CProject02Dlg中右键添加个Add MemberFunction
void CProject02Dlg::updatePicCtrl()
{
CDC * pDC = m_ctrl_pic1.GetDC();
CRect rc;
m_ctrl_pic1.GetClientRect(rc);
pDC -> FillRect(rc, & CBrush(m_clColor));
m_ctrl_pic1.ReleaseDC(pDC);
} ![]() 在BOOL
CProject02Dlg::OnInitDialog() 部分添加slider的初始化部分代码 // TODO: Add extra initialization
here m_ctrl_Slider1_Red.SetRange(0,255,FALSE);
m_ctrl_Slider2_Green.SetRange(0,255,FALSE);
m_ctrl_Slider3_Blue.SetRange(0,255,FALSE); void CProject02Dlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar*
pScrollBar) {
// TODO: Add your message handler code here and/or
call default if (nSBCode == SB_THUMBTRACK)
{
if
(pScrollBar -> m_hWnd == m_ctrl_Slider1_Red.m_hWnd) {
m_nEdt1_Red = nPos;
UpdateData(FALSE);
}
if
(pScrollBar -> m_hWnd == m_ctrl_Slider2_Green.m_hWnd) {
m_nEdt2_Green = nPos;
UpdateData(FALSE);
}
if
(pScrollBar -> m_hWnd == m_ctrl_Slider3_Blue.m_hWnd) {
m_nEdt3_Blue = nPos;
UpdateData(FALSE);
}
m_clColor = RGB(m_nEdt1_Red,m_nEdt2_Green,m_nEdt3_Blue);
updatePicCtrl();
}
CDialog::OnHScroll(nSBCode, nPos, pScrollBar); } //为每个Edit添加个EN_Change消息
void CProject02Dlg::OnChangeEdit1()
{
// TODO: If this is a RICHEDIT control, the control
will not // send this notification unless you override the
CDialog::OnInitDialog() // function and call
CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the
mask. // TODO: Add your control notification handler code
here UpdateData(TRUE);
m_ctrl_Slider1_Red.SetPos(m_nEdt1_Red);
updatePicCtrl();
}
void CProject02Dlg::OnChangeEdit2()
{
// TODO: If this is a RICHEDIT control, the control
will not // send this notification unless you override the
CDialog::OnInitDialog() // function and call
CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the
mask. // TODO: Add your control notification handler code
here UpdateData(TRUE);
m_ctrl_Slider2_Green.SetPos(m_nEdt2_Green);
updatePicCtrl();
}
void CProject02Dlg::OnChangeEdit3()
{
// TODO: If this is a RICHEDIT control, the control
will not // send this notification unless you override the
CDialog::OnInitDialog() // function and call
CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the
mask. // TODO: Add your control notification handler code
here UpdateData(TRUE);
m_ctrl_Slider3_Blue.SetPos(m_nEdt3_Blue);
updatePicCtrl();
} 效果图:
|
附件列表
C++ Code_Slider的更多相关文章
随机推荐
- 如何查看python selenium的api
1. 打开命令行: command+R2. 输入: python -m pydoc -p 4567,然后:Enter3. 然后在浏览器中访问http://localhost:45674. 按ctrl+ ...
- svn import 向Google code里导入初始代码
其实很简单的问题,花费了这么多时间,想把初始代码导入到Google code里,用VisaulSVN插件的Switch功能也不可以,Google code上虽然有上传,但是只能单个文件传...... ...
- PHP获取本周开始时间
/*先设置时区*/date_default_timezone_set('PRC');/*网上的写法:总觉得这周跨年或者跨月的时候会悲剧 未验证*/echo mktime(0,0,0,date('m') ...
- 新工程软连接到原来的工程的out目录后,可以直接编译模块
P508B_App_old_developer/alps$ ln -s ../../P508B_App/alps/out 连接后,第一次编译后要加分支 ./mk hedy89_we_jb2 mm p ...
- Mellanox vma
1,Mellanox offical vma Installation guide personal reading summarize VMA是一个消息加速器messaging accelerato ...
- oracle数据库建表
create or replace directory dumpdir as 'E:\oracle\dumpdir';create temporary tablespace ydxt_temp tem ...
- MYSQL数据库性能调优之四:解决慢查询--索引
为什么索引能够提高查询速度?没有索引 检索数据的方式是从头到尾一条一条挨着匹配,这是慢的根本原因:索引类型BTREE:二叉树类型,原理图如下:对表创建一个二叉树,记录中间数据的物理磁盘地址,二叉树检索 ...
- #用Python直接写UTF-8文本文件
当我们这样建立文件时 f = file('x1.txt', 'w') f.write(u'中文') f.colse() 直接结果应该是类似 f.write(u'中文') UnicodeEncodeEr ...
- spring properties resolve 问题
在stackoverflow上看到一个问题 配置如下: <context:property-placeholder location="/WEB-INF/application-cus ...
- poj 3216 Repairing Company(最短路Floyd + 最小路径覆盖 + 构图)
http://poj.org/problem?id=3216 Repairing Company Time Limit: 1000MS Memory Limit: 131072K Total Su ...


