📄 childview.cpp
字号:
// ChildView.cpp : implementation of the CChildView class
//
#include "stdafx.h"
#include "..\nana\Glib.h"
#include "..\nana\Wnd.h"
#include "..\nana\ppButton.h"
#include "..\nana\ppMenu.h"
#include "..\nana\ppCalendar.h"
#include "..\nana\ppMessageBox.h"
#include "..\nana\ppADJInputBox.h"
#include "..\nana\ppListView.h"
#include "eeb_LinkWnd.h"
#include "eeb_MainPage.h"
#include "nana_test.h"
#include "ChildView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CChildView
class NANA_Password:public NANAFrameWnd
{
public:
NANAButton w_butOK;
NANAButton w_butCancel;
virtual void OnCreate ()
{
NANARect rc;
GetWindowRect(&rc);
w_butOK.CreateWnd(this,250,170,60,25);
w_butOK.SetCaption("确定");
w_butCancel.CreateWnd(this,250,170,60,25);
w_butCancel.SetCaption("取消");
}
};
class NANATestWnd :public NANAFrameWnd
{
public:
NANAButton w_butOK;
NANAButton w_butCancel;
NANAMenu w_Menu;
NANACalendar w_cal;
NANAMessageBox w_msgbox;
NANAADJInputBox w_inputBox;
NANATestWnd()
{
}
virtual void OnCreate ()
{
w_Menu.AddItem("Hello1xxxxxxxxxxxxxxxx",ICON16_OPEN);
w_Menu.AddItem("Hello2",ICON16_SAVE);
w_Menu.AddItem("Hello3",ICON16_NEW);
w_Menu.AddItem("你好1");
w_cal.CreateWnd(this,50,50,150,150,UGWS_VISIBLE,0,&NANA_FONT12);
w_butOK.CreateWnd(this,10,3,60,20);
w_butOK.SetCaption("确定");
w_butOK.SetIcon(1);
w_butCancel.CreateWnd(this,100,3,50,20);
w_butCancel.SetCaption("取消");
}
virtual void OnPaint()
{
NANARect rc;
GetWindowRect(&rc);
//Rect(rc.w_nX1,rc.w_nY1,rc.w_nX2,rc.w_nY2,COLOR_BKGROUND,COLOR_BKGROUND);
//TextPrint("Hello!你好,大家good才",10,10,&NANA_FONT12,0);
}
virtual void OnNotify(NANAWnd *pSrcWnd,int nMessageCode,int nParam1,int nParam2)
{
if(pSrcWnd == &w_butOK)
{
w_butOK.SetIcon(2);
w_Menu.Show(this,&w_butOK,MENU_ALIGN_VER_BOTTOM|MENU_ALIGN_VER_OUTER|MENU_ALIGN_HOR_LEFT|MENU_ALIGN_HOR_INNER);
}
if(pSrcWnd == &w_butCancel)
{
//MessageBox(NULL,"Hello","",MB_OK);
w_inputBox.Show(this,"温度","",3,1,100,100,100);
}
if(pSrcWnd == &w_Menu)
{
CString strInfo;
strInfo.Format("Menu select :%d",nParam1);
w_msgbox.Show( this,"对话Dialog",strInfo,3,ICON32_INFORMATION);
//MessageBox(NULL,strInfo,"",MB_OK);
}
}
};
CChildView::CChildView()
{
NANAGUI_Init();
NANA_StartWnd * ptest;
ptest = new NANA_StartWnd;
ptest->CreateWnd(NULL,0,0,320,240);
}
CChildView::~CChildView()
{
}
BEGIN_MESSAGE_MAP(CChildView,CWnd )
//{{AFX_MSG_MAP(CChildView)
ON_WM_PAINT()
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_TIMER()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CChildView message handlers
void CChildView::OnLButtonDown(UINT nFlags, CPoint point)
{
NANADeskTopWnd::Instance()->DispatchMouseMessage(UGRW_MOUSE_DOWN,point.x,point.y);
}
void CChildView::OnLButtonUp(UINT nFlags, CPoint point)
{
NANADeskTopWnd::Instance()->DispatchMouseMessage(UGRW_MOUSE_UP,point.x,point.y);
}
void CChildView::OnTimer(UINT nIDEvent)
{
NANADeskTopWnd::Instance()->DispatchTimeCntDown();
}
BOOL CChildView::PreCreateWindow(CREATESTRUCT& cs)
{
if (!CWnd::PreCreateWindow(cs))
return FALSE;
cs.dwExStyle |= WS_EX_CLIENTEDGE;
cs.style &= ~WS_BORDER;
cs.lpszClass = AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS,
::LoadCursor(NULL, IDC_ARROW), HBRUSH(COLOR_WINDOW+1), NULL);
return TRUE;
}
void CChildView::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
//ButtonFrame(50,10,60,20,2);
//RoundRectangle_little(50,10,100,100);
//RoundRectangle_Big(50,10,100,100,0);
//RectLine(50,10,100,100,1);
//Rect(50,10,100,100,0,1);
//RectLine(10,10,10+GetTextWidth("Hello!你好,大家good才",&NANA_FONT12,-1),100,1);
//TextPrint("Hello!你好,大家good才",10,10,&NANA_FONT12,0);
//RoundWindowFrame(10,10,100,100,1,20);
CBrush br(RGB(200,200,200));
CRect rc;
GetClientRect(&rc);
rc.right=SCREEN_WIDTH+1;
rc.bottom = SCREEN_HEIGHT+1;
// dc.Rectangle(&rc);
NANADeskTopWnd::Instance()->UpdateUI();
}
BOOL CChildView::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
BOOL bRet = CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
SetTimer(0,100,NULL);
return bRet;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -