15,978
社区成员
发帖
与我相关
我的任务
分享
BOOL CCalendarDlg::OnInitDialog()
CBitmap bmp;
bmp.LoadBitmap(m_nBkResID);
m_brBk.CreatePatternBrush(&bmp);
bmp.DeleteObject();
void CCalendarDlg::OnBnClickedChangebk()
{
// TODO: 在此添加控件通知处理程序代码
if ( m_nBkResID == IDB_BK1)
{
m_nBkResID = IDB_BK2;
}
else if(m_nBkResID == IDB_BK2)
{
m_nBkResID = IDB_BK3;
}
else
{
m_nBkResID = IDB_BK1;
}
OnInitDialog();
Invalidate(TRUE);
}
BOOL CCalendarDlg::OnInitDialog()
SetWindowLong(this->GetSafeHwnd(),GWL_EXSTYLE,
GetWindowLong(this->GetSafeHwnd(),GWL_EXSTYLE)^0x80000);
HINSTANCE hInst = LoadLibrary("User32.DLL");
if(hInst)
{
typedef BOOL (WINAPI *MYFUNC)(HWND,COLORREF,BYTE,DWORD);
MYFUNC fun = NULL;
//取得SetLayeredWindowAttributes函数指针
fun=(MYFUNC)GetProcAddress(hInst, "SetLayeredWindowAttributes");
if(fun)
fun(this->GetSafeHwnd(),0,200,2);
FreeLibrary(hInst);
}
void CCalendarDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
BYTE m=(BYTE)m_sld.GetPos();
HINSTANCE hInst = LoadLibrary("User32.DLL");
if(hInst)
{
typedef BOOL (WINAPI *MYFUNC)(HWND,COLORREF,BYTE,DWORD);
MYFUNC fun = NULL;
fun=(MYFUNC)GetProcAddress(hInst, "SetLayeredWindowAttributes"); //取得SetLayeredWindowAttributes函数指针
if(fun)
fun(AfxGetMainWnd()->GetSafeHwnd(),0,m*2,2);
FreeLibrary(hInst);
};
CString str;
str.Format("窗体的透明度:%%%d",100 * m / 500);
SetDlgItemText(IDC_TOUMING,str);