⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 customsizedlg.cpp

📁 用EVC4.0开发的一个画图板程序
💻 CPP
字号:
// CustomSizeDlg.cpp : implementation file
//

#include "stdafx.h"
#include "Draw.h"
#include "CustomSizeDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CCustomSizeDlg dialog


void CCustomSizeDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCustomSizeDlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CCustomSizeDlg, CDialog)
	//{{AFX_MSG_MAP(CCustomSizeDlg)
	ON_WM_HSCROLL()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCustomSizeDlg message handlers

BOOL CCustomSizeDlg::OnInitDialog() 
{
	// TODO: Add extra initialization here
//	CDialog::OnInitDialog(); // Call base class version
	RECT r;
//	char str[80];
	CString str="";

	r.left = 10;
	r.top = 5;
	r.right = 450;
	r.bottom = 60;
    
		
  
   // m_Slider=(CSliderCtrl*)GetDlgItem(IDC_SLIDER);
     MessageBox(_T("size"));
	m_Slider->SetRange(0, 50,TRUE);
	m_Slider->SetPos(global);

    MessageBox(_T("size"));
	str.Format(str,_T("%s%d"),global);
    
	CEdit *ebptr = (CEdit *) GetDlgItem(IDC_CUST_SIZE);
	ebptr->SetWindowText(str);

	return TRUE;
}

void CCustomSizeDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) 
{
	// TODO: Add your message handler code here and/or call default
	
	CEdit *ebptr = (CEdit *) GetDlgItem(IDC_CUST_SIZE);
    CString str="";
	
	int itr;

	itr = m_Slider->GetPos();
	str.Format(str,_T("%s%d"),itr);

//	wsprintf(str, "%d", itr);

	m_Slider->SetPos(m_Slider->GetPos());
	ebptr->SetWindowText(str);
}

void CCustomSizeDlg::OnOK() 
{
	// TODO: Add extra validation here
	CEdit *ebptr = (CEdit *) GetDlgItem(IDC_CUST_SIZE);
	
	int itr;
//	TCHAR str[80];
	CString  str;
	int i;

//	i = ebptr->GetWindowText(str, sizeof str);
	ebptr->GetWindowText(str);
	
	itr = _wtoi(str);   
	
	if (itr == m_Slider->GetPos())
	{
		global = m_Slider->GetPos();
	}
	else
	{
		global = itr;
	}
	
	EndDialog(0);
}

void CCustomSizeDlg::OnCancel() 
{
	// TODO: Add extra cleanup here
	
	EndDialog(0);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -