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的更多相关文章
随机推荐
- OPENGL学习笔记整理(五):着色语言
有些事情本身就是十分奇怪的.在传统上,图形硬件的设计目的是用于快速执行相同的硬编译指令集.不同的计算步骤可以被跳过,参数可以被调整,但计算本身确实固定不变的.然而,随着技术的发展,却越来越变得可以编程 ...
- [翻译]Python——十年语言之冠
最近我发现了这个PYPL——编程语言流行指数.它对各种语言的流行指标进行了二次发掘.作者指出TIOBE指数很可能不能反映出真实情况,归咎于一些编程语言的名称会导致误解.他引入了一些新术语,利用谷歌趋势 ...
- 数往知来 ADO.NET <八>
ADO.NET基础 学习目的:通过程序访问数据库 ,ADO.NET就是一组类库, -->connection 用来连接数据库的类 语法:首先需要一个连接字符串 -->以SQL serv ...
- Eclipse + Idea + Maven + Scala + Spark +sbt
http://jingpin.jikexueyuan.com/article/47043.html 新的scala 编译器idea使用 https://www.jetbrains.com/idea/h ...
- C++二叉树的实现
C++实现二叉查找树 啥是二叉查找树 在数据结构中,有一个奇葩的东西,说它奇葩,那是因为它重要,这就是树.而在树中,二叉树又是当中的贵族.二叉树的一个重要应用是它们在查找中的应用,于是就有了二叉查找树 ...
- shell语句记录-awk
cat ./daily_uv/daily_uv_20140104 | awk '{fr[$1]+=$3; k=$1 "_" $2; av[k]+=$3;} END{for (k i ...
- STL源码分析读书笔记--第二章--空间配置器(allocator)
声明:侯捷先生的STL源码剖析第二章个人感觉讲得蛮乱的,而且跟第三章有关,建议看完第三章再看第二章,网上有人上传了一篇读书笔记,觉得这个读书笔记的内容和编排还不错,我的这篇总结基本就延续了该读书笔记的 ...
- erlang 时间处理
常用代码 date()返回P{年,月,日} erlang:now转本地时间 > calendar:now_to_local_time(erlang:now()). {{,,},{,,}} erl ...
- Hbase学习记录(1)|伪分布式安装
概述 Hbase –Haddop Database 是一个高性能,高可靠性.面向列.可伸缩的分布式存储系统. Hbase利用HDFS作为文件存储系统,利用MapReduce来处理Hbase的海量数据, ...
- T-SQL运算符
运算符 1.算术运算符 算术运算符 说明 + 加法 - 减法 * 乘法 / 除法 % 取模,两个整数相除后的余数 2.位运算符 位运算符 说明 &(与.and) 按位逻辑与运算 |(或.OR) ...


