// bitmap.cpp : 实现文件

#include "stdafx.h"
#include "MFC_TSPL.h"
#include "bitmap.h"
#include "afxdialogex.h"
#include "tspl_printer_base.h"

CString x, y, bitmode, bitpath, sets, labels;
// bitmap 对话框

IMPLEMENT_DYNAMIC(bitmap, CDialogEx)

bitmap::bitmap(CWnd* pParent /*=NULL*/)
	: CDialogEx(bitmap::IDD, pParent)
{

}

bitmap::~bitmap()
{
}

void bitmap::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_EDIT1, x_start);
	DDX_Control(pDX, IDC_EDIT3, y_start);
	DDX_Control(pDX, IDC_EDIT4, mode);
	DDX_Control(pDX, IDC_EDIT5, path);

	x_start.SetWindowText(_T("0"));
	y_start.SetWindowText(_T("0"));
	mode.SetWindowText(_T("0"));
	path.SetWindowText(_T("D:\\111_00.bmp"));


}


BEGIN_MESSAGE_MAP(bitmap, CDialogEx)
	ON_BN_CLICKED(IDOK, &bitmap::OnBnClickedOk)
	ON_BN_CLICKED(IDCANCEL, &bitmap::OnBnClickedCancel)
END_MESSAGE_MAP()

void bitmap::OnBnClickedOk()
{
	
	// TODO:  在此添加控件通知处理程序代码

	
	GetDlgItemText(IDC_EDIT1, x);
	if (!(x != ""))
		AfxMessageBox(_T("横坐标起始位置不能为空！"));

	GetDlgItemText(IDC_EDIT3, y);
	if (!(y != ""))
		AfxMessageBox(_T("纵坐标起始位置不能为空！"));

	GetDlgItemText(IDC_EDIT4, bitmode);
	if (!(bitmode != ""))
		AfxMessageBox(_T("模式选择不能为空！"));

	GetDlgItemText(IDC_EDIT5, bitpath);
	if (!(x != ""))
		AfxMessageBox(_T("图片路径不能为空！"));

	
			DemClearBuffer(hprinter);
			DemSetup(hprinter, 100, 150, 2, 6, 1, 2, 0);
			DemBitMap(hprinter, _ttoi(x), _ttoi(y), _ttoi(bitmode), cstringtocharstring(bitpath));
			DemPrint(hprinter, 1,1);
}

void bitmap::OnBnClickedCancel()
{
	// TODO:  在此添加控件通知处理程序代码
	CDialogEx::OnCancel();
}
