📄 onfilesaveas.txt
字号:
void CDipDoc::OnfileSaveAs()
{
//TODO::Add your command handler code here
static int nIndex=1;
CFileDialog DialogSaveAs(FALSE,NULL,m_pDibObject->GetImageName(),OFN_HIDEREADONLY,szFilter);
DialogSaveAs.m_ofn.nFilterIndex=(DWORD)nIndex;
if(DialogSaveAs.DoModal()==IDOK)
{
CMainFram*pMainFram=(CMainFrame*)AfxGetMainWnd();
CChildFrame*pChildFrame=(CChildFrame*)pMainFrame->MDIGetActive();
CDipView*pDipView=(CDipView*)pChildFrame->GetActiveFrame();
nIndex=(int)DialogSaveAs.m_ofn.nFilterIndex;
if(nIndex==5)
{
if(m_pDibObject->GetNumBits()!=24)
{
AfxMessageBox("必须是24位真彩色图像才能存为JPEG格式!");
return;
}
}
if(m_pDibObject!=NULL)
{
CString strPathName=DialogSaveAs.GetPathName();
int nFindIndex=strPathName.Find(".");
if(nFindIndex!=-1)
strPathName=strPathName.Left(nFindIndex);
strPathName+=CDibObject::szExtensions[nIndex-1];
//m_pDibObject->ProcessImageHeader();
//m_pDibObject->ProcessPalette();
m_pDibObject->Save(strPathName);
CString strFileName=DialogSaveAs.GetFileName();
nFindIndex=strFileName.Find(".");
if(nFindIndex!=-1)
strFileName=strFileName.Left(nFindIndex);
strFileName+=CDibObject::szExtensions[nIndex-1];
pChildFrame->SetWindowText(strFileName);
SetPathName(strPathName);
if(nIndex==5)
{
m_pDibObject->Load(strPathName);
pDipView->InvalidateRect(NULL,FALSE);
pDipView->UpdateWindow();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -