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的更多相关文章
随机推荐
- SoapUI Property
1. Test Suite(Case) Property 选择Test Suite(Case),switch to Custom properties 在request中的引用方式: ${[scope ...
- 远程重启linux主机的几种方法
方法一,在终端上利用ssh,不登录远程主机,直接发送重启命令 ssh root@192.168.8.128 'reboot' 方法二,在终端上利用ssh和here document ssh root@ ...
- springMVC的详细步骤配置
使用springMVC也可以代替struts2,当然只是代替业务分发的功能,struts2的一些其他功能它是没有的,不然要struts2有什么用. 下面我用springMVC代替struts2去整合h ...
- other 遮罩层
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content ...
- 从数列1,2,3.......n 中 随意取几个数,使其和等于 m
//从数列1,2,3.......n 中 随意取几个数,使其和等于 m public static void Print(int n, int m, List<int> ...
- 第三百五十七天 how can I 坚持
502是我对你没有爱的意思吗?为什么要要这样啊,好绝情. 明天要去加班,今晚回来也好晚了,晚上回来都有点精神恍惚了. 他们要聚会,本来要想去樱木花道来,哎. 后天..什么都没学. .. .. .. 准 ...
- 第二百一十四天 how can I 坚持
今天肯定有需要记录的东西. html表格. table tr rd colspan rowspan, 还有呢.没了. 睡觉,明天石洋要来泛华. 睡觉.
- 第二百一十天 how can I 坚持
Node.js 服务器端JavaScript,单进程. 该如何学习啊,貌似学什么都学不深入. 纠结死了. 睡觉.
- Linux中内存查看命令free详解(转)
add by zhj:说了那么多,其实看第一行就足够了,free项就是未使用的内存.其实,我是感觉压根就没必要 使用free命令,用top代替就行了 原文:http://liustb.blog.163 ...
- Codeforces 719 E. Sasha and Array (线段树+矩阵运算)
题目链接:http://codeforces.com/contest/719/problem/E 题意:操作1将[l, r] + x; 操作2求f[l] + ... + f[r]; 题解:注意矩阵可以 ...


