滚动条的效果图:
代码的使用:
else if (strcmp(msg.sType, _T("valuechanged")) == 0)
{
CTabLayoutUI* pTabControl = static_cast<CTabLayoutUI*>(m_PaintManager.FindControl(_T("tabs")));
if (pTabControl != NULL)
{
if (pTabControl->GetCurSel() == 0)
{
CSliderUI* AdjustColorSliderR = static_cast<CSliderUI*>(m_PaintManager.FindControl(_T("AdjustColorSliderR")));
CSliderUI* AdjustColorSliderG = static_cast<CSliderUI*>(m_PaintManager.FindControl( _T("AdjustColorSliderG")));
CSliderUI* AdjustColorSliderB = static_cast<CSliderUI*>(m_PaintManager.FindControl(_T("AdjustColorSliderB")));
if ((AdjustColorSliderR != NULL) && (AdjustColorSliderG != NULL) && (AdjustColorSliderB != NULL))
{
if ((_tcsicmp(msg.pSender->GetName(), _T("AdjustColorSliderR")) == 0) ||
(_tcsicmp(msg.pSender->GetName(), _T("AdjustColorSliderG")) == 0) ||
(_tcsicmp(msg.pSender->GetName(), _T("AdjustColorSliderB")) == 0))
{
BYTE red = AdjustColorSliderR->GetValue();
BYTE green = AdjustColorSliderG->GetValue();
BYTE blue = AdjustColorSliderB->GetValue();
COLORREF crColor = RGB(red, green, blue);
TCHAR szBuf[MAX_PATH] = {0};
_stprintf_s(szBuf, MAX_PATH - 1, _T("FF%02X%02X%02X"), GetRValue(crColor), GetGValue(crColor), GetBValue(crColor));
}
}
}
else if (pTabControl->GetCurSel() == 1)
{}
}
}
else if (_tcsicmp(msg.sType, _T("click")) == 0)
{
CTabLayoutUI* pTabControl = static_cast<CTabLayoutUI*>(m_PaintManager.FindControl(_T("tabs")));
if (pTabControl != NULL)
{
//pTabControl为复选框是否处于选中状态。
if (pTabControl->GetCurSel() == 0)
{
if (_tcsstr(msg.pSender->GetName(), _T("color_001")) != 0)
{
CSliderUI* AdjustColorSliderR = static_cast<CSliderUI*>(m_PaintManager.FindControl(_T("AdjustColorSliderR")));
CSliderUI* AdjustColorSliderG = static_cast<CSliderUI*>(m_PaintManager.FindControl(_T("AdjustColorSliderG")));
CSliderUI* AdjustColorSliderB = static_cast<CSliderUI*>(m_PaintManager.FindControl(_T("AdjustColorSliderB")));
if ((AdjustColorSliderR != NULL) && (AdjustColorSliderG != NULL) && (AdjustColorSliderB != NULL))
{
DWORD dwColor = msg.pSender->GetBkColor();
AdjustColorSliderR->SetValue(static_cast<BYTE>(GetRValue(dwColor)));
AdjustColorSliderG->SetValue(static_cast<BYTE>(GetGValue(dwColor)));
AdjustColorSliderB->SetValue(static_cast<BYTE>(GetBValue(dwColor)));
}
}
}
else if (pTabControl->GetCurSel() == 1)
{}
}
}
代码的使用:
else if (strcmp(msg.sType, _T("valuechanged")) == 0)
{
CTabLayoutUI* pTabControl = static_cast<CTabLayoutUI*>(m_PaintManager.FindControl(_T("tabs")));
if (pTabControl != NULL)
{
if (pTabControl->GetCurSel() == 0)
{
CSliderUI* AdjustColorSliderR = static_cast<CSliderUI*>(m_PaintManager.FindControl(_T("AdjustColorSliderR")));
CSliderUI* AdjustColorSliderG = static_cast<CSliderUI*>(m_PaintManager.FindControl( _T("AdjustColorSliderG")));
CSliderUI* AdjustColorSliderB = static_cast<CSliderUI*>(m_PaintManager.FindControl(_T("AdjustColorSliderB")));
if ((AdjustColorSliderR != NULL) && (AdjustColorSliderG != NULL) && (AdjustColorSliderB != NULL))
{
if ((_tcsicmp(msg.pSender->GetName(), _T("AdjustColorSliderR")) == 0) ||
(_tcsicmp(msg.pSender->GetName(), _T("AdjustColorSliderG")) == 0) ||
(_tcsicmp(msg.pSender->GetName(), _T("AdjustColorSliderB")) == 0))
{
BYTE red = AdjustColorSliderR->GetValue();
BYTE green = AdjustColorSliderG->GetValue();
BYTE blue = AdjustColorSliderB->GetValue();
COLORREF crColor = RGB(red, green, blue);
TCHAR szBuf[MAX_PATH] = {0};
_stprintf_s(szBuf, MAX_PATH - 1, _T("FF%02X%02X%02X"), GetRValue(crColor), GetGValue(crColor), GetBValue(crColor));
}
}
}
else if (pTabControl->GetCurSel() == 1)
{}
}
}
else if (_tcsicmp(msg.sType, _T("click")) == 0)
{
CTabLayoutUI* pTabControl = static_cast<CTabLayoutUI*>(m_PaintManager.FindControl(_T("tabs")));
if (pTabControl != NULL)
{
//pTabControl为复选框是否处于选中状态。
if (pTabControl->GetCurSel() == 0)
{
if (_tcsstr(msg.pSender->GetName(), _T("color_001")) != 0)
{
CSliderUI* AdjustColorSliderR = static_cast<CSliderUI*>(m_PaintManager.FindControl(_T("AdjustColorSliderR")));
CSliderUI* AdjustColorSliderG = static_cast<CSliderUI*>(m_PaintManager.FindControl(_T("AdjustColorSliderG")));
CSliderUI* AdjustColorSliderB = static_cast<CSliderUI*>(m_PaintManager.FindControl(_T("AdjustColorSliderB")));
if ((AdjustColorSliderR != NULL) && (AdjustColorSliderG != NULL) && (AdjustColorSliderB != NULL))
{
DWORD dwColor = msg.pSender->GetBkColor();
AdjustColorSliderR->SetValue(static_cast<BYTE>(GetRValue(dwColor)));
AdjustColorSliderG->SetValue(static_cast<BYTE>(GetGValue(dwColor)));
AdjustColorSliderB->SetValue(static_cast<BYTE>(GetBValue(dwColor)));
}
}
}
else if (pTabControl->GetCurSel() == 1)
{}
}
}