rt-thread/examples/rtgui_win/demo_gui_label.c

52 lines
1.6 KiB
C
Raw Normal View History

/*
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>label<EFBFBD>ؼ<EFBFBD><EFBFBD><EFBFBD>ʾ
*
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӻ<EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>view<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD>label<EFBFBD>ؼ<EFBFBD>
*/
#include "demo_view.h"
#include <rtgui/widgets/label.h>
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾlabel<65>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD>ͼ */
rtgui_view_t* demo_gui_label(rtgui_view_t* parent_view)
{
rtgui_view_t* view;
rtgui_label_t* label;
rtgui_font_t* font;
/* <20>ȴ<EFBFBD><C8B4><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ʾ<EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ͼ */
view = demo_view_create(parent_view, "Label View");
/* <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>label<65>ؼ<EFBFBD> */
label = rtgui_label_create(view, "Red Left", 10, 40, 200, 20);
/* <20><><EFBFBD><EFBFBD>label<65>ؼ<EFBFBD><D8BC>ϵ<EFBFBD><CFB5>ı<EFBFBD><C4B1><EFBFBD><EFBFBD>ʽΪ<CABD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
RTGUI_WIDGET_TEXTALIGN(label) = RTGUI_ALIGN_LEFT|RTGUI_ALIGN_CENTER_VERTICAL;
/* <20><><EFBFBD><EFBFBD>label<65>ؼ<EFBFBD><D8BC><EFBFBD>ǰ<EFBFBD><C7B0>ɫΪ<C9AB><CEAA>ɫ */
RTGUI_WIDGET_FOREGROUND(label) = red;
RTGUI_WIDGET_BACKGROUND(label) = white;
label = rtgui_label_create(view, "Blue Right", 10, 65, 200, 20);
RTGUI_WIDGET_TEXTALIGN(label) = RTGUI_ALIGN_RIGHT|RTGUI_ALIGN_CENTER_VERTICAL;
RTGUI_WIDGET_FOREGROUND(label) = blue;
RTGUI_WIDGET_BACKGROUND(label) = white;
label = rtgui_label_create(view, "Green Center", 10, 90, 200, 20);
RTGUI_WIDGET_TEXTALIGN(label) = RTGUI_ALIGN_CENTER_HORIZONTAL|RTGUI_ALIGN_CENTER_VERTICAL;
RTGUI_WIDGET_FOREGROUND(label) = green;
RTGUI_WIDGET_BACKGROUND(label) = white;
label = rtgui_label_create(view, "12 font",10, 115, 200, 20);
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ12<31><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>asc<73><63><EFBFBD><EFBFBD> */
font = rtgui_font_refer("asc", 12);
RTGUI_WIDGET_FONT(label) = font;
RTGUI_WIDGET_BACKGROUND(label) = white;
label = rtgui_label_create(view, "16 font", 10, 140, 200, 20);
font = rtgui_font_refer("asc", 16);
RTGUI_WIDGET_FONT(RTGUI_WIDGET(label)) = font;
RTGUI_WIDGET_BACKGROUND(label) = white;
return view;
}