【190517】VC++透明背景的奇怪窗体演示源码源代码

源码下载简介

VC++透明背景的奇怪窗体演示源码,实现不规则的窗体,主要考查的是函数的使用,相对简单一点,VC入门朋友适合参考。

源码下载地址:点击下载

备用下载地址:点击下载

 

class CNewsWindow { public: CNewsWindow(void); ~CNewsWindow(void); public: HWND m_hWnd; public: // 设置皮肤(位图资源名称,标题栏文本颜色) BOOL SetSkin(LPCTSTR lpSkinBitmapName,COLORREF CaptionColor=0x000000); // 创建窗口 BOOL Create(LPCTSTR lpWindowName,int nWidth=250,int nHeight=180); BOOL Create(LPCTSTR lpClassName,LPCTSTR lpWindowName,int nWidth,int nHeight); // 设置新闻标题、内容、链接 BOOL SetNews(LPCTSTR lpNewsTitle,LPCTSTR lpNewsContent,LPCTSTR lpNewsURL); // 显示窗口 void Show(); // 设置为主窗口,主窗口销毁后会退出消息循环 void SetMainWindow(BOOL bMainWindow=TRUE); // 设置自动关闭,如果为真,点击链接后窗口自动关闭 void SetAutoClose(BOOL bAutoClose=TRUE); public: BOOL IsWindow(); BOOL DestroyWindow(); private: #define NCT_CLOSE 0 #define NCT_VIEW 1 #define NCT_TITLE 2 #define NCT_CONTENT 3 typedef struct tagNEWSCONTROL { CString strText; int nType; int x; int y; int nWidth; int nHeight; RECT Rect; }NEWSCONTROL, *LPNEWSCONTROL; private: LPNEWSCONTROL m_pControls; int m_nControlCount; private: HCURSOR m_hArrowCursor; HCURSOR m_hHandCursor; HCURSOR m_hCurCursor; HICON m_hAppSmallIcon; HDC m_hSkinDC; HDC m_hCacheDC; HBITMAP m_hSkinBitmap; HBITMAP m_hSkinOldBitmap; HBITMAP m_hCacheBitmap; HBITMAP m_hCacheOldBitmap; HFONT m_hFont; HFONT m_hBoldFont; COLORREF m_CaptionColor; int m_nHoverIndex; int m_nDownIndex; BOOL m_bMainWindow; BOOL m_bAutoClose; BOOL m_bTracking; CString m_strURL; private: BOOL DrawWindow(); BOOL DrawWindowEx(); void DrawButton(HDC hDC,LPNEWSCONTROL pControl); void DrawStatic(HDC hDC,LPNEWSCONTROL pControl); void DrawNineRect(HDC hdcDest,RECT DestRect,RECT SrcRect,RECT NineRect,UINT crTransparent=0xFF00FF); RECT CreateRect(LONG left,LONG top,LONG right,LONG bottom); void CreateControl(LPNEWSCONTROL pControl,int nType,int x,int y,int nWidth,int nHeight,CString strText=_T("")); int ControlFromPoint(POINT pt); int ControlFromPoint(LPARAM lParam); void SetCursor(HCURSOR hCursor); public: LRESULT OnMessage(UINT message, WPARAM wParam, LPARAM lParam); LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam); LRESULT OnEraseBkgnd(UINT message, WPARAM wParam, LPARAM lParam); LRESULT OnPaint(UINT message, WPARAM wParam, LPARAM lParam); LRESULT OnMouseMove(UINT message, WPARAM wParam, LPARAM lParam); LRESULT OnMouseHover(UINT message, WPARAM wParam, LPARAM lParam); LRESULT OnMouseLeave(UINT message, WPARAM wParam, LPARAM lParam); LRESULT OnLButtonDown(UINT message, WPARAM wParam, LPARAM lParam); LRESULT OnLButtonUp(UINT message, WPARAM wParam, LPARAM lParam); LRESULT OnControlClick(UINT message, WPARAM wParam, LPARAM lParam); LRESULT OnDestroy(UINT message, WPARAM wParam, LPARAM lParam); LRESULT OnSetCursor(UINT message, WPARAM wParam, LPARAM lParam); };
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值