第一印象
範例程式
截圖
與其它函式庫比較
相關應用
下載
教學文件
作品展示(Bazaar)
現狀及發展藍圖
常見問題(FAQ)
作者與授權
論壇
資助Ultimate++
搜尋本網站
語言
中文(繁體)











SourceForge.net Logo



Display

 

Using Display to alter DropList to display fonts

 

 

Display.cpp

 

#include "CtrlLib/CtrlLib.h"

 

using namespace Upp;

 

struct FontFaceDisplay : Display {

    virtual void Paint(Draw& w, const Rect& r, const Value& q,

                       Color ink, Color paper, dword style) const

    {

        Font fnt = Font(q, r.Height() - 2);

        String txt = Font::GetFaceName(q);

        w.DrawRect(r, paper);

        w.DrawText(r.left + 2, r.top + (r.Height() - GetTextSize(txt, fnt).cy) / 2, txt, fnt, ink);

    }

};

 

struct MyApp : TopWindow {

    DropList dl;

 

    MyApp()

    {

        Add(dl.HSizePos().TopPos(5, Ctrl::STDSIZE));

        dl.SetDisplay(Single<FontFaceDisplay>());

        for(int i = 0; i < Font::GetFaceCount(); i++)

            dl.Add(i);

        SetRect(0, 0, 200, 70);

    }

};

 

GUI_APP_MAIN

{

    MyApp().Run();

}

 

 

 

 

本頁也正在english, català, čeština, deutsch, español, euskara, français, română, русский中文(简体)中. 你想幫忙嗎?