📄 childfrm.cpp
字号:
// ChildFrm.cpp : implementation of the CChildFrame class
//
#include "stdafx.h"
#include "ImageLAB.h"
#include "MainFrm.h"
#include "ChildFrm.h"
#include "AllImage.h"
#include "ImageLABDoc.h"
#include "ImageLABView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CChildFrame
IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)
BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
ON_WM_INITMENUPOPUP()
ON_WM_MENUSELECT()
//{{AFX_MSG_MAP(CChildFrame)
ON_WM_GETMINMAXINFO()
ON_WM_CREATE()
ON_WM_MOVE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CChildFrame construction/destruction
CChildFrame::CChildFrame()
{
// TODO: add member initialization code here
}
CChildFrame::~CChildFrame()
{
}
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
//cs.style = WS_CHILD | WS_VISIBLE | WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU
// | FWS_ADDTOTITLE | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_MAXIMIZE;
cs.cy = int(::GetSystemMetrics(SM_CYSCREEN) *0.75);
cs.cx = int(::GetSystemMetrics(SM_CXSCREEN) *0.75);
cs.y = 0; cs.x = 0;
return CMDIChildWnd::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CChildFrame diagnostics
#ifdef _DEBUG
void CChildFrame::AssertValid() const
{
CMDIChildWnd::AssertValid();
}
void CChildFrame::Dump(CDumpContext& dc) const
{
CMDIChildWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CChildFrame message handlers
void CChildFrame::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu)
{
CMDIChildWnd::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu);
// CG: The following block was inserted by 'Status Bar' component.
{
GetParentFrame()->PostMessage(WM_INITMENUPOPUP,
(WPARAM)pPopupMenu->GetSafeHmenu(), MAKELONG(nIndex, bSysMenu));
}
}
void CChildFrame::OnMenuSelect(UINT nItemID, UINT nFlags, HMENU hSysMenu)
{
CMDIChildWnd::OnMenuSelect(nItemID, nFlags, hSysMenu);
// CG: The following block was inserted by 'Status Bar' component.
{
static BOOL bMenuActive = FALSE;
if (bMenuActive || hSysMenu != NULL)
{
GetParentFrame()->PostMessage(WM_MENUSELECT,
MAKELONG(nItemID, nFlags), (LPARAM)hSysMenu);
}
bMenuActive = hSysMenu != NULL;
}
}
void CChildFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
{
CScrollView* pView=(CScrollView*)GetActiveView();
CMainFrame *pMainFrame = (CMainFrame *)AfxGetMainWnd();
if(pView)
{
ASSERT(pView->IsKindOf(RUNTIME_CLASS(CScrollView)));
DWORD dwExStyle=pView->GetExStyle();
CRect rect(CPoint(0,0),pView->GetTotalSize()),
MainClientrect,
Viewrect;
CalcWindowRect(rect);
pMainFrame->GetClientRect(&MainClientrect);
GetWindowRect(&Viewrect);
CSize size;
size.cx = rect.Width();
size.cy = rect.Height();
if(dwExStyle&WS_EX_CLIENTEDGE)
{
size.cx += 4;
size.cy += 4;
}
if(GetExStyle()&WS_EX_CLIENTEDGE)
{
size.cx += 4;
size.cy += 4;
}
CRect StatusBarRect;
m_bar.GetWindowRect(StatusBarRect);
size.cy += StatusBarRect.Height();
if(MainClientrect.Height()<size.cy)
size.cx += 20;
else if(Viewrect.Height()<(size.cy-4) && MainClientrect.Width()>(size.cx+20) )
size.cx += 20;
lpMMI->ptMaxTrackSize.x = size.cx;
lpMMI->ptMaxTrackSize.y = size.cy;
}
CMDIChildWnd::OnGetMinMaxInfo(lpMMI);
}
static UINT BASED_CODE indicators[] =
{
ID_INDICATOR_IMAGEPIXELS,
ID_INDICATOR_IMAGESCALE,
};
int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
m_bar.Create(this,WS_CHILD|WS_VISIBLE|CBRS_BOTTOM,101);
m_bar.SetIndicators(indicators,sizeof(indicators)/sizeof(UINT));
CRect StatusBarRect;
m_bar.GetWindowRect(StatusBarRect);
m_BarHeight = StatusBarRect.Height();
/*memset(&m_lf,0,sizeof(LOGFONT));
m_lf.lfHeight=15;
m_lf.lfWeight=18;
strcpy(m_lf.lfFaceName, "黑体");
VERIFY(m_font.CreateFontIndirect(&m_lf));
m_bar.SetFont(&m_font); //*/
return 0;
}
void CChildFrame::OnMove(int x, int y)
{
CMDIChildWnd::OnMove(x, y);
// TODO: Add your message handler code here
CImageLABView* pView=(CImageLABView*)GetActiveView();
if(pView!=NULL)
{
if(!pView->bFreeze)
{
pView->CG200Show(false);
pView->ReSetDisplayPos();
pView->CG200Show();
}
else
{
pView->ReSetDisplayPos();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -