SOL9 2.0 Sample: Pen

SOL9 2.0 Samples

1 Screenshot


2 Source code

/*
 * Pen.cpp 
 * Copyright (c) 2009 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED. 
 */


// SOL++2000
// 2000.02.18

#include <sol\ApplicationView.h>
#include <sol\PaintDC.h>
#include <sol\Pen.h>

namespace SOL {

class AppView :public ApplicationView {
private:
    long AppView::paint(Event& event)
    {
        PaintDC pdc(this);
        RECT    r;
        getClientRect(&r);
        int w = r.bottom/255+1;
        for(int i = 0; i < 255; i++) {
            int val = 255 -i;
            Pen pen(PS_INSIDEFRAME, w+2, RGB(255, 255, val) );

            HGDIOBJ prev = pdc.select(&pen);
    
            pdc.moveTo(0, w*i, NULL);
            pdc.lineTo(r.right, w*i);
            pdc.select(prev);
    }
    return NULL;
    }

public:
    AppView(Application& applet, const TCHAR* label, Args& args)
    :ApplicationView(applet, label, args)
    {
        addEventHandler(WM_PAINT, this, 
            (Handler)&AppView::paint, NULL);
    }

};

}


void    Main(int argc, TCHAR** argv)
{
    const TCHAR* appClass = _T("Pen");
    try {
        Application applet(appClass, argc, argv);

        Args args;
        AppView appview(applet, appClass, args);
        appview.realize();

        applet.run();
    } catch (...) {

    }
}


Last modified: 11 Nov 2009

Copyright (c) 2009 Antillia.com ALL RIGHTS RESERVED.