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

📄 childfrm.cpp

📁 主要是应用VC进行傅立叶变换和反变换的程序
💻 CPP
字号:
// ChildFrm.cpp : implementation of the CChildFrame class
//

#include "stdafx.h"
#include "bmpDemo.h"
#include "bmpDemoDoc.h"

#include "ChildFrm.h"
#include "MainFrm.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)
	//{{AFX_MSG_MAP(CChildFrame)
	ON_WM_SIZE()
	ON_WM_GETMINMAXINFO()
	ON_WM_MDIACTIVATE()
	ON_WM_CLOSE()
	ON_WM_DESTROY()
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CChildFrame construction/destruction

CChildFrame::CChildFrame()
{
	// TODO: add member initialization code here
}

CChildFrame::~CChildFrame()
{
}

BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	cs.style&=~WS_MAXIMIZEBOX;
	cs.style&=~WS_MINIMIZEBOX;
//	cs.style &= ~FWS_ADDTOTITLE;
//	cs.style&=~WS_THICKFRAME;
	if( !CMDIChildWnd::PreCreateWindow(cs) )
		return FALSE;

	return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// 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::OnSize(UINT nType, int cx, int cy) 
{
	CMDIChildWnd::OnSize(nType, cx, cy);
	
	// TODO: Add your message handler code here
	
}

void CChildFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) 
{
	// TODO: Add your message handler code here and/or call default
	//控制图象窗口的大小,不超过图象大小
/*    CRect rectWindow;
    GetWindowRect(&rectWindow);
    CRect rectClient;
    GetClientRect(&rectClient);
      // get offset of toolbars, scrollbars, etc.
    int nWidthOffset = rectWindow.Width() - rectClient.Width();
    int nHeightOffset = rectWindow.Height() - rectClient.Height();
	CBmpDemoDoc *pDoc=(CBmpDemoDoc *)GetActiveDocument();
	if(pDoc)
	{
		int cx=pDoc->m_mBmp.GetDispWidth();
		int cy=pDoc->m_mBmp.GetDispHeight();
		lpMMI->ptMinTrackSize.x = nWidthOffset;
		lpMMI->ptMinTrackSize.y = nHeightOffset;
		lpMMI->ptMaxTrackSize.x = nWidthOffset+cx+4;
		lpMMI->ptMaxTrackSize.y = nHeightOffset+cy+4; ;
	}
*/	CMDIChildWnd::OnGetMinMaxInfo(lpMMI);
}

void CChildFrame::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd) 
{
	//激活或休眠文档时,修改状态条的当前图象名
    CStatusBar* pStatus=(CStatusBar*)
	      AfxGetApp()->m_pMainWnd->GetDescendantWindow(AFX_IDW_STATUS_BAR);
	CBmpDemoDoc* pDoc = (CBmpDemoDoc*)GetActiveDocument();
	ASSERT_VALID(pDoc);
	if(pStatus)
	{
		if(bActivate)
		{
			CString str;
//			str="当前图象名:"+pDoc->GetTitle();
//			pStatus->SetPaneText(1,str);
			int x=(int)(pDoc->m_mBmp.GetScale()*100);
			str.Format("%i%%",x);
			pStatus->SetPaneText(3,str);
		}
		else
		{
			CBmpDemoDoc* pDoc = (CBmpDemoDoc*)GetActiveDocument();
			ASSERT_VALID(pDoc);
			pStatus->SetPaneText(1,"");
			pStatus->SetPaneText(2,"");
			pStatus->SetPaneText(3,"");
		}
	}
	//激活文档时,根据图象工具栏的状态及系统的设置
	//来显示工具栏
/*	if(bActivate)
	{
		CMainFrame *pframe=(CMainFrame*)GetParentFrame();
		CBmpDemoApp *app=(CBmpDemoApp *)AfxGetApp();
		if(!pframe->m_wToolBar.IsWindowVisible() &&\
			app->m_ViewToolBar1)
		{
			pframe->DockControlBar(&pframe->m_wToolBar,AFX_IDW_DOCKBAR_RIGHT);
			pframe->ShowControlBar(&pframe->m_wToolBar,TRUE,FALSE);
		}
	}
*/
	CMDIChildWnd::OnMDIActivate(bActivate, pActivateWnd, pDeactivateWnd);
}

void CChildFrame::OnClose() 
{
	// TODO: Add your message handler code here and/or call default
	CMDIChildWnd::OnClose();
}


void CChildFrame::OnDestroy() 
{
	//窗口关闭后,隐藏图象工具栏
	CMDIChildWnd::OnDestroy();
	CMainFrame *pframe=(CMainFrame*)GetParentFrame();
	CFrameWnd *CurFrame=pframe->GetActiveFrame();
	if(pframe==CurFrame)
	{
		if(pframe->m_wToolBar.IsWindowVisible())
		{
			pframe->ShowControlBar(&pframe->m_wToolBar,FALSE,FALSE);
		}
	}
}


void CChildFrame::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	CMainFrame *pframe=(CMainFrame*)GetParentFrame();
	CBmpDemoApp *app=(CBmpDemoApp *)AfxGetApp();
	if(!pframe->m_wToolBar.IsWindowVisible() &&\
		app->m_ViewToolBar1)
	{
		pframe->DockControlBar(&pframe->m_wToolBar,AFX_IDW_DOCKBAR_RIGHT);
		pframe->ShowControlBar(&pframe->m_wToolBar,TRUE,FALSE);
	}
}

⌨️ 快捷键说明

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