SOL9 Sample: Pen

SOL9 2.0 Samples

1 Screenshot


2 Source code

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


// SOL++2000
// 2000.02.18

#include <sol\ApplicationView.h>
#include <sol\PaintDC.h>
#include <sol\Pen.h>
#include "resource.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);
    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;
    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.