打印本文 打印本文 关闭窗口 关闭窗口
TFontNameComboBox及TFontSizeComboBox的实现
作者:武汉SEO闵涛  文章来源:敏韬网  点击数4809  更新时间:2009/4/23 18:38:22  文章录入:mintao  责任编辑:mintao
sp;程序设计:梁生红
  创建日期:2003-03-20
===========================================================================*/
#include <vcl.h>
#pragma hdrstop

#include "FontComboBox.h"
#pragma package(smart_init)
//---------------------------------------------------------------------------
static inline void ValidCtrCheck(TFontNameComboBox *)
{
        new TFontNameComboBox(NULL);
}
//---------------------------------------------------------------------------
static inline void ValidCtrCheck(TFontSizeComboBox *)
{
        new TFontSizeComboBox(NULL);
}
//---------------------------------------------------------------------------
/* TODO : 
回调函数实现代码 */
bool __stdcall EnumFontNameProc(ENUMLOGFONT FAR *lpelf,NEWTEXTMETRICEX FAR *lpntme,
                                int FontType, LPARAM lParam)
{
  char FontFullName[64];
  strcpy(FontFullName,lpelf->elfFullName);
  if(((TStrings*)(lParam))->IndexOf(FontFullName)==-1)
    ((TStrings*)(lParam))->Add(FontFullName);
  return true;
}
//----------------------------------------------------------------------------
bool __stdcall EnumFontSizeProc(ENUMLOGFONT FAR *lpelf,NEWTEXTMETRIC FAR *lpntm,
                                int FontType, LPARAM lParam)
{
  if(FontType&TRUETYPE_FONTTYPE)
    {
        ((TStrings*)(lParam))->Add("8");
        ((TStrings*)(lParam))->Add("9");
        ((TStrings*)(lParam))->Add("10");
        ((TStrings*)(lParam))->Add("11");
        ((TStrings*)(lParam))->Add("12");
        ((TStrings*)(lParam))->Add("14");
        ((TStrings*)(lParam))->Add("16");
        ((TStrings*)(lParam))->Add("18");
        ((TStrings*)(lParam))->Add("20");
        ((TStrings*)(lParam))->Add("22");
        ((TStrings*)(lParam))->Add("24");
        ((TStrings*)(lParam))->Add("26");
        ((TStrings*)(lParam))->Add("28");
        ((TStrings*)(lParam))->Add("36");
        ((TStrings*)(lParam))->Add("48");
        ((TStrings*)(lParam))->Add("72");
        return false;
    }
  else
    {
          AnsiString s;
          int i,v,v2;
          v = floor((lpelf->elfLogFont.lfHeight-lpntm->tmInternalLeading)*72/PixelsPerInch);
          s = IntToStr(v);
&nb

上一页  [1] [2] [3] [4] [5] [6]  下一页

打印本文 打印本文 关闭窗口 关闭窗口