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

📄 yasuodlg.cpp

📁 可以选择各种压缩方式对读入的图像进行压缩和解压
💻 CPP
字号:
// YasuoDlg.cpp : implementation file
//

#include "stdafx.h"
#include "JPEGEQ.h"
#include "YasuoDlg.h"


// YasuoDlg dialog

IMPLEMENT_DYNAMIC(YasuoDlg, CDialog)

YasuoDlg::YasuoDlg(CWnd* pParent /*=NULL*/)
	: CDialog(YasuoDlg::IDD, pParent)
	, QuantiMode(-1)
	, srcfilename(_T(""))
	, dstfilename(_T(""))
	, Adapornot(FALSE)
{

}

YasuoDlg::~YasuoDlg()
{
}

void YasuoDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Radio(pDX, IDC_RADIO1, QuantiMode);
	DDV_MinMaxInt(pDX, QuantiMode, -1, 4);
	DDX_Text(pDX, IDC_EDIT1, srcfilename);
	DDX_Text(pDX, IDC_EDIT2, dstfilename);
	DDX_Radio(pDX, IDC_RADIO5, Adapornot);
}


BEGIN_MESSAGE_MAP(YasuoDlg, CDialog)
	ON_BN_CLICKED(IDC_BUTTON1, &YasuoDlg::OnBnClickedButton1)
	ON_BN_CLICKED(IDC_BUTTON2, &YasuoDlg::OnBnClickedButton2)
	ON_BN_CLICKED(IDOK, &YasuoDlg::OnBnClickedOk)
	ON_BN_CLICKED(IDCANCEL, &YasuoDlg::OnBnClickedCancel)
	//ON_BN_CLICKED(IDC_RADIO7, &YasuoDlg::OnBnClickedRadio7)
END_MESSAGE_MAP()


// YasuoDlg message handlers

void YasuoDlg::OnBnClickedButton1()
{
	// TODO: Add your control notification handler code here
    UpdateData();
	CString temp="bmp图像文件 (*.bmp) | *.bmp|所有文件 (*.*) | *.*||";;
	if(QuantiMode==-1)
	{
		MessageBox("错误:未选择操作","错误",MB_OK); 
		return;
	}

	CFileDialog dlg(TRUE, "BMP", srcfilename, OFN_HIDEREADONLY, 
		temp, NULL);

	
	// 提示用户选择打开的路径
	if (dlg.DoModal() != IDOK)
	{
		// 返回
		return;
	}
	
	// 获取用户指定的文件路径
	srcfilename = dlg.GetPathName();
	
	// 更新
	UpdateData(FALSE);
}

void YasuoDlg::OnBnClickedButton2()
{
	// TODO: Add your control notification handler code here
	UpdateData();
	CString temp="mjp编码文件 (*.mjp) | *.mjp|所有文件 (*.*) | *.*||";;
	if(QuantiMode==-1)
	{
		MessageBox("错误:未选择操作","错误",MB_OK); 
		return;
	}
	CFileDialog dlg(FALSE, "mjp", dstfilename, OFN_HIDEREADONLY, 
		temp, NULL);
	
	// 提示用户选择保存的路径
	if (dlg.DoModal() != IDOK)
	{
		// 返回
		return;
	}
	
	// 获取用户指定的文件路径
	
	CFileFind fFind;
		if (fFind.FindFile(dlg.GetPathName(), 0) != 0)
	{
		// 询问用户是否覆盖
		if (MessageBox("指定的文件已经存在,是否覆盖?", "系统提示", 
			MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2) != IDYES)
		{
			// 退出
			return;
		}
	}

	dstfilename = dlg.GetPathName();
	// 更新
	UpdateData(FALSE);
}

void YasuoDlg::OnBnClickedOk()
{
	// TODO: Add your control notification handler code here
	UpdateData();
	OnOK();
}

void YasuoDlg::OnBnClickedCancel()
{
	// TODO: Add your control notification handler code here
	OnCancel();
}

⌨️ 快捷键说明

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