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的更多相关文章
随机推荐
- SQL跨数据库复制表数据
SQL跨数据库复制表数据 不同服务器数据库之间的数据操作 不同数据库之间复制表的数据的方法: 当表目标表存在时: insert into 目的数据库..表 select * from 源数据库.. ...
- static用法总结
C++的static有两种用法:面向过程程序设计中的static和面向对象程序设计中的static.前者应用于普通变量和函数,不涉及类:后者主要说明static在类中的作用. 一.面向过程设计中的st ...
- seo技巧-2015/10/05
1.每页都要有它自己的文件名,并且有它自己的上级文件夹和它自己相关关键字. 2.建议在每页上使用一个的H1标签.我也试着使用许多H2 或H3的标签在页面内辅助构成正文内容. 3. 有时花费一点钱帮助你 ...
- C字符串和C++中string的区别 &&&&C++中int型与string型互相转换
在C++中则把字符串封装成了一种数据类型string,可以直接声明变量并进行赋值等字符串操作.以下是C字符串和C++中string的区别: C字符串 string对象(C++) 所需的头文件名称 ...
- .NET中的Newtonsoft.Json.JsonConvert.SerializeObject(string a)
1.將string a 序列化為Json格式: 2.使用條件:將Newtonsoft.Json.dll作為引用添加到項目中.下载地址在这:http://json.codeplex.com/
- Camel In Action 阅读笔记 第一章 认识Camel 1.1 Camel 介绍
1.1 Camel 介绍 Camel 是一个为了您的项目集成变得高效有趣的集成框架,Camel 项目在2007年初开始的,相对来说它还比较年轻,但它已然是一个非常成熟的开源项目,它所使用的是Apach ...
- sql-labs 分享
前段时间在网上发现了一个阿三同学托管在github上的sql注入入门科普项目,感觉挺不错,在此分享一下.虽然现在有很多工具比如sqlmap可以实现自动化的sql注入,但是个人感觉如果只知其然而不知其所 ...
- 怎么监视跟踪一个进程(Process)中的MS Unit Test DLL的详细性能(performance)【asp.net C#】
Sample This tutorial will show how to instrument a unit test DLL for performance profiling. Visual S ...
- vim插件开发初步
[vim插件开发初步] 将如下代码存在helloworld.vim, 放在~/.vim/plugin目录下,插件即可生效.:w保存代码后, 用:source命令执行后,也可以使用Helloworld命 ...
- SD卡中的命令CMD
SD卡中的命令是SD控制器和SD卡之间的桥梁,它封装了SD卡的实现细节,不影响SD卡中FLASH的读写变更. 命令的长度是48位,它的字段如图: SD校准定义的CMD如下:


