📄 sliderdlg.cpp
字号:
// SliderDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Slider.h"
#include "SliderDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSliderDlg dialog
CSliderDlg::CSliderDlg(CWnd* pParent /*=NULL*/)
: CDialog(CSliderDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CSliderDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CSliderDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSliderDlg)
DDX_Control(pDX, IDC_PIC, m_aa);
DDX_Control(pDX, IDC_VOL, m_sliderVol);
DDX_Control(pDX, IDC_MYSLIDER, m_slider);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSliderDlg, CDialog)
//{{AFX_MSG_MAP(CSliderDlg)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSliderDlg message handlers
BOOL CSliderDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
CenterWindow(GetDesktopWindow()); // center to the hpc screen
// TODO: Add extra initialization here
m_slider.SetBitmapChannel( IDB_BACK, IDB_FORE, IDB_WARRING,IDB_CHARGE );
m_slider.SetBitmapThumb( IDB_THUMB_B, IDB_THUMB_A, TRUE );
m_slider.DrawFocusRect( FALSE );
int m_nMin = 0;
int m_nMax = 100;
int m_nPos = -1;
m_slider.SetRange( m_nMin, m_nMax );
m_slider.SetPos( m_nPos );
m_slider.SetMargin( 2, 3, 2, 0 );
///////////////////////////////////////////////
m_sliderVol.SetBitmapChannel(IDB_WARRING, IDB_CHARGE, IDB_VOL_OFF, IDB_VOL_ON );
m_sliderVol.SetRange( 0, 100 );
m_sliderVol.SetPos( -30 );
m_sliderVol.SetMarginLeft( 8 );
m_sliderVol.SetMarginRight( 8 );
m_sliderVol.SetPageSize( 25 );
return TRUE; // return TRUE unless you set the focus to a control
}
void CSliderDlg::OnButton1()
{
CJWBmpSlider *newSlider = new CJWBmpSlider;
newSlider->Create(L"", WS_CHILD|WS_VISIBLE|SS_BITMAP , CRect(12, 60, 180, 80), this,NULL);
newSlider->SetBitmapChannel(IDB_BACK, IDB_FORE, IDB_WARRING,IDB_CHARGE );
newSlider->DrawFocusRect( FALSE );
int m_nMin = 0;
int m_nMax = 100;
int m_nPos = 255;
newSlider->SetRange( m_nMin, m_nMax );
newSlider->SetPos( m_nPos );
newSlider->SetMargin( 2, 3, 2, 0 );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -