SOL9 2.0 Sample: Brush

SOL9 2.0 Samples

1 Screenshot


2 Source code

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


// SOL++2000
// 2000.02.16
// 2009/10/10

#include <sol\ApplicationView.h>
#include <sol\PaintDC.h>
#include <sol\Brush.h>
#include <sol\StockObject.h>

namespace SOL {

class AppView :public ApplicationView {

private:
    // This is a WM_PAINT event handler.
    long paint(Event& event)
    {
        PaintDC pdc(this);
        RECT    r;
        getClientRect(&r);
        int w = r.bottom/255+1;
        StockObject pen(NULL_PEN);
        pdc.select(&pen);
        for(int i = 0; i < 255; i++) {
            Brush brush(RGB(0, 0, 255-i) );
            HGDIOBJ prev = pdc.select(&brush);
            pdc.rectangle(100+i, 100, 200+i, 200);
            pdc.select(prev);
        }
        return 0L;
    }

public:
    /**
     * Constructor
     */
    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* name = _T("Brush");
    try {
        Application applet(name, argc, argv);

        Args args;
        //2009/10/10 To avoid window flickering
        args.set(XmNclassStyle, 0);

        AppView appview(applet, name, args);
        appview.realize();
        applet.run();
    } catch (...) {

    }
}

Last modified: 11 Nov 2009

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