wxWidgets 不规则透明WinForm窗体(通过透明图片实现)
来源:互联网 发布:python writeline 编辑:程序博客网 时间:2024/05/16 08:10
#include "wx/wxprec.h"class MyFrame;class MyApp : public wxApp {public:virtual bool OnInit();private:MyFrame *frame;};class MyFrame : public wxFrame {private:wxBitmap *bit;wxPoint *point;public:MyFrame();void OnPaint(wxPaintEvent& event);void OnWindowCreate(wxWindowCreateEvent& event);void OnRightClick(wxMouseEvent& event);void OnMouseClickDown(wxMouseEvent& event);void OnMouseMotion(wxMouseEvent& event);void OnMouseClickUp(wxMouseEvent& event);};bool MyApp::OnInit(){this->frame = new MyFrame();this->frame->Show(TRUE);this->SetTopWindow(this->frame);return TRUE;};MyFrame::MyFrame() : wxFrame(NULL,-1,wxT("不规则窗体")){this->SetWindowStyle(wxFRAME_SHAPED|wxSIMPLE_BORDER|wxSTAY_ON_TOP);::wxInitAllImageHandlers();wxImage *img = new wxImage(wxT("d:\\bg.png"),wxBITMAP_TYPE_ANY);this->SetSize(img->GetWidth(),img->GetHeight());img->SetMask(TRUE);img->SetMaskColour(255,255,255);bit = new wxBitmap(*img);this->Bind(wxEVT_PAINT,&MyFrame::OnPaint,this);wxRegion *r = new wxRegion(*bit);this->SetShape(*r);this->Bind(wxEVT_RIGHT_UP,&MyFrame::OnRightClick,this);this->point = new wxPoint(0,0);this->Bind(wxEVT_LEFT_DOWN,&MyFrame::OnMouseClickDown,this);this->Bind(wxEVT_LEFT_UP,&MyFrame::OnMouseClickUp,this);this->Bind(wxEVT_MOTION,&MyFrame::OnMouseMotion,this);};void MyFrame::OnPaint(wxPaintEvent& event){wxPaintDC *dc = new wxPaintDC(this);if(bit->IsOk()){dc->DrawBitmap(*bit,0,0,TRUE);}};void MyFrame::OnWindowCreate(wxWindowCreateEvent& event){wxRegion *r = new wxRegion(*bit);this->SetShape(*r);}void MyFrame::OnRightClick(wxMouseEvent& event){if(wxMessageBox(wxT("是否退出程序?"),wxT("退出"),wxYES_NO,this) == 2){wxExit();}};void MyFrame::OnMouseClickDown(wxMouseEvent& event){this->CaptureMouse();event.GetPosition(&this->point->x,&this->point->y);};void MyFrame::OnMouseClickUp(wxMouseEvent& event){if(this->HasCapture()){this->ReleaseMouse();}};void MyFrame::OnMouseMotion(wxMouseEvent& event){if(event.Dragging() && event.LeftIsDown()){int x,y;event.GetPosition(&x,&y);this->ClientToScreen(&x,&y);this->Move(x-this->point->x,y-this->point->y);}};IMPLEMENT_APP(MyApp);
0 0
- wxWidgets 不规则透明WinForm窗体(通过透明图片实现)
- QT实现不规则窗体和透明窗体
- QT实现不规则窗体和透明窗体
- QT实现不规则窗体和透明窗体
- QT实现不规则窗体和透明窗体
- 用Qt实现窗体的无边框、可移动、透明不规则显示(需背景透明的图片)
- 用Qt实现窗体的无边框、可移动、透明不规则显示(需背景透明的图片)
- 通过检测png图片透明区实现不规则按钮
- 用PNG透明图片和GDI+做不规则透明窗体
- 用PNG透明图片和GDI+做不规则透明窗体
- 用PNG透明图片和GDI+做不规则透明窗体
- c# 不规则透明窗体
- wxWidgets实现不规则窗体
- wxWidgets实现不规则窗体
- c# 实现透明窗体,透明图片,透明按钮
- C# 在windows form实现不规则窗体&透明窗体
- [QT编程]QT实现不规则窗体和透明窗体
- 制作透明及不规则窗体
- 利用Web Deploy 远程发布注意事项
- 添加图片
- 《数据结构》第三章思维导图
- Android本地缓存DiskLruCache完整详细学习示例
- iOS开发中的好工具
- wxWidgets 不规则透明WinForm窗体(通过透明图片实现)
- 堆排序(C++)
- 苹果IOS比安卓流畅的系统原因
- hadoop面试题整理(八)
- xUtils框架介绍
- 黑马程序员_网络编程(一)
- 我凭什么来“我来买”
- qemu KVM kernel module no such file or directory
- codeforces 446B DZY Loves Modification(枚举)