当前位置: 技术问答>linux和unix
win32 gtk+ 中文显示
来源: 互联网 发布时间:2015-07-05
本文导语: 小弟正在做linux下gtk+程序移植到windows下,gtk版本是2.0有如下程序 #include static char *gtkrc_string = " style "default" { fontset = "8x16, -*-*-medium-r-nor...
小弟正在做linux下gtk+程序移植到windows下,gtk版本是2.0有如下程序
#include
static char *gtkrc_string = "
style "default"
{
fontset = "8x16,
-*-*-medium-r-normal--16-*-*-*-*-*-gb2312.1980-0"
}
class "GtkWidget" style "default"";
gint on_clicked(GtkWidget* widget, gpointer data)
{
g_message(g_locale_to_utf8("中文",-1,NULL,NULL,NULL) );
return 0;
}
int main( int argc,
char *argv[] )
{
GtkWidget *window;
GtkWidget *button;
gtk_set_locale();
gtk_init (&argc, &argv);
gtk_rc_parse_string (gtkrc_string);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect(G_OBJECT(window),"delete_event",G_CALLBACK(gtk_main_quit),NULL);
gtk_window_set_title(GTK_WINDOW(window),
g_locale_to_utf8("中文",-1,NULL,NULL,NULL) );
gtk_window_set_default_size(GTK_WINDOW(window),500,100);
gtk_window_set_position(GTK_WINDOW(window),GTK_WIN_POS_CENTER);
button= gtk_button_new_with_label(g_locale_to_utf8("中文",-1,NULL,NULL,NULL));
gtk_container_add(GTK_CONTAINER(window), button);
gtk_widget_show(button);
/*gtk_signal_connect_object(GTK_OBJECT(button),
"clicked",
GTK_SIGNAL_FUNC(on_clicked),
NULL );*/
g_signal_connect(G_OBJECT(button),
"clicked",
G_CALLBACK(on_clicked),
NULL);
gtk_widget_show (window);
gtk_main ();
return(0);
}
button上中文不能正常显示,请赐教
#include
static char *gtkrc_string = "
style "default"
{
fontset = "8x16,
-*-*-medium-r-normal--16-*-*-*-*-*-gb2312.1980-0"
}
class "GtkWidget" style "default"";
gint on_clicked(GtkWidget* widget, gpointer data)
{
g_message(g_locale_to_utf8("中文",-1,NULL,NULL,NULL) );
return 0;
}
int main( int argc,
char *argv[] )
{
GtkWidget *window;
GtkWidget *button;
gtk_set_locale();
gtk_init (&argc, &argv);
gtk_rc_parse_string (gtkrc_string);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect(G_OBJECT(window),"delete_event",G_CALLBACK(gtk_main_quit),NULL);
gtk_window_set_title(GTK_WINDOW(window),
g_locale_to_utf8("中文",-1,NULL,NULL,NULL) );
gtk_window_set_default_size(GTK_WINDOW(window),500,100);
gtk_window_set_position(GTK_WINDOW(window),GTK_WIN_POS_CENTER);
button= gtk_button_new_with_label(g_locale_to_utf8("中文",-1,NULL,NULL,NULL));
gtk_container_add(GTK_CONTAINER(window), button);
gtk_widget_show(button);
/*gtk_signal_connect_object(GTK_OBJECT(button),
"clicked",
GTK_SIGNAL_FUNC(on_clicked),
NULL );*/
g_signal_connect(G_OBJECT(button),
"clicked",
G_CALLBACK(on_clicked),
NULL);
gtk_widget_show (window);
gtk_main ();
return(0);
}
button上中文不能正常显示,请赐教
|
down一个windows版的gaim 用它的运行库
|
不知道,帮你顶一下
|
up
|
up