windowedit.cpp

来自「骨骼动画....把魔兽模型解出的代码..」· C++ 代码 · 共 55 行

CPP
55
字号
//+-----------------------------------------------------------------------------
//| Included files
//+-----------------------------------------------------------------------------
#include "WindowEdit.h"


//+-----------------------------------------------------------------------------
//| Constructor
//+-----------------------------------------------------------------------------
WINDOW_EDIT::WINDOW_EDIT()
{
	//Empty
}


//+-----------------------------------------------------------------------------
//| Destructor
//+-----------------------------------------------------------------------------
WINDOW_EDIT::~WINDOW_EDIT()
{
	//Empty
}


//+-----------------------------------------------------------------------------
//| Creates an edit window
//+-----------------------------------------------------------------------------
BOOL WINDOW_EDIT::Create(CONST WINDOW_EDIT_INFO& NewEditInfo)
{
	HFONT Font;

	Destroy();

	EditInfo = NewEditInfo;

	if(EditInfo.HorizontalScroll) EditInfo.Style |= (WS_HSCROLL | ES_AUTOHSCROLL);
	if(EditInfo.VerticalScroll) EditInfo.Style |= (WS_VSCROLL | ES_AUTOVSCROLL);
	if(EditInfo.Multiline) EditInfo.Style |= (ES_MULTILINE | ES_WANTRETURN);
	if(EditInfo.ReadOnly) EditInfo.Style |= ES_READONLY;

	Window = CreateWindowEx(0, "EDIT", EditInfo.Text.c_str(), EditInfo.Style,
							EditInfo.X, EditInfo.Y, EditInfo.Width, EditInfo.Height,
							EditInfo.Parent, NULL, GetModuleHandle(NULL), NULL);
	if(Window == NULL)
	{
		Error.SetMessage("Unable to create an edit window!");
		return FALSE;
	}

	Font = CreateFont(0, 8, 0, 0, FW_NORMAL, 0, 0, 0, 0, 0, 0, 0, 0, "Fixedsys");
	if(Font != NULL) ::SendMessage(Window, WM_SETFONT, reinterpret_cast<WPARAM>(Font), 0);

	return TRUE;
}

⌨️ 快捷键说明

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