先用SetRowInfo()/SetColumnInfo()设置行列的信息。
然后RecalcLayout()
然后RecalcLayout()
解决方案 »
- vc 带tab的toolbar靠右停靠的实现
- 请问一下,如果开发类似单词通那样的软件,那词库应该用什么方式实现效率更好?
- 三叉切分单文档后的各视通信
- 如何向CString直接赋值int
- 如何获得光驱、软驱和蓝牙的产品名称?
- 迅雷,FlashGet等下载软件如何监视浏览器的下载点击的呢?
- 跪求各位给个答案,调试过程中出现的问题。
- 谁能帮我写一个关于基于二值图的区域生长算法?在线等待,分值不够,可以加。
- 问一下,在VC中用DWORD LPCTSTR BSTR等定义变量和用C++中的CHAR STRING * INT只类的比有什么好处啊?区别?
- 怎么让一幅位图放大、缩小的显示情况下不失真?我用StretchBlt函数缩小、放大时容易失真。
- 给具分
- VC6的workspace窗口不刷新是怎么回事?
//
/////////////////////////////////////////////////////////////////////////////#if !defined(AFX_CHILDFRM_H__7838DE2B_5056_11D5_8175_0050FCFF00CB__INCLUDED_)
#define AFX_CHILDFRM_H__7838DE2B_5056_11D5_8175_0050FCFF00CB__INCLUDED_#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CChildFrame : public CMDIChildWnd
{
DECLARE_DYNCREATE(CChildFrame)
public:
CChildFrame();// Attributes
public:// Operations
public:// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CChildFrame)
public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
//}}AFX_VIRTUAL// Implementation
public:
virtual ~CChildFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif// Generated message map functions
protected:
CSplitterWnd m_wndSplitter;
//{{AFX_MSG(CChildFrame)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};///////////////////////////////////////////////////////////////////////////////{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_CHILDFRM_H__7838DE2B_5056_11D5_8175_0050FCFF00CB__INCLUDED_)
这是cpp
// ChildFrm.cpp : implementation of the CChildFrame class
//#include "stdafx.h"
#include "Note.h"#include "ChildFrm.h"#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif/////////////////////////////////////////////////////////////////////////////
// CChildFrameIMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
//{{AFX_MSG_MAP(CChildFrame)
// 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()/////////////////////////////////////////////////////////////////////////////
// CChildFrame construction/destructionCChildFrame::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 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 handlersBOOL CChildFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
return m_wndSplitter.Create(this, 2, 1, CSize(20, 20), pContext,WS_CHILD|WS_VISIBLE|WS_VSCROLL|SPLS_DYNAMIC_SPLIT);
//return CMDIChildWnd::OnCreateClient(lpcs, pContext);
}这是CNoteView.cpp
// NoteView.cpp : implementation of the CNoteView class
//#include "stdafx.h"
#include "Note.h"#include "NoteDoc.h"
#include "NoteView.h"#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif/////////////////////////////////////////////////////////////////////////////
// CNoteViewIMPLEMENT_DYNCREATE(CNoteView, CEditView)BEGIN_MESSAGE_MAP(CNoteView, CEditView)
//{{AFX_MSG_MAP(CNoteView)
ON_COMMAND(ID_TOOLS_SETFONT, OnToolsSetfont)
ON_CONTROL_REFLECT(EN_CHANGE, OnChange)
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CEditView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CEditView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CEditView::OnFilePrintPreview)
END_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////
// CNoteView construction/destructionCNoteView::CNoteView()
{
// TODO: add construction code here
memset(&m_logfont, 0, sizeof(m_logfont));
m_nPointSize = 120;
_tcscpy(m_logfont.lfFaceName, _T("Fixedsys")); // start out with a system font CWindowDC dc(NULL);
m_logfont.lfHeight = ::MulDiv(m_nPointSize, dc.GetDeviceCaps(LOGPIXELSY), 720);
m_logfont.lfPitchAndFamily = FIXED_PITCH; m_pFont = new CFont;
m_pFont->CreateFontIndirect(&m_logfont);
}CNoteView::~CNoteView()
{
if (m_pFont != NULL)
delete m_pFont;
}BOOL CNoteView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs BOOL bPreCreated = CEditView::PreCreateWindow(cs);
cs.style &= ~(ES_AUTOHSCROLL|WS_HSCROLL); // Enable word-wrapping return bPreCreated;
}/////////////////////////////////////////////////////////////////////////////
// CNoteView drawingvoid CNoteView::OnDraw(CDC* pDC)
{
CNoteDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}/////////////////////////////////////////////////////////////////////////////
// CNoteView printingBOOL CNoteView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default CEditView preparation
return CEditView::OnPreparePrinting(pInfo);
}void CNoteView::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo)
{
// Default CEditView begin printing.
CEditView::OnBeginPrinting(pDC, pInfo);
}void CNoteView::OnEndPrinting(CDC* pDC, CPrintInfo* pInfo)
{
// Default CEditView end printing
CEditView::OnEndPrinting(pDC, pInfo);
}/////////////////////////////////////////////////////////////////////////////
// CNoteView diagnostics#ifdef _DEBUG
void CNoteView::AssertValid() const
{
CEditView::AssertValid();
}void CNoteView::Dump(CDumpContext& dc) const
{
CEditView::Dump(dc);
}CNoteDoc* CNoteView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CNoteDoc)));
return (CNoteDoc*)m_pDocument;
}
#endif //_DEBUG/////////////////////////////////////////////////////////////////////////////
// CNoteView message handlersvoid CNoteView::OnToolsSetfont()
{
// TODO: Add your command handler code here // let the user change their mind about the font
LOGFONT lfCopy;
memcpy(&lfCopy, &m_logfont, sizeof(lfCopy)); // pop up the existing font in the dialog CFontDialog dlg(&lfCopy);
dlg.m_cf.Flags |= CF_FORCEFONTEXIST | CF_FIXEDPITCHONLY; // if they say so, create the font and put it in a
// member variable for use later if (dlg.DoModal() == IDOK)
{
CFont* pFontCopy = new CFont;
if (pFontCopy->CreateFontIndirect(&lfCopy))
{
m_nPointSize = dlg.GetSize();
if (m_pFont != NULL)
delete m_pFont; m_pFont = pFontCopy;
memcpy(&m_logfont, &lfCopy, sizeof(lfCopy));
CNoteView::SetFont(m_pFont,TRUE);
Invalidate();
}
else
{
delete pFontCopy;
MessageBox(_T("不能创建新字体!"));
}
}
}//DEL void CNoteView::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
//DEL {
//DEL // TODO: Add your message handler code here and/or call default
//DEL CDocument* pDocument=GetDocument();
//DEL CNoteDoc* pDoc=GetDocument();
//DEL GetWindowText(pDoc->m_strText);
//DEL pDocument->UpdateAllViews(this,NULL,NULL);
//DEL CEditView::OnKeyUp(nChar, nRepCnt, nFlags);
//DEL }void CNoteView::OnInitialUpdate()
{
CEditView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
ShowScrollBar(1,FALSE); CNoteDoc* pDoc=GetDocument();
SetWindowText(pDoc->m_strText.GetBuffer(pDoc->m_strText.GetLength()));
}void CNoteView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
// TODO: Add your specialized code here and/or call the base class
CNoteDoc* pDoc = GetDocument();
SetWindowText(pDoc->m_strText.GetBuffer(pDoc->m_strText.GetLength()));
}void CNoteView::OnChange()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CEditView::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
CDocument* pDocument=GetDocument();
CNoteDoc* pDoc=GetDocument();
GetWindowText(pDoc->m_strText);
pDocument->UpdateAllViews(this,NULL,NULL);
pDoc->SetModifiedFlag(TRUE);
}