标签:des style http io color ar os sp for
/*
我已经把代码写在此处 希望借鉴和完善!一起加油奥(PS:我的QQ是1693672542欢迎加我一起进行探讨学习奥!!!)
*/
#include <stdio.h>
#include<gtk/gtk.h>
int main(int argc, char *argv[])
{
gtk_init(NULL,NULL);
GtkWidget *window=gtk_window_new(GTK_WINDOW_TOPLEVEL);//创建窗口
gtk_window_set_title(window,"欢迎加入如鹏网(www.rupeng.com)");//设置标题栏
//采用网格布局
GtkGrid *grid=gtk_grid_new();
gtk_container_add(window,grid);
gtk_widget_show(grid);
//创建第一个标签
GtkLabel *labelname=gtk_label_new("用户名:");
gtk_grid_attach(grid,labelname,0,0,1,1);
gtk_widget_show(labelname);
//创建第一个文本框
GtkEntry *entryname=gtk_entry_new();
gtk_grid_attach(grid,entryname,1,0,2,1);
gtk_widget_show(entryname);
//创建第二个标签
GtkLabel *labelsex=gtk_label_new("性别:");
gtk_grid_attach(grid,labelsex,0,1,1,1);
gtk_widget_show(labelsex);
//创建第二个文本框
GtkEntry *entrysex=gtk_entry_new();
gtk_grid_attach(grid,entrysex,1,1,2,1);
gtk_widget_show(entrysex);
//创建第三个标签
GtkLabel *labelcode=gtk_label_new("密码:");
gtk_grid_attach(grid,labelcode,0,2,1,1);
gtk_widget_show(labelcode);
//创建第三个文本框
GtkEntry *entrycode=gtk_entry_new();
gtk_grid_attach(grid,entrycode,1,2,2,1);
gtk_widget_show(entrycode);
//创建第一个按钮(隐藏起来)
GtkButton *buttonhide1=gtk_button_new();
gtk_button_set_label(buttonhide1,"");
gtk_grid_attach(grid,buttonhide1,0,3,1,1);
gtk_widget_hide(buttonhide1);
//创建第二个按钮(登陆)
GtkButton *buttonland=gtk_button_new();
gtk_button_set_label(buttonland,"登陆");
gtk_grid_attach(grid,buttonland,1,3,1,1);
gtk_widget_show(buttonland);
//创建第三个按钮(关闭)
GtkButton *buttonclose=gtk_button_new();
gtk_button_set_label(buttonclose,"关闭");
gtk_grid_attach(grid,buttonclose,2,3,1,1);
gtk_widget_show(buttonclose);
gtk_widget_set_size_request(window,350,70);
gtk_window_set_position(window,GTK_WIN_POS_CENTER_ALWAYS);//窗口显示在屏幕正中央
gtk_widget_show(window);//显示窗口
g_signal_connect(window,"destroy",gtk_main_quit,NULL);//销毁窗口
gtk_main();
return 0;
}
标签:des style http io color ar os sp for
原文地址:http://www.cnblogs.com/xiaoweiwangwang/p/4082675.html