listing_5_6.c
来自「This source code has been tested under O」· C语言 代码 · 共 46 行
C
46 行
/************************************************************************* **** listing_5_6.c **** **** This program demonstrates programmatic setting of an XmLabel's **** labelString resource. Along the way it demonstrates use of the **** XmString data type, including the use of multiple fonts. **** *************************************************************************/#include <Xm/Label.h> /* Definitions for XmLabel (includes Xm.h) */Widget appshell, /* Application Shell */ the_label; /* The one and only label */Arg arglist[16]; /* Used to store label */XmString str1, /* Strings for the label */ str2, the_string;void main( argc, argv ) int argc; char *argv[];{ appshell = XtInitialize( argv[0], "Listing_5_6", NULL, 0, &argc, argv ); the_label = XmCreateLabel( appshell, "TheLabel", NULL, 0 ); XtManageChild( the_label ); str1 = XmStringCreateLtoR( "Hello\n", XmSTRING_DEFAULT_CHARSET ); str2 = XmStringCreate( "World!", "CharSet1" ); the_string = XmStringConcat( str1, str2 ); XmStringFree( str1 ); XmStringFree( str2 ); XtSetArg( arglist[0], XmNlabelString, the_string ); XtSetValues( the_label, arglist, 1 ); XmStringFree( the_string ); XtRealizeWidget( appshell ); XtMainLoop();}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?