Skip to content

Instantly share code, notes, and snippets.

#define WINVER 0x0601
#define _WIN32_WINNT 0x0601
#define GDIPVER 0x0110
#pragma comment(linker, "\"/manifestdependency:type='Win32' name='Microsoft.Windows.GdiPlus' version='1.1.0.0' processorArchitecture='X86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#include <wx/wx.h>
#include <wx/dcgraph.h>
#include <wx/metafile.h>
@PBfordev
PBfordev / wxEMF2.cpp
Last active August 9, 2018 17:08
wxEMF2
#define GDIPVER 0x0110
#include <wx/wx.h>
#include <wx/dcgraph.h>
#include <wx/metafile.h>
#include <wx/sharedptr.h>
#include <wx/msw/wrapgdip.h>
#define GDIPVER 0x0110
#include <wx/wx.h>
#include <wx/dcgraph.h>
#include <wx/metafile.h>
#include <wx/sharedptr.h>
#include <wx/msw/wrapgdip.h>
@PBfordev
PBfordev / wxImageCanvas.cpp
Created August 19, 2018 18:42
Demonstrates using wxScrolled to display an image
#include <wx/wx.h>
#include <wx/scrolwin.h>
#include <wx/dcbuffer.h>
#include <wx/filedlg.h>
#include <wx/filename.h>
class ImageCanvas : public wxScrolledCanvas
{
public:
ImageCanvas(wxWindow* parent)
@PBfordev
PBfordev / wxImageCanvas2.cpp
Created August 20, 2018 17:48
wxImageCanvas2
#include <wx/wx.h>
#include <wx/scrolwin.h>
#include <wx/dcbuffer.h>
#include <wx/filedlg.h>
#include <wx/filename.h>
class ImageCanvas : public wxScrolledCanvas
{
public:
ImageCanvas(wxWindow* parent)
#include <wx/wx.h>
class MyFrame : public wxFrame
{
public:
MyFrame() : wxFrame(nullptr, wxID_ANY, "wxWidgets ScrollBar Test", wxDefaultPosition, wxSize(800, 600))
{
wxBoxSizer* mainSizer = new wxBoxSizer(wxHORIZONTAL);
m_scrollBar = new wxScrollBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSB_VERTICAL);
@PBfordev
PBfordev / win32scrollbar.cpp
Created June 6, 2019 15:06
Implementation with pure Win32
#ifdef _MSC_VER
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#define NOMINMAX
#include <windows.h>
#include <windowsx.h>
#include <tchar.h>
#include <wx/wx.h>
#include <wx/msw/wrapshl.h>
bool MoveToRecycleBin(const wxString& path)
{
bool result = false;
SHFILEOPSTRUCT fileOp;
const wxString temp = path + '\0';
::ZeroMemory(&fileOp, sizeof(fileOp));
#include <wx/wx.h>
#include <wx/artprov.h>
#include <wx/bmpbuttn.h>
#include <wx/commandlinkbutton.h>
class MyDialog : public wxDialog
{
public:
MyDialog() : wxDialog(NULL, wxID_ANY, "Test", wxDefaultPosition, wxSize(1024, 800))
@PBfordev
PBfordev / sizer_borders_pmv2.cpp
Last active October 29, 2019 20:59
Demonstrates sizer borders in a PMv2 application
#include <wx/wx.h>
class MyFrame : public wxFrame
{
public:
MyFrame() : wxFrame(NULL, wxID_ANY, _("Test"), wxDefaultPosition, wxSize(800, 600))
{
wxSizer* mainSizer = new wxBoxSizer(wxVERTICAL);
mainSizer->Add(new wxButton(this, wxID_OK), wxSizerFlags().Expand().TripleBorder());