1 Screenshot
2 Source code
/*
* Brush.cpp
* Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED.
*/
// SOL++2000
// 2000.02.16
// 2009/10/10
// 2017/01/28 Updated to use ModuleFileName class and caught macro.
#include <sol\ApplicationView.h>
#include <sol\PaintDC.h>
#include <sol\Brush.h>
#include <sol\StockObject.h>
#include "resource.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);
addCallback(XmNmenuCallback, IDM_EXIT, this,
(Callback)&AppView::exit, NULL);
}
};
}
//
void Main(int argc, TCHAR** argv)
{
ModuleFileName module(argv[0]);
const TCHAR* name = module.getFileName();
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 (Exception& ex) {
caught(ex);
} catch (...) {
caught(UnknownException());
}
}
Last modified: 1 Feb 2017
Copyright (c) 2017 Antillia.com ALL RIGHTS RESERVED.