MiniGUI皮肤界面普通标签的使用

在skindemo.c中并没有普通标签的使用方法,花了点时间研究出来了,关键是皮肤界面结构体里面的字体成员fonts的赋值,关键代码如下:
 
static si_nrmlabel_t title ={"Hello", 0xDD0000, 0x00FF00, 0xFF0000, 0};
 
static skin_item_t skin_main_items [] =
{
 {SIID_TITLE, SI_TYPE_NRMLABEL | SI_TEST_SHAPE_RECT |SI_STATUS_VISIBLE,
15, 0, {}, -1, "Title", 0, &title},
};
 
/* 字节资源装/卸载函数 */
void load_skin_fonts (skin_head_t *skin, BOOL load)
{
 int font_num = 2;
 LOGFONT *my_logfont;
 
 if (load)
 {
  skin->fonts = (LOGFONT* ) calloc (font_num, sizeof(LOGFONT));
  my_logfont = CreateLogFont (NULL, "song", "GB2312",
   FONT_WEIGHT_REGULAR, FONT_SLANT_ROMAN, FONT_SETWIDTH_NORMAL,
   FONT_SPACING_CHARCELL, FONT_UNDERLINE_NONE, FONT_STRUCKOUT_NONE, 12, 0);
  memcpy((void *)&skin->fonts[0], (void *)my_logfont, sizeof(LOGFONT));
  DestroyLogFont(my_logfont);/* 释放字体 */
  my_logfont = CreateLogFont (NULL, "SansSerif", "ISO8859-1",
               FONT_WEIGHT_REGULAR, FONT_SLANT_ITALIC, FONT_SETWIDTH_NORMAL,
                     FONT_SPACING_CHARCELL, FONT_UNDERLINE_NONE, FONT_STRUCKOUT_LINE,
                        16, 0);
  memcpy((void *)&skin->fonts[1], (void *)my_logfont, sizeof(LOGFONT));
  DestroyLogFont(my_logfont);/* 释放字体 */
 }
 else
 {
  free ((void *)skin->fonts);
 }
}

然后再主函数中调用,完成卸载即可.

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/2e2ab0f574334776b77a631921f4a1d2.html