points.h einbinden
-
Hallo Leute ich will auf meinem Panel mehrere Punkte zeicnen.
Um Punkte zu zeicnen muss ich ja die datei <points.h> einbinden oder?Leider funtzt es bei mir nicht und gibt mir immer diesen Fehler heraus!
C:\wxProjekts\WLogic\sheet.cpp|7|wx/points.h: No such file or directory| C:\wxProjekts\WLogic\sheet.cpp||In member function `void sheet::OnPaint(wxPaintEvent&)':| C:\wxProjekts\WLogic\sheet.cpp|46|error: `dc' was not declared in this scope| C:\wxProjekts\WLogic\sheet.cpp|46|warning: unused variable 'dc'| ||=== Build finished: 2 errors, 1 warnings ===|
Der Code dazu ist folgender!
#include "sheet.h" //(*InternalHeaders(sheet) #include <wx/settings.h> #include <wx/intl.h> #include <wx/string.h> #include <wx/points.h> //*) //(*IdInit(sheet) //*) BEGIN_EVENT_TABLE(sheet,wxPanel) //(*EventTable(sheet) EVT_PAINT( sheet::OnPaint ) //*) END_EVENT_TABLE() sheet::sheet(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size) { //(*Initialize(sheet) Create(parent, id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL|wxVSCROLL|wxHSCROLL, _T("id")); SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_MENU)); //*) } sheet::~sheet() { //(*Destroy(sheet) //*) } void sheet::OnPaint( wxPaintEvent& event ) { // Before editing this code, remove the block markers. wxCoord x = 0; wxCoord y = 0; wxSize size = this->GetSize(); for (int i = 0; i<1000; i++) { x = rand() % size.x + 1; y = rand() % size.y + 1; // wxPen (wxBLACK, 1); dc.DrawPoint(x, y); } ////@end wxEVT_PAINT event handler for ID_BASICCONTROLS in BasicControls. }
-
Schau dir bitte das Tutorial im Magazin an, dann müsstest du recht schnell die Fehler und den Unterschied sehen.
Zwei dinge:
- es gibt keine points.h
- in der Onpaint Methode musst du einen wxPaintDC erstellen.