Home > Software engineering >  VC how to custom controls?
VC how to custom controls?

Time:09-26

VC how to custom controls?

CodePudding user response:

Sign up for a class name such as
 
//CMyAnimateCtrl
BOOL CMyAnimateCtrl: : RegisterMyself ()
{//Register the window class if it has not already had registered.
WNDCLASS wc.
HINSTANCE hInst=AfxGetInstanceHandle ();
if(! (: : GetClassInfo (hInst, "MySysAnimate32", & amp; Wc)))
{//otherwise we need to register a new class, must have CS_OWNDC!
Wc. Style=CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;//| CS_OWNDC;//| CS_GLOBALCLASS;
Wc. LpfnWndProc=: : DefWindowProc;
Wc. CbClsExtra=0;
Wc. CbWndExtra=0;//SPINCUBE_EXTRA;//=4
The wc. The hInstance hInst=;
Wc. HIcon=NULL;
Wc. HCursor=LoadCursor (NULL, IDC_ARROW);
Wc. HbrBackground=NULL;
Wc. LpszMenuName=(LPSTR) NULL;
Wc. LpszClassName=(LPSTR) "MySysAnimate32";
if (! AfxRegisterClass (& amp; Wc))
{
AfxMessageBox (" Register a custom control failed!" );
return FALSE;
}
}
return TRUE;
}

CodePudding user response:

https://www.baidu.com/baidu? Wd=MFC + ActiveX& Tn=monline_4_dg & amp; Ie=utf-8

CodePudding user response:

CodePudding user response:

Generally derived from existing classes, like Windows, buttons, in the above redrawn, rewrite the DrawItem, or directly in the OnPaint, other similar to the mouse click operation, add a message response

CodePudding user response:

Many are directly pulled apart, if is to custom, the OnPaint function directly to the written again
  • Related