#ifndef __MYCTROLTRL_H__
#define __MYCTROLTRL_H__
#define MYWNDCLASS "mycontrol"
#include <afxtempl.h>
class CMycontrol: public CWnd
{
private:
public:
static BOOL RegisterWndClass();
CMycontrol();
void customfun();//一个自定义方法
};
#endif
#include "StdAfx.h"
#include "mycontrol.h"
CMycontrol::CMycontrol()
{
CMycontrol::RegisterWndClass();
}
//注册控件RegisterWndClass格式是固定的不要记忆没有那个必要直接拷贝粘贴就可以。
CMycontrol::RegisterWndClass()
{
WNDCLASS windowclass;
HINSTANCE hInst = AfxGetInstanceHandle();
//Check weather the class is registerd already
if (!(::GetClassInfo(hInst, MYWNDCLASS, &windowclass)))
{
//If not then we have to register the new class
windowclass.style = CS_DBLCLKS;// | CS_HREDRAW | CS_VREDRAW;
windowclass.lpfnWndProc = ::DefWindowProc;
windowclass.cbClsExtra = windowclass.cbWndExtra = 0;
windowclass.hInstance = hInst;
windowclass.hIcon = NULL;
windowclass.hCursor = AfxGetApp()->LoadStandardCursor(IDC_ARROW);
windowclass.hbrBackground = ::GetSysColorBrush(COLOR_WINDOW);
windowclass.lpszMenuName = NULL;
windowclass.lpszClassName = MYWNDCLASS;
if (!AfxRegisterClass(&windowclass))
{
AfxThrowResourceException();
return FALSE;
}
}
return TRUE;
}
//自定义方法
void CMycontrol::customfun()
{
AfxMessageBox(_T("my control!"));
}
void CCustomcontrolDlg::OnButton1()
{
// TODO: Add your control notification handler code here
m_mycontrol.customfun();
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有