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

📄 inputbox.cpp

📁 一个多方面查询的系统,也是很辛苦找到,并且做管理系统很多方面都用到的
💻 CPP
字号:
// InputBox.cpp : implementation file
//

#include "stdafx.h"
#include "front.h"
#include "InputBox.h"
#include "MyLabel.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

extern CFrontApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CInputBox dialog


CInputBox::CInputBox(CWnd* pParent /*=NULL*/)
	: CDialog(CInputBox::IDD, pParent)
{
	//{{AFX_DATA_INIT(CInputBox)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	ClientWnd=new CMyWnd;
	RTButton=new CMyButton;
}


void CInputBox::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CInputBox)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CInputBox, CDialog)
	//{{AFX_MSG_MAP(CInputBox)
	ON_WM_ERASEBKGND()
	ON_WM_CREATE()
	ON_WM_SHOWWINDOW()
	ON_WM_NCHITTEST()
	ON_WM_DESTROY()
	ON_WM_CLOSE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CInputBox message handlers
UINT CInputBox::OnNcHitTest(CPoint point) 
{
	UINT nHitTest = CDialog::OnNcHitTest(point); 

    return (nHitTest == HTCLIENT)? HTCAPTION:nHitTest;
}

BOOL CInputBox::OnEraseBkgnd(CDC* pDC) 
{
	CRect rc;
	GetClientRect(&rc);
	//使用系统默认字体
	CFont * of = pDC->SelectObject(CFont::FromHandle((HFONT)GetStockObject(DEFAULT_GUI_FONT)));
	//所画东西不改变背景色
	int obk = pDC->SetBkMode(TRANSPARENT);
	//背景色
	CBrush *pOldBrush,brush;
	brush.CreateSolidBrush(crBackground);
	pOldBrush = pDC->SelectObject(&brush);
	//画一个轮廓框
	pDC->FillRect(rc,&brush);

	pDC->SetTextColor(RGB(243,243,243));
	if(WindowName)pDC->TextOut(5,5,WindowName);

	pDC->MoveTo(rc.left,rc.top+24);
	pDC->LineTo(rc.left+iWidth,rc.top+24);

	//TODO,自己做




	//恢复
	pDC->SelectObject(pOldBrush);
	pDC->SelectObject(of);
	pDC->SelectObject(&obk);
	return true;
}

int CInputBox::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CDialog::OnCreate(lpCreateStruct) == -1)
		return -1;

	// TODO: Add your specialized creation code here
	crBackground=RGB(108,149,239); //背景色
	bClose=false;  //关窗口的信号量

	bIsClickOkButton=false;

	CRect ClientRc,rc;
	GetClientRect(&ClientRc);

	rc.SetRect(ClientRc.left,ClientRc.top+25,ClientRc.left+iWidth,ClientRc.top+iHight+200);
	ClientWnd->SetOwner(this);
	ClientWnd->sSeverAddress.Format("%s",theApp.sServerAddr);
	ClientWnd->Create(WS_CHILD|WS_VISIBLE, rc, this,IDC_CLIENTWND,ClientFlag);
	

	rc.SetRect(ClientRc.left+iWidth-78,ClientRc.top,ClientRc.left+iWidth,ClientRc.top+22);
	RTButton->SetOwner(ClientWnd);
	RTButton->Create(WS_CHILD|WS_VISIBLE, rc, this,IDC_RIGHTTITLE,RTFlag);	

	return 0;
}


void CInputBox::OnShowWindow(BOOL bShow, UINT nStatus) 
{
	CDialog::OnShowWindow(bShow, nStatus);
	
	// TODO: Add your message handler code here
	CRect rc;
	GetWindowRect(&rc);
	rc.right = rc.left + iWidth;
	rc.bottom = rc.top + iHight;
	MoveWindow(&rc,TRUE);
}

BOOL CInputBox::PreTranslateMessage(MSG* pMsg) 
{
 	if (pMsg->wParam == VK_ESCAPE||pMsg->wParam == VK_RETURN)return TRUE;
 	
 	return CDialog::PreTranslateMessage(pMsg);
}

void CInputBox::OnDestroy() 
{
	CDialog::OnDestroy();
	
	// TODO: Add your message handler code here
}


void CInputBox::SetWindowName(char *name)
{
	if (name)
	{
		WindowName = new char[lstrlen(name)+1];
		ASSERT(WindowName);
		lstrcpy(WindowName, name);
	}
}




void CInputBox::OnClose() 
{
	// TODO: Add your message handler code here and/or call default
	bClose=true;

	CDialog::OnClose();
}

CInputBox::~CInputBox()
{
	if(lstrlen(WindowName)>0)delete WindowName;
	delete RTButton;
	delete ClientWnd;
}

⌨️ 快捷键说明

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