1 Screenshot
2 Source code
/*
* Font.cpp
* Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED.
*/
// SOL++2000
// 2000.02.18
#include <sol\ApplicationView.h>
#include <sol\ScrolledText.h>
#include <sol\Font.h>
#include <sol\ClientDC.h>
#include "resource.h"
namespace SOL {
class AppView :public ApplicationView {
private:
Font font;
ScrolledText sctext;
public:
/**
* Constructor
*/
AppView(Application& applet, const TCHAR* name, Args& args)
:ApplicationView(applet, name, args)
{
Args ar;
sctext.create(this, _T(""), ar);
ClientDC dc(this);
//2008/06/24
int pointSize = 24;
int logPixel = dc.getDeviceCaps(LOGPIXELSY);
int nHeight = -MulDiv(pointSize, logPixel, 72);
ar.reset();
ar.set(XmNheight, nHeight);
ar.set(XmNweight, FW_BOLD);
ar.set(XmNcharSet, (ulong)dc.getTextCharsetInfo(NULL));
//ar.set(XmNfaceName, _T("Times New Roman"));
//ar.set(XmNfaceName, _T("MS Gothic"));
//ar.set(XmNfaceName, _T("MeiryoKe_UIGothic"));
//ar.set(XmNfaceName, _T("MS UI Gothic"));
font.create(ar);
sctext.setFont(&font);
// Add this sctext to the defaultLayoutManager.
add(&sctext);
setText(_T("AppView: This is a 24 points and bold font"));
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.