wxWindow 클래스 1 – 윈도우 스타일 중심


MyFrame.h
#pragma  once

#include  <wx/wx.h>
#include  <wx/timer.h>

class MyFrame:public wxFrame
{
private:
    wxTimer timer_;

public:
    MyFrame(const wxString& title);
    ~MyFrame(void);

private:
   void OnPaint(wxPaintEvent& event);
   void OnTimer(wxTimerEvent& event);

   void ScreenToDC(wxDC& dc);
};

MyFrame.cpp
#include  "MyFrame.h"


MyFrame::MyFrame(const wxString& title)
    :wxFrame(NULL, wxID_ANY, title)
{
    Bind(wxEVT_PAINT, &MyFrame::OnPaint, this);
    timer_.Bind(wxEVT_TIMER, &MyFrame::OnTimer, this);
    timer_.Start(100);

}


MyFrame::~MyFrame(void)
{
}


void
MyFrame::OnPaint(wxPaintEvent& event){
    wxPaintDC dc(this);
    ScreenToDC(dc);

}

void
MyFrame::OnTimer(wxTimerEvent& event){
    wxClientDC dc(this);
    ScreenToDC(dc);
}

void
MyFrame::ScreenToDC(wxDC& dc){
    wxScreenDC sdc;
    dc.Blit(wxPoint(0,0), dc.GetSize(), &sdc, wxPoint(0,0));
}

MyApp.h
#pragma  once

#include  <wx/wx.h>

class  MyApp:public  wxApp
{
public:
    MyApp(void);
    ~MyApp(void);

   virtual  bool OnInit();
};

DECLARE_APP(MyApp);

MyApp.cpp
#include  "MyApp.h"
#include  "MyFrame.h"

IMPLEMENT_APP(MyApp);

MyApp::MyApp(void)
{
}


MyApp::~MyApp(void)
{
}

bool
MyApp::OnInit(){
   wxFrame* m = new  MyFrame("Win1");
    m->Show(true);
   return  true;
}

- 목록:

3 thoughts on “wxPaintDC 이해하기

  1. 공유해주신 동영상에서 많은 것을 배우고 있습니다. 감사합니다.
    윈도우에서 GUI 프로그래밍을 가끔 하지만, RAD 툴에서 만들어주는 코드를 약간 변형하는 정도입니다.
    동영상을 보다보니, 툴이 생성해주는 코드들에 대해 좀 더 이해할 수 있을 것 같습니다.
    wxSmith 를 이용하여 wxWidget 를 사용하려 알아보는 중인데, 설명을 들으니 wxSmith 나 wxFormWBuilder 가 해주는 일을 약간은 이해할 수 있게 된 것 같습니다. 해당 툴을 사용하는데 많은 도움이 될 것 같습니다.
    좋은 강좌에 감사드립니다.

Leave a Reply to admin Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>