?? goto.cpp
字號:
// Goto.cpp : implementation file
//
#include "stdafx.h"
#include "ebook.h"
#include "Goto.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// Goto dialog
CString str;
Goto::Goto(CWnd* pParent /*=NULL*/)
: CDialog(Goto::IDD, pParent)
{
//{{AFX_DATA_INIT(Goto)
m_goedit = _T("");
//}}AFX_DATA_INIT
}
void Goto::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(Goto)
DDX_Control(pDX, IDC_STATIC1, m_gostatic);
DDX_Control(pDX, IDC_EDIT1, m_goedit1);
DDX_Text(pDX, IDC_EDIT1, m_goedit);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(Goto, CDialog)
//{{AFX_MSG_MAP(Goto)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
ON_BN_CLICKED(IDC_BUTTON5, OnButton5)
ON_BN_CLICKED(IDC_BUTTON6, OnButton6)
ON_BN_CLICKED(IDC_BUTTON7, OnButton7)
ON_BN_CLICKED(IDC_BUTTON8, OnButton8)
ON_BN_CLICKED(IDC_BUTTON9, OnButton9)
ON_BN_CLICKED(IDC_BUTTON10, OnButton10)
ON_BN_CLICKED(IDC_BUTTON11, OnButton11)
ON_WM_LBUTTONUP()
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// Goto message handlers
BOOL Goto::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
SetWindowPos(NULL,0,0,371,425,SWP_SHOWWINDOW );
m_gostatic.SetWindowPos(NULL,74,69,80,30,SWP_SHOWWINDOW );
m_goedit1.SetWindowPos(NULL,190,69,80,30,SWP_SHOWWINDOW );
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void Goto::OnPaint()
{
CPaintDC dc(this); // device context for painting
CDC memory;
mycbitmap=new CBitmap;
mycbitmap->LoadBitmap(IDB_BITMAP3);
memory.CreateCompatibleDC(&dc);
memory.SelectObject(mycbitmap);
RECT myrect;
GetWindowRect(&myrect);
dc.BitBlt(0,0,myrect.right-myrect.left,myrect.bottom-myrect.top,&memory,0,0,SRCCOPY);
//***********畫字體***********//
// dc.SetTextColor(RGB(0,0,255));
// CFont ft;
// ft.CreateFont(
// 25, // nHeight
// 0, // nWidth
// 0, // nEscapement
// 0, // nOrientation
// FW_NORMAL, // nWeight
// FALSE, // bItalic
// FALSE, // bUnderline
// 0, // cStrikeOut
// ANSI_CHARSET, // nCharSet
// OUT_DEFAULT_PRECIS, // nOutPrecision
// CLIP_DEFAULT_PRECIS, // nClipPrecision
// DEFAULT_QUALITY, // nQuality
// DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily
// _T("Arial"));
// dc.SelectObject(&ft);
// dc.SetBkMode(TRANSPARENT); //設置字體背景為透明
// RECT fontrect={74,69,180,200};
// dc.DrawText(L"請輸入頁數",&fontrect,DT_CENTER|DT_VCENTER);
// ft.DeleteObject();
// TODO: Add your message handler code here
// Do not call CDialog::OnPaint() for painting messages
}
void Goto::OnButton1()
{
// TODO: Add your control notification handler code here
str=str+L"1";
m_goedit=str;
UpdateData(FALSE);
}
void Goto::OnButton2()
{
// TODO: Add your control notification handler code here
str=str+L"2";
m_goedit=str;
UpdateData(FALSE);
}
void Goto::OnButton3()
{
// TODO: Add your control notification handler code here
str=str+L"3";
m_goedit=str;
UpdateData(FALSE);
}
void Goto::OnButton4()
{
// TODO: Add your control notification handler code here
str=str+L"4";
m_goedit=str;
UpdateData(FALSE);
}
void Goto::OnButton5()
{
// TODO: Add your control notification handler code here
str=str+L"5";
m_goedit=str;
UpdateData(FALSE);
}
void Goto::OnButton6()
{
// TODO: Add your control notification handler code here
str=str+L"6";
m_goedit=str;
UpdateData(FALSE);
}
void Goto::OnButton7()
{
// TODO: Add your control notification handler code here
str=str+L"7";
m_goedit=str;
UpdateData(FALSE);
}
void Goto::OnButton8()
{
// TODO: Add your control notification handler code here
str=str+L"8";
m_goedit=str;
UpdateData(FALSE);
}
void Goto::OnButton9()
{
// TODO: Add your control notification handler code here
str=str+L"9";
m_goedit=str;
UpdateData(FALSE);
}
void Goto::OnButton10()
{
// TODO: Add your control notification handler code here
str=str+L"0";
m_goedit=str;
UpdateData(FALSE);
}
void Goto::OnButton11()
{
// TODO: Add your control notification handler code here
str=L"";
SetDlgItemText(IDC_EDIT1,L"");
}
BOOL Goto::InRect(int left, int top, int right, int bottom, int px, int py)
{
if((left < 0) || (left > 800))
return FALSE;
if((right < 0) || (right > 800))
return FALSE;
if((top < 0) || (top > 480))
return FALSE;
if((bottom < 0) || (bottom > 480))
return FALSE;
if((px < 0) || (px > 800))
return FALSE;
if((py < 0) || (py > 480))
return FALSE;
if((px>=left)&&(px<=right) && (py>=top)&&(py<=bottom))
return TRUE;
return FALSE;
}
void Goto::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if (InRect(74,131,108,159,point.x,point.y))
{
OnButton1();
}
if (InRect(164,130,200,158,point.x,point.y))
{
OnButton2();
}
if (InRect(255,131,288,160,point.x,point.y))
{
OnButton3();
}
if (InRect(73,204,108,203,point.x,point.y))
{
OnButton4();
}
if (InRect(160,201,196,288,point.x,point.y))
{
OnButton5();
}
if (InRect(253,204,290,230,point.x,point.y))
{
OnButton6();
}
if (InRect(72,276,107,299,point.x,point.y))
{
OnButton7();
}
if (InRect(161,273,198,301,point.x,point.y))
{
OnButton8();
}
if (InRect(251,276,288,302,point.x,point.y))
{
OnButton9();
}
if (InRect(71,349,109,374,point.x,point.y))
{
OnButton10();
}
if (InRect(162,349,196,375,point.x,point.y))
{
OnButton11();
}
if (InRect(253,347,288,374,point.x,point.y))
{
OnOK();
}
CDialog::OnLButtonUp(nFlags, point);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -