📄 designerdoc.cpp
字号:
// DesignerDoc.cpp : implementation of the CDesignerDoc class
//
#include "stdafx.h"
#include "Designer.h"
#include "DesignerDoc.h"
#include "DesignerView.h"
#include "DIB.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern HANDLE hDIB;
extern HANDLE hDIBDH;
extern DIB cDib;
/////////////////////////////////////////////////////////////////////////////
// CDesignerDoc
IMPLEMENT_DYNCREATE(CDesignerDoc, CDocument)
BEGIN_MESSAGE_MAP(CDesignerDoc, CDocument)
//{{AFX_MSG_MAP(CDesignerDoc)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDesignerDoc construction/destruction
CDesignerDoc::CDesignerDoc()
{
// TODO: add one-time construction code here
}
CDesignerDoc::~CDesignerDoc()
{
}
BOOL CDesignerDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CDesignerDoc serialization
void CDesignerDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
}
}
/////////////////////////////////////////////////////////////////////////////
// CDesignerDoc diagnostics
#ifdef _DEBUG
void CDesignerDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CDesignerDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CDesignerDoc commands
BOOL CDesignerDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
if (!CDocument::OnOpenDocument(lpszPathName))
return FALSE;
// TODO: Add your specialized creation code here
if(hDIB)
GlobalFree(hDIB);
hDIB = cDib.LoadDIB(lpszPathName);
if(!hDIB)
{
AfxMessageBox("OpenFile Error");
return false;
}
POSITION p = this->GetFirstViewPosition();
CDesignerView *view =(CDesignerView*) GetNextView(p);
view->bmpfirstload = true;
view->m_jwm =0;
view->m_ReduceColor = false;
view->m_DrawMode = OTHER;
view->m_Circle_Scr.IsValide = false;
view->m_RectsInfo.IsValide = false;
view->IsDaohangqiUsable = true;
if(view->m_Base_Create)
{
for(int i=0;i<view->m_LineNum.y;i++)
for(int j=0;j<view->m_LineNum.x;j++)
view->m_picture_edge[j][i] = false;
}
view->m_Base_Create = false;
LPBITMAPINFOHEADER lpbi;
lpbi = (LPBITMAPINFOHEADER)GlobalLock(hDIB);
cDib.width = lpbi->biWidth;
cDib.height = lpbi->biHeight;
GlobalUnlock(hDIB);
hDIBDH= cDib.CopyHandle(hDIB);
return TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -