VC++ STATIC 控件显示ICON 或者BITMAP


1.添加一个静态控件,设置控件 Notify 为True 可以响应单击事件

2。

		HICON hicon = LoadIcon(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDR_MAINFRAME));
		HBITMAP hbitmap = LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP1));
		CStatic *pStatic=(CStatic*)GetDlgItem(IDC_STABUTTON); 

 添加ICON

		pStatic-> ModifyStyle(0x0,SS_ICON|SS_CENTERIMAGE); 
		pStatic-> SetIcon(hicon);
添加BITMAP
		pStatic->ModifyStyle(0,SS_BITMAP|SS_CENTERIMAGE);
		pStatic->SetBitmap(hbitmap);



 

 

你可能感兴趣的:(vc++)