一直想学习wxWidgets,之前使用的都是wxPython,现在终于鼓起勇气学习这个了,发现原来是基于vc6.0开发的。所以最好的学习办法就是安装vistual studio 2010,方便学习看代码。wxWidgets里面也有demo。

基本上wxWidgets是和MFC类似的。

Similarity to MFC

MFC and wxWidgets macros

MFC version wxWidgets version
BEGIN_MESSAGE_MAP BEGIN_EVENT_TABLE
END_MESSAGE_MAP END_EVENT_TABLE
DECLARE_DYNAMIC DECLARE_CLASS
DECLARE_DYNCREATE DECLARE_DYMAMIC_CLASS
IMPLEMENT_DYNAMIC IMPLEMENT_CLASS
IMPLEMENT_DYNCREATE IMPLEMENT_DYNAMIC_CLASS
IsKindOf(RUNTIME_CLASS(CWindow)) IsKindOf(CLASSINFO(wxWindow))

MFC and wxWidgets classes

Miscellaneous Classes
MFC version wxWidgets version
CWinApp wxApp
CObject wxObject
CCmdTarget wxEvtHandler
CCommandLineInfo wxCmdLineParser
CMenu wxMenuwMenuBarwxMenuItem
CWaitCursor wxBusyCursor
CDataExchange wxValidator
Window Classes
MFC version wxWidgets version
CFrameWnd wxFrame
CMDIFrameWnd wxMDIParentFrame
CMDIChildWnd wxMDIChildFrame
CSplitterWnd wxSplitterWindow
CToolBar wxToolBar
CStatusBar wxStatusBar
CReBar wxCoolBar, but see contrib/src/fl and wxAUIwxDockIt
CPropertyPage wxPanel
CPropertySheet wxNotebookwxPropertySheetDialog
Dialog Classes
MFC version wxWidgets version
CDialog wxDialog
CColorDialog wxColourDialog
CFileDialog wxFileDialog
CFindReplaceDialog wxFindReplaceDialog
CFontDialog wxFontDialog
CPageSetupDialog wxPageSetupDialog
CPrintDialog wxPrintDialog
Control Classes
MFC version wxWidgets version
CAnimateCtrl wxMediaCtrl, wxAnimationCtrl
CButton wxButton
CBitmapButton wxBitmapButton
CComboBox wxComboBoxwxChoice
CDateTimeCtrl wxDatePickerCtrl
CEdit wxTextCtrl
CHotKeyCtrl None, but see Keybinder
CListBoxCDragListBox wxListBox
CCheckListBox wxCheckListBox
CListCtrl wxListCtrlwxListView
CMonthCalCtrl wxCalendarCtrl
CProgressCtrl wxGauge
CReBarCtrl None, but see contrib/src/fl and wxAUIwxDockIt
CRichEditCtrl wxTextCtrl
CScrollBar wxScrollBar
CSliderCtrl wxSlider
CSpinButtonCtrl wxSpinButtonwxSpinCtrl
CStatic wxStaticTextwxStaticLinewxStaticBoxwxStaticBitmap
CStatusBarCtrl wxStatusBar
CTabCtrl wxTabCtrl
CToolBarCtrl wxToolBar
CToolTipCtrl wxToolTip
CTreeCtrl wxTreeCtrl
Graphics Classes
MFC version wxWidgets version
CBitmap wxBitmapwxImagewxIconwxCursor
CBrush wxBrush
CPen wxPen
CFont wxFont
CImageList wxImageListwxIconBundle
CPalette wxPalette
CRgn wxRegion
CClientDC wxClientDC
CMetaFileDC wxMetaFileDC
CPaintDC wxPaintDC
CWindowDC wxWindowDC
CDC wxDCwxMemoryDC
Data Structure Classes
MFC version wxWidgets version
CArrayCObArrayCPtrArray wxArray
CStringArray wxArrayString
CDWordArrayCByteArrayCUIntArray wxArrayInt
CListCPtrListCObList wxList
CStringList wxArrayStringwxStringList
CMap wxHashMap
CString wxString
CPoint wxPoint
CRect wxRect
CSize wxSize
CTime wxDateTime
CTimeSpan wxTimeSpanwxDateSpan
COleVariant wxVariant
Internet Classes
MFC version wxWidgets version
CSocket wxSocket
CFtpConnection wxFTP
CHttpConnection wxHTTP
Document/View Classes
MFC version wxWidgets version
CDocument wxDocument
CView wxView
CDocTemplateCSingleDocTemplateCMultiDocTemplate wxDocTemplate
Drag and Drop Classes
MFC version wxWidgets version
COleDataSource wxDataObject
COleDropSource wxDropSource
COleDropTarget wxDropTarget
File Classes
MFC version wxWidgets version
CFile wxFilewxFFilewxTextFile
CMemFile wxMemoryInputStreamwxMemoryOutputStream
CSocketFile wxSocketInputStreamwxSocketOutputStream
CRecentFileList wxFileHistory
Multithreading Classes
MFC version wxWidgets version
CWinThread wxThread
CCriticalSection wxCriticalSection
CMutex wxMutex
CSemaphore wxSemaphore

非常经典的WxWidgets架构图。



1,下载

下载安装文件

http://sourceforge.net/projects/wxwindows/files/

安装文件:

wxWidgets-2.8.12(特别注意下不要使用开发版本,要使用稳定版本)

2,开发环境使用 visual studio 2010

安装IDE参考:

http://blog.csdn.net/freewebsys/article/details/12028265

3,安装wxwdiget(基于源码编译安装)

下载zip文件

打开工程D:/wxWidgets-2.8.12/build/msw/wx.dsw

可以使用exe安装,(相当于解压缩源代码,不是安装)也可以使用zip解压缩,两个都是将源代码放到一个目录,没有啥区别。



然后编译,否则不能使用!!!!!!
wxWidgets使用的是vc6.0开发的,需要转换成vistual studio 2010。(IDE会自动转换的,耐心等待)


转换完成之后直接build就行了。

编译完成没有任何错误信息。说明安装成功。

4,编译demo

在安装后的wxWidgets-2.9.5/samples目录下面有samples.dsw

双击就可以启动visual studio了,同样需要转换成工程。

继续等待。转换完成之后就可以编译了。

里面的demo都可以编译成功,运行如下:

转换完成之后就可以进行编译了。发现编译有4个失败的。不过没有关系大多数成功了。

运行一个demo:

丰富的demo找了几个运行下效果如下:

一个简单的播放器

一个所有组件的demo。比较全。

5,WxWidgets的一个helloworld

/*
* hworld.cpp
* Hello world sample by Robert Roebling
*/ #include "wx/wx.h" class MyApp: public wxApp
{
virtual bool OnInit();
}; class MyFrame: public wxFrame
{
public: MyFrame(const wxString& title,
const wxPoint& pos, const wxSize& size); void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event); DECLARE_EVENT_TABLE()
}; enum
{
ID_Quit = 1,
ID_About, }; BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(ID_Quit, MyFrame::OnQuit)
EVT_MENU(ID_About, MyFrame::OnAbout)
END_EVENT_TABLE() IMPLEMENT_APP(MyApp) bool MyApp::OnInit()
{
MyFrame *frame = new MyFrame( "Hello World",
wxPoint(50,50), wxSize(450,340) );
frame->Show(TRUE);
SetTopWindow(frame);
return TRUE;
} MyFrame::MyFrame(const wxString& title,
const wxPoint& pos, const wxSize& size)
: wxFrame((wxFrame *)NULL, -1, title, pos, size)
{
wxMenu *menuFile = new wxMenu;
menuFile->Append( ID_About, "&About..." );
menuFile->AppendSeparator();
menuFile->Append( ID_Quit, "E&xit" ); wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append( menuFile, "&File" ); SetMenuBar( menuBar ); CreateStatusBar();
SetStatusText( "Welcome to wxWindows!" );
} void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
Close(TRUE);
} void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ wxMessageBox("This is a wxWindows Hello world sample",
"About Hello World", wxOK | wxICON_INFORMATION, this);
}

其他的继续研究。。。



其他参考:

http://www.cnzui.com/archives/962

http://blog.csdn.net/chinabinlang/article/details/6904143
http://www.codeproject.com/Articles/11515/Introduction-to-wxWidgets

Windows使用WxWidgets开发界面(c++)环境搭建的更多相关文章

  1. 使用Kotlin开发Android应用 - 环境搭建 (1)

    一. 在Android Studio上安装Kotlin插件 按快捷键Command+, -> 在Preferences界面找到Plugins -> 点击Browse repositorie ...

  2. Tiny4412 开发板 编译环境搭建【转】

    本文转载自:http://blog.csdn.net/beijiwei/article/details/51055369 版权声明:本文为博主原创文章,未经博主允许不得转载. /*********** ...

  3. Qt4.8在Windows下的三种编程环境搭建

    Qt4.8在Windows下的三种编程环境搭建 Qt的版本是按照不同的图形系统来划分的,目前分为四个版本:Win32版,适用于Windows平台:X11版,适合于使用了X系统的各种Linux和Unix ...

  4. Windows下OpenFOAM开发及使用环境配置指南 (2)【转载】

    转载自:http://openfoam.blog.sohu.com/158751915.html *************************************************** ...

  5. Windows下OpenFOAM开发及使用环境配置指南 (1)【转载】

    转载自:http://openfoam.blog.sohu.com/158614863.html *************************************************** ...

  6. 【Qt开发】Qt在Windows下的三种编程环境搭建

    从QT官网可以得知其支持的平台.编译器和调试器的信息如图所示: http://qt-project.org/doc/qtcreator-3.0/creator-debugger-engines.htm ...

  7. Windows 2012 下Redmine安装和环境搭建

    公司在过去一年中处于高速发展创业期,对于技术管理和项目管理没有找到一个很好的管理工具,使用过Teanbition+禅道+SVM的集成管理工具,但是明显各工具之间联系性差,断层严重,不能很好的形成团队成 ...

  8. 前端开发 Vue -1windows环境搭建Vue Node开发环境

    解决几个疑问: 想学习下vue.js,我理解的它是一个前端的框架,主要作用是对数据的处理,和juqery类似,所以不太理解为什么要在nodejs中npm install vue呢?在html文件中引入 ...

  9. Windows Server 2012上PHP运行环境搭建的简易教程(Win08适用)

    微软的Windows Server 2012发布后,第一时间进行了简单的试用,非常不错,特写了个简易的PHP环境搭建教程.先来欣赏下Win2012的登录界面吧第一步我们需要安装IIS81.点击任务栏最 ...

随机推荐

  1. Append加载动态轮播

    前几天遇到了些小麻烦,不过很快就解决了.之所以要记下来是因为作为一名前端的程序员,要理解页面的加载顺序是最重要的.要不然自己写程序意外的出现bug~~ 刚开始写利用Append的时候,利用火狐的fir ...

  2. 3:url无规律的多页面爬取

    试例网站:豆瓣电影TOP250:http://movie.douban.com/top250 关键点:在审查元素下查看后页即可以看到跳转的url.而且最后一页就此属性就没有了. 由于关键是实现分页,所 ...

  3. DKNightVersion的基本使用(夜间模式)

    DKNightVersion下载地址: https://github.com/Draveness/DKNightVersion 基本原理就是利用一个单例对象来存储颜色, 然后通过runtime中的ob ...

  4. java下properties属性文件操作

    package cn.stat.p1.file; import java.io.File; import java.io.FileInputStream; import java.io.FileNot ...

  5. 武汉科技大学ACM :1010: 华科版C语言程序设计教程(第二版)例题7.8

    Problem Description 输入一个用年月日表示的日期,求该日期是该年的第几天.输入某年的第几天,输出这一天是该年的几月几号,茂茂解不出,需要你的帮助. Input 开始有个整数k,表示询 ...

  6. ECMAscript v.s. Javascript

    ECMAscript是一种中性的语言,中性表示与所处环境(宿主环境)无关(客户端/服务器/浏览器),它仅仅是一个纯粹意义上的语言. ECMAscript-262定义了这门语言的基础,或者说规则(比如说 ...

  7. SQL GROUP BY 语句

    合计函数 (比如 SUM) 常常需要添加 GROUP BY 语句. GROUP BY 语句 GROUP BY 语句用于结合合计函数,根据一个或多个列对结果集进行分组. SQL GROUP BY 语法 ...

  8. ORACLE主要的系统表和系统视图

    ORACLE主要的系统表和系统视图 1.系统表 ORACLE数据库的系统参数都存储在数据库中,可以通过SQLPLUS,以用户SYS进行查询.几个重要的表或者视图如下: v$controlfile:控制 ...

  9. webstrom的注释

    今天我们小组的新同学有一个BUG调不好,然后我就帮他调一下.在调试的过程中非常累,纠其原因还是他注释写的不完善.我们可以看一下,他是这样写注释的(随便拿一个方法举例),如下图: 乍一看,是不是觉得他的 ...

  10. 在Ajax中将数组转换成字符串(0517-am)

    一.如何在Ajax中将数组转换成字符串 1. 主页面; <head> <meta http-equiv="Content-Type" content=" ...