本文整理汇总了C#中Label.Show方法的典型用法代码示例。如果您正苦于以下问题:C# Label.Show方法的具体用法?C# Label.Show怎么用?C# Label.Show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Label
的用法示例。
在下文中一共展示了Label.Show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MainWindow
public MainWindow()
: base(Gtk.WindowType.Toplevel)
{
Application.Init ();
this.Resize(640,480);
//menu bar very top
MenuBar mb = new MenuBar ();
Menu fileMenu = new Menu ();
MenuItem menuItem = new MenuItem ("_File");
menuItem.Submenu = fileMenu;
mb.Append(menuItem);
MenuItem menuFileQuit = new MenuItem("Quit");
fileMenu.Append(menuFileQuit);
vboxMain.PackStart(mb,false,false,0);
//toolbar
Toolbar tbTop = new Toolbar ();
//toolbutton Staff
ToolButton tbStaff = new ToolButton (Gtk.Stock.OrientationPortrait);
tbStaff.Label="Staff";
tbStaff.IsImportant=true;
tbStaff.Clicked += HandleTbStaffClicked;
tbTop.Insert(tbStaff,0);
//toolbutton Clients
ToolButton tbClients = new ToolButton (Gtk.Stock.About);
tbClients.Label="Clients";
tbClients.IsImportant=true;
tbClients.Clicked+= HandleTbClientsClicked;
tbTop.Insert(tbClients,1);
//media bar
Label lbMediaTemp = new Label ();
lbMediaTemp.Text="Media holder";
lbMediaTemp.Show();
//pack the toolbar and media bar in the top hbox//
hbTop.PackStart(tbTop);
hbTop.PackStart(lbMediaTemp);
//pack the top hbox in the main vbox
vboxMain.PackStart(hbTop,false,false,1);
// horizontal pane
verticalPane.Position=200;
verticalPane.Pack1(scrollWindowLeft,false,false);
verticalPane.Pack2(scrollWindowRight,false,false);
vboxMain.PackStart(verticalPane);
scrollWindowLeft.Add(viewPortLeft);
scrollWindowRight.Add(viewPortRight);
Label lbMain = new Label ();
lbMain.Text= "main";
viewPortRight.Add(lbMain);
verticalPane.ShowAll();
//status bar very bottom
Statusbar sb = new Statusbar ();
vboxMain.PackStart(sb,false,false,1);
this.Add(vboxMain);
//hb1.Add(tbTop);
this.ShowAll ();
Build ();
}
示例2: RadioButtonSample
public RadioButtonSample()
{
var b1 = new RadioButton ("Item 1");
var b2 = new RadioButton ("Item 2 (red background)");
b2.BackgroundColor = Xwt.Drawing.Colors.Red;
var b3 = new RadioButton ("Item 3");
b2.Group = b3.Group = b1.Group;
PackStart (b1);
PackStart (b2);
PackStart (b3);
var la = new Label ();
la.Hide ();
b1.Group.ActiveRadioButtonChanged += delegate {
la.Show ();
la.Text = "Active: " + b1.Group.ActiveRadioButton.Label;
};
PackStart (la);
PackStart (new HSeparator ());
var box = new VBox ();
box.PackStart (new Label ("First Option"));
box.PackStart (new Label ("Second line"));
var b4 = new RadioButton (box);
var b5 = new RadioButton ("Second Option");
var b6 = new RadioButton ("Disabled Option") { Sensitive = false };
PackStart (b4);
PackStart (b5);
PackStart (b6);
b4.Group = b5.Group = b6.Group;
}
示例3: Main
public static void Main(string[] args)
{
Gtk.Window window;
EventBox eventbox;
Label label;
Application.Init();
window = new Gtk.Window ("Eventbox");
window.DeleteEvent += new DeleteEventHandler (delete_event);
window.BorderWidth = 10;
window.Resize(400,300);
eventbox = new EventBox ();
window.Add (eventbox);
eventbox.Show();
label = new Label ("Click here to quit");
eventbox.Add(label);
label.Show();
label.SetSizeRequest(110, 20);
eventbox.ButtonPressEvent += new ButtonPressEventHandler (exitbutton_event);
eventbox.Realize();
window.Show();
Application.Run();
}
示例4: Agregar
void Agregar( object o, EventArgs args )
{
// crear dialogo
Dialog dialog = new Dialog ("Agregar", window, Gtk.DialogFlags.DestroyWithParent);
dialog.Modal = true;
dialog.AddButton ("Aceptar", ResponseType.Ok);
dialog.AddButton ("Cerrar", ResponseType.Close);
Label lab = new Label("Información que desea agregar:");
lab.Show();
dialog.VBox.PackStart (lab , true, true, 5 );
Table table = new Table (2, 2, false);
Label labNombre = new Label("Nombre:");
labNombre.Show();
table.Attach(labNombre , 0, 1, 0, 1);
entryNombre = new Entry();
entryNombre.Show();
table.Attach(entryNombre, 1, 2, 0, 1);
Label labApe = new Label("Apellidos:");
labApe.Show();
table.Attach(labApe , 0, 1, 1, 2);
entryApe = new Entry();
entryApe.Show();
table.Attach(entryApe , 1, 2, 1, 2);
table.Show();
dialog.VBox.PackStart (table, true, true, 5 );
dialog.Response += new ResponseHandler (on_dialog_agregar);
dialog.Run ();
dialog.Destroy ();
}
示例5: AttachLabel
static private Label AttachLabel (Table table, int row_num, Widget entry)
{
Label label = new Label (String.Empty);
label.Xalign = 0;
label.Selectable = true;
label.Ellipsize = Pango.EllipsizeMode.End;
label.Show ();
table.Attach (label, 1, 2, (uint) row_num, (uint) row_num + 1,
AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill,
(uint) entry.Style.XThickness + 3, (uint) entry.Style.YThickness);
return label;
}
示例6: Execute
public bool Execute(PhotoStore store, Photo photo, Gtk.Window parent_window)
{
// FIXME HIG-ify.
Dialog dialog = new Dialog ();
dialog.BorderWidth = 6;
dialog.TransientFor = parent_window;
dialog.HasSeparator = false;
dialog.Title = Catalog.GetString ("Really Delete?");
dialog.AddButton (Catalog.GetString ("Cancel"), (int) ResponseType.Cancel);
dialog.AddButton (Catalog.GetString ("Delete"), (int) ResponseType.Ok);
dialog.DefaultResponse = ResponseType.Ok;
string version_name = photo.GetVersion (photo.DefaultVersionId).Name;
Label label = new Label (String.Format (Catalog.GetString ("Really delete version \"{0}\"?"), version_name));
label.Show ();
dialog.VBox.PackStart (label, false, true, 6);;
if (dialog.Run () == (int) ResponseType.Ok) {
try {
photo.DeleteVersion (photo.DefaultVersionId);
store.Commit (photo);
} catch (Exception e) {
Log.DebugException (e);
string msg = Catalog.GetString ("Could not delete a version");
string desc = String.Format (Catalog.GetString ("Received exception \"{0}\". Unable to delete version \"{1}\""),
e.Message, photo.Name);
HigMessageDialog md = new HigMessageDialog (parent_window, DialogFlags.DestroyWithParent,
Gtk.MessageType.Error, ButtonsType.Ok,
msg,
desc);
md.Run ();
md.Destroy ();
dialog.Destroy (); // Delete confirmation window.
return false;
}
dialog.Destroy ();
return true;
}
dialog.Destroy ();
return false;
}
示例7: SharpApp
public SharpApp()
: base("EventBox Example")
{
SetDefaultSize(230,150);
SetPosition(WindowPosition.Center);
DeleteEvent += delegate {Application.Quit();};
EventBox ebox = new EventBox();
Add(ebox);
ebox.Show();
Label label = new Label("Do Not Touch");
ebox.Add(label);
label.Show();
label.SetSizeRequest(110,20);
ebox.ButtonPressEvent += delegate{ System.Console.WriteLine("Hello");};
ebox.Realize();
Show();
}
示例8: SettingsPage_Load
public void SettingsPage_Load(object sender, EventArgs e)
{
windowSize = Util.getSizeOfSettingsPage();
BackColor = System.Drawing.Color.FromArgb(255, 255, 255);
sourceExtensionLabel = new Label();
sourceExtensionLabel.Text = "Source extension: ";
sourceExtensionLabel.Bounds = Util.getBoundsOfSourceExtensionLabel(Width, Height);
sourceExtensionLabel.Show();
sourceExtensionLabel.Visible = true;
Controls.Add(sourceExtensionLabel);
objectExtensionLabel = new Label();
objectExtensionLabel.Text = "Object extension: ";
objectExtensionLabel.Bounds = Util.getBoundsOfObjectExtensionLabel(Width, Height);
objectExtensionLabel.Show();
objectExtensionLabel.Visible = true;
Controls.Add(objectExtensionLabel);
sourceExtensionTextBox = new TextBox();
sourceExtensionTextBox.Text = ".cc";
sourceExtensionTextBox.Bounds = Util.getBoundsOfSourceExtensionTextBox(Width, Height);
sourceExtensionTextBox.Show();
sourceExtensionTextBox.Visible = true;
sourceExtensionTextBox.TextChanged += new System.EventHandler(SourceExtensionTextBox_TextChanged);
Controls.Add(sourceExtensionTextBox);
objectExtensionTextBox = new TextBox();
objectExtensionTextBox.Text = ".o";
objectExtensionTextBox.Bounds = Util.getBoundsOfObjectExtensionTextBox(Width, Height);
objectExtensionTextBox.Show();
objectExtensionTextBox.Visible = true;
objectExtensionTextBox.TextChanged += new System.EventHandler(ObjectExtensionTextBox_TextChanged);
Controls.Add(objectExtensionTextBox);
MinimumSize = windowSize;
Size = windowSize;
}
示例9: Button_Click_1
private void Button_Click_1(object sender, RoutedEventArgs e)
{
Label window = new Label();
window.Show();
}
示例10: HandleTbStaffClicked
void HandleTbStaffClicked(object sender, EventArgs e)
{
//set up search input
tbSearch=new Entry ();
tbSearch.KeyReleaseEvent+= HandleTbSearchKeyReleaseEvent;
viewPortLeft.Remove(viewPortLeft.Child);
hboxSearch = new HBox ();
vboxVpLeft = new VBox ();
Button btSearchGo = new Button ();
btSearchGo.Clicked+= HandleBtSearchGoClicked;
btSearchGo.Label="Go";
viewPortLeft.Remove(viewPortLeft.Child);
Label lbStaff = new Label ();
lbStaff.Text="im the staff bit";
viewPortLeft.Add(vboxVpLeft);
hboxSearch.PackStart(tbSearch,true,true,1);
hboxSearch.PackStart(btSearchGo,false,false,1);
vboxVpLeft.PackStart(hboxSearch,false,false,1);
viewPortLeft.Show();
lbStaff.Show();
tbSearch.Show();
vboxVpLeft.ShowAll();
Console.WriteLine("staff clicked");
}
示例11: HandleTbClientsClicked
void HandleTbClientsClicked(object sender, EventArgs e)
{
viewPortRight.Remove(viewPortLeft.Child);
Label lbClients =new Label ();
lbClients.Text ="Im the clients bit";
viewPortLeft.Remove(viewPortLeft.Child);
viewPortLeft.Add(lbClients);
viewPortLeft.Show();
lbClients.Show();
Console.WriteLine("Clients Clicked");
staff s = new staff ();
List<staff> staffList = new List<staff>();
staffList= s.get_all_staff_members();
foreach(staff sm in staffList)
{
Console.WriteLine(sm.fName);
}
}
示例12: Main
public static void Main(string[] args)
{
if(args.Length != 1) {
Console.WriteLine("Usage: gtkHelloWorld num, where num is 1, 2, or 3");
return(1);
}
int which = Convert.ToInt32(args[0]);
var window = new Window("packingdemo");
window.DeleteEvent += Delete_Event;
window.BorderWidth = 10;
var box1 = new VBox(false, 0);
switch(which) {
case 1:
var label = new Label("gtk_hbox_new(FALSE, 0);");
var box2 = new HBox(false, 0);
label.SetAlignment(0, 0);
box1.PackStart(label, false, false, 0);
label.Show();
box2 = MakeBox(false, 0, false, false, 0);
box1.PackStart(box2, false, false, 0);
box2.Show();
box2 = MakeBox(false, 0, true, false, 0);
box1.PackStart(box2, false, false, 0);
box2.Show();
box2 = MakeBox(false, 0, true, true, 0);
box1.PackStart(box2, false, false, 0);
box2.Show();
var separator = new HSeparator();
box1.PackStart(separator, false, true, 5);
separator.Show();
box1 = new VBox(true, 0);
label = new Label("gtk_hbox_new(TRUE, 0);");
label.SetAlignment(0, 0);
box1.PackStart(label, false, false, 0);
label.Show();
box2 = MakeBox(true, 0, true, true, 0);
box1.PackStart(box2, false, false, 0);
box2.Show();
box2 = MakeBox(true, 0, true, true, 0);
box1.PackStart(box2, false, false, 0);
box2.Show();
separator = new HSeparator();
box1.PackStart(separator, false, true, 5);
separator.Show();
break;
case 2:
break;
}
}
示例13: NotificationWidget
public NotificationWidget()
: base()
{
HBox box = new HBox ();
label = new Label ();
label.Xalign = 0;
closeButton = new Button ();
closeButton.Image =
new Image (Stock.Close,
IconSize.Button);
closeButton.Clicked += on_close;
acceptButton = new Button (Stock.Ok);
acceptButton.Image =
new Image (Stock.Ok, IconSize.Button);
acceptButton.Clicked += on_accept;
ModifyBg (StateType.Normal,
new Gdk.Color (0xff, 0xff, 0xc0));
box.PackStart (label, true, true, 5);
box.PackStart (acceptButton, false, false,
5);
box.PackStart (closeButton, false, false,
5);
label.Show ();
closeButton.Show ();
// This box will add some vertical padding
VBox b = new VBox ();
b.PackStart (box, false, true, 5);
Add (b);
}
示例14: OnTogglebuttonToggled
protected void OnTogglebuttonToggled(object sender, System.EventArgs e)
{
if (addNewOperation_togglebutton.Active)
{
Menu menu = new Menu();
int w, h;
menu.GetSizeRequest(out w, out h);
int menu_width = left_vbox.Allocation.Width;
menu.SetSizeRequest(menu_width, h);
Dictionary<MenuItem, Type> stage_operation_types = new Dictionary<MenuItem, Type>();
for (int i = 0; i < mStageOperationTypes.Length; i++)
{
string name = StageOperationDescriptionAttribute.GetName(mStageOperationTypes[i]);
if (name == null) name = mStageOperationTypes[i].Name;
string description = StageOperationDescriptionAttribute.GetDescription(mStageOperationTypes[i]);
MenuItem item = new MenuItem();
VBox item_vbox = new VBox();
item_vbox.BorderWidth = 4;
item_vbox.Show();
Label lbl_name = new Label();
lbl_name.Text = name;
lbl_name.Justify = Justification.Left;
lbl_name.Xalign = 0;
// Setting the name font
double name_size_k = 1.1;
Pango.FontDescription name_fd = FontHelpers.ScaleFontSize(lbl_name, name_size_k);
name_fd.Weight = Pango.Weight.Bold;
lbl_name.ModifyFont(name_fd);
item_vbox.Add(lbl_name);
lbl_name.Show();
if (description != null && description != "")
{
Label lbl_desc = new Label(description);
lbl_desc.LineWrapMode = Pango.WrapMode.Word;
lbl_desc.LineWrap = true;
lbl_desc.Wrap = true;
// Setting the description font
double desc_size_k = 0.9;
Pango.FontDescription desc_fd = FontHelpers.ScaleFontSize(lbl_desc, desc_size_k);
lbl_desc.ModifyFont(desc_fd);
item_vbox.Add(lbl_desc);
lbl_desc.Show();
item_vbox.SizeAllocated += delegate(object o, SizeAllocatedArgs args) {
lbl_desc.WidthRequest = args.Allocation.Width - 10;
};
}
item.Child = item_vbox;
stage_operation_types.Add(item, mStageOperationTypes[i]);
item.Activated += delegate(object s, EventArgs ea) {
mStage.CreateAndAddNewItem(stage_operation_types[(MenuItem)s]).Active = true;
GtkScrolledWindow.HscrollbarPolicy = PolicyType.Never;
GtkScrolledWindow.Vadjustment.Value = GtkScrolledWindow.Vadjustment.Upper;
ArrangeVBoxes();
};
menu.Append(item);
item_vbox.CheckResize();
//lbl_desc.WidthRequest = ww;
}
menu.Deactivated += delegate {
addNewOperation_togglebutton.Active = false;
};
menu.ShowAll();
menu.Popup(null, null, delegate (Menu m, out int x, out int y, out bool push_in) {
int x1, y1, x0, y0;
GdkWindow.GetOrigin(out x0, out y0);
left_vbox.TranslateCoordinates(this, 0, 0, out x1, out y1);
x = x0 + x1;
y = y0 + y1;
push_in = false;
}, 0, 0);
}
}
示例15: MakeMonitor_Load
public void MakeMonitor_Load(object sender, EventArgs e)
{
sourceExtension = ".cc";
objectExtension = ".o";
backgroundWorker = new System.ComponentModel.BackgroundWorker();
backgroundWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(backgroundWorker_DoWork);
backgroundWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(backgroundWorker_RunWorkerCompleted);
fileSystemWatcher = new System.IO.FileSystemWatcher();
((System.ComponentModel.ISupportInitialize)(fileSystemWatcher)).BeginInit();
fileSystemWatcher.EnableRaisingEvents = true;
fileSystemWatcher.SynchronizingObject = this;
BackColor = System.Drawing.Color.FromArgb(255, 255, 255);
searchTextBox = new TextBox();
searchTextBox.Bounds = Util.getBoundsOfSearchTextBox(Width, Height);
searchTextBox.Show();
searchTextBox.Visible = true;
Controls.Add( searchTextBox );
searchTextBox.TextChanged += new System.EventHandler(SearchTextBox_TextChanged);
pathLabel = new Label();
pathLabel.Text = "Enter path above.";
pathLabel.Bounds = Util.getBoundsOfPathLabel(Width, Height);
pathLabel.Show();
pathLabel.Visible = true;
Controls.Add(pathLabel);
progressBar = new ProgressBar();
progressBar.Bounds = Util.getBoundsOfProgressBar(Width, Height);
progressBar.Margin = new Padding(0);
progressBar.BackColor = System.Drawing.Color.FromArgb(255, 255, 255);
progressBar.ForeColor = System.Drawing.Color.FromArgb(255, 255, 255);
progressBar.Show();
progressBar.Visible = true;
Controls.Add(progressBar);
percentageLabel = new Label();
percentageLabel.Text = "0%";
percentageLabel.Bounds = Util.getBoundsOfPercentageLabel(Width, Height);
percentageLabel.Show();
percentageLabel.Visible = true;
Controls.Add(percentageLabel);
statusLabel = new Label();
statusLabel.Text = "";
statusLabel.Bounds = Util.getBoundsOfStatusLabel(Width, Height);
statusLabel.ForeColor = System.Drawing.Color.FromArgb(0, 128, 0);
statusLabel.Visible = true;
statusLabel.Show();
Controls.Add(statusLabel);
errorLabel = new Label();
errorLabel.Text = "";
errorLabel.Bounds = Util.getBoundsOfErrorLabel(Width, Height);
errorLabel.ForeColor = System.Drawing.Color.FromName("Red");
errorLabel.Visible = true;
errorLabel.Show();
Controls.Add(errorLabel);
MinimumSize = Util.getMinimumSizeOfMainPage();
Size = Util.getSizeOfMainPage();
Menu = new MainMenu();
MenuItem settings = new MenuItem("&Settings");
settings.Click += new System.EventHandler(settings_Click);
Menu.MenuItems.Add(settings);
((System.ComponentModel.ISupportInitialize)(fileSystemWatcher)).EndInit();
}