#include "wx/wx.h" #include "iostream" using namespace std; class MyFrame:public wxFrame { public: MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title) : wxFrame(parent, id, title) { SetSize(200,50); } ~MyFrame() {} void OnPaint(wxPaintEvent& event) { wxPaintDC paintDC(this); paintDC.SetBackgroundMode(wxSOLID); paintDC.SetTextForeground(*wxRED); paintDC.SetTextBackground(*wxGREEN); //Draw Text With Red Foreground and Green Background paintDC.DrawText("123456789",10,15); } void OnMouseMove(wxMouseEvent& event) { wxPaintDC paintDC(this); wxString tof,tif,tred; wxColour color; int a,b,c,d,e; a=(int)(event.GetX()-10); b=(int)(event.GetY()-10); tof << a; tif << b; paintDC.GetPixel((event.GetX()),(event.GetY()),&color); cout<< color.GetAsString(wxC2S_CSS_SYNTAX)<< endl; cout<< color.GetAsString(wxC2S_NAME)<< endl; e=(int)(color.GetPixel()); cout<Show(true); return true; }; }; IMPLEMENT_APP(MyApp) BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_PAINT(MyFrame::OnPaint) EVT_MOTION(MyFrame::OnMouseMove) END_EVENT_TABLE()