本文整理匯總了C#中Xwt.Label類的典型用法代碼示例。如果您正苦於以下問題:C# Label類的具體用法?C# Label怎麽用?C# Label使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Label類屬於Xwt命名空間,在下文中一共展示了Label類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Splash
public Splash()
{
Decorated = false;
ShowInTaskbar = false;
box = new VBox {
Margin = -2,
};
imageView = new ImageView {
Image = Image.FromResource (Resources.Splash),
};
progressBar = new ProgressBar {
Indeterminate = true,
TooltipText = Catalog.GetString ("Loading..."),
};
info = new Label {
Text = Catalog.GetString ("Loading..."),
TextAlignment = Alignment.Center,
};
box.PackStart (imageView);
box.PackEnd (progressBar);
box.PackEnd (info);
Content = box;
InitialLocation = WindowLocation.CenterScreen;
}
示例2: MenuSamples
public MenuSamples ()
{
Label la = new Label ("Right click here to show the context menu");
menu = new Menu ();
menu.Items.Add (new MenuItem ("One"));
menu.Items.Add (new MenuItem ("Two"));
menu.Items.Add (new MenuItem ("Three"));
menu.Items.Add (new SeparatorMenuItem ());
var rgroup = new RadioButtonMenuItemGroup ();
menu.Items.Add (new RadioButtonMenuItem ("Opt 1") { Group = rgroup, Sensitive = false });
menu.Items.Add (new RadioButtonMenuItem ("Opt 2") { Group = rgroup, Checked = true });
menu.Items.Add (new RadioButtonMenuItem ("Opt 3") { Group = rgroup });
menu.Items.Add (new SeparatorMenuItem ());
menu.Items.Add (new CheckBoxMenuItem ("Check 1"));
menu.Items.Add (new CheckBoxMenuItem ("Check 2") { Checked = true });
menu.Items.Add (new SeparatorMenuItem ());
var subMenu = new MenuItem ("Submenu");
subMenu.SubMenu = new Menu ();
var subZoomIn = new MenuItem (new Command ("Zoom+", StockIcons.ZoomIn));
var subZoomOut = new MenuItem (new Command ("Zoom-", StockIcons.ZoomOut));
subMenu.SubMenu.Items.Add (subZoomIn);
subMenu.SubMenu.Items.Add (subZoomOut);
menu.Items.Add (subMenu);
subZoomIn.Clicked += (sender, e) => MessageDialog.ShowMessage ("'Zoom+' item clicked.");
subZoomOut.Clicked += (sender, e) => MessageDialog.ShowMessage ("'Zoom-' item clicked.");
la.ButtonPressed += HandleButtonPressed;
PackStart (la);
}
示例3: Makeup
public override Xwt.Widget Makeup(IXwtWrapper Parent)
{
Xwt.Label Target = new Xwt.Label()
{
TextAlignment = this.Align,
Text = this.Text,
Ellipsize = this.Ellipsize,
Wrap = this.Wrap
};
if (this.Markup != "")
Target.Markup = this.Markup;
if (this.Color != "")
Target.TextColor = Xwt.Drawing.Color.FromName(this.Color);
//Binding
if (Source != "")
{
Target.Text = (string)PathBind.GetValue(Source, Parent, "");
Parent.PropertyChanged += (o, e) =>
{
if (e.PropertyName == this.Source.Split('.')[0])
Xwt.Application.Invoke(() => Target.Text = (string)PathBind.GetValue(Source, Parent, ""));
};
}
WindowController.TryAttachEvent(Target, "LinkClicked", Parent, LinkClicked);
InitWidget(Target, Parent);
return Target;
}
示例4: ScrollbarSample
public ScrollbarSample ()
{
WidthRequest = 300;
HeightRequest = 300;
canvas = new Canvas ();
label = new Label ("Use the scrollbars\nto move this label");
canvas.AddChild (label);
Add (canvas, 0, 0, hexpand:true, vexpand:true);
vscroll = new VScrollbar () {
LowerValue = 0,
UpperValue = 300,
PageIncrement = 10,
PageSize = 50,
StepIncrement = 1
};
Add (vscroll, 1, 0, vexpand:true);
hscroll = new HScrollbar () {
LowerValue = 0,
UpperValue = 300,
PageIncrement = 10,
PageSize = 50,
StepIncrement = 1
};
Add (hscroll, 0, 1, hexpand:true);
vscroll.ValueChanged += HandleValueChanged;
hscroll.ValueChanged += HandleValueChanged;
}
示例5: DependencyWidget
public DependencyWidget (IConnectedService service, IConnectedServiceDependency dependency)
{
Dependency = dependency;
Service = service;
iconView = new ImageView (dependency.Icon.WithSize (Xwt.IconSize.Small));
nameLabel = new Label (dependency.DisplayName);
statusIconView = new ImageView ();
statusLabel = new Label ();
statusLabel.LinkClicked += (sender, e) => {
if (dependency.Status == Status.NotAdded)
dependency.AddToProject (CancellationToken.None);
e.SetHandled ();
};
container = new HBox ();
container.PackStart (iconView);
container.PackStart (nameLabel);
container.PackStart (statusIconView);
container.PackStart (statusLabel);
Content = container;
Update ();
dependency.StatusChanged += HandleDependencyStatusChange;
service.StatusChanged += HandleServiceStatusChanged;
}
示例6: DependenciesSectionWidget
public DependenciesSectionWidget (IConfigurationSection section)
{
this.section = section;
widget = new VBox ();
if (this.section.Service.Dependencies.Length == 0) {
widget.PackStart (new Label { Text = GettextCatalog.GetString ("This service has no dependencies") });
return;
}
bool firstCategory = true;
foreach (var category in this.section.Service.Dependencies.Select (d => d.Category).Distinct ()) {
var categoryIcon = new ImageView (category.Icon.WithSize (IconSize.Small));
var categoryLabel = new Label (category.Name);
var categoryBox = new HBox ();
if (!firstCategory)
categoryBox.MarginTop += 5;
categoryBox.PackStart (categoryIcon);
categoryBox.PackStart (categoryLabel);
widget.PackStart (categoryBox);
foreach (var dependency in this.section.Service.Dependencies.Where (d => d.Category == category)) {
widget.PackStart (new DependencyWidget (section.Service, dependency) {
MarginLeft = category.Icon.Size.Width / 2
});
}
if (firstCategory)
firstCategory = false;
}
}
示例7: TextEntries
public TextEntries()
{
TextEntry te1 = new TextEntry ();
PackStart (te1);
Label la = new Label ();
PackStart (la);
te1.Changed += delegate {
la.Text = "Text: " + te1.Text;
};
PackStart (new Label ("Entry with small font"));
TextEntry te2 = new TextEntry ();
te2.Font = te2.Font.WithScaledSize (0.5);
PackStart (te2);
PackStart (new Label ("Entry with placeholder text"));
TextEntry te3 = new TextEntry ();
te3.PlaceholderText = "Placeholder text";
PackStart (te3);
PackStart (new Label ("Entry with no frame"));
TextEntry te4 = new TextEntry();
te4.ShowFrame = false;
PackStart (te4);
TextEntry te5 = new TextEntry ();
te5.Text = "I should be centered!";
te5.TextAlignment = Alignment.Center;
PackStart (te5);
}
示例8: DatePickerSample
public DatePickerSample ()
{
var dtp = new DatePicker (DateTime.Now);
PackStart (dtp);
Label la1 = new Label ("Initial Value: " + dtp.DateTime);
PackStart (la1);
dtp.ValueChanged += delegate {
la1.Text = "Value changed: " + dtp.DateTime;
};
var dp = new DatePicker (DatePickerStyle.Date);
PackStart (dp);
Label la2 = new Label ("Initial Value: " + dp.DateTime);
PackStart (la2);
dp.ValueChanged += delegate {
la2.Text = "Value changed: " + dp.DateTime;
};
var tp = new DatePicker (DatePickerStyle.Time, DateTime.MinValue);
PackStart (tp);
Label la3 = new Label ("Initial Value: " + tp.DateTime);
PackStart (la3);
tp.ValueChanged += delegate {
la3.Text = "Value changed: " + tp.DateTime;
};
}
示例9: Build
private void Build()
{
this.Icon = Xwt.Drawing.Image.FromResource("URMSimulator.Resources.urm.png");
this.Title = "About";
this.Resizable = false;
this.Buttons.Add(new DialogButton(Command.Close));
vbox1 = new VBox();
image1 = new ImageView();
image1.WidthRequest = 320;
image1.HeightRequest = 270;
vbox1.PackStart(image1);
labelProgramName = new Label();
labelProgramName.TextAlignment = Alignment.Center;
vbox1.PackStart(labelProgramName);
labelComments = new Label();
labelComments.TextAlignment = Alignment.Center;
vbox1.PackStart(labelComments);
hbox1 = new HBox();
hbox1.PackStart(new HBox(), true);
labelWebsite = new LinkLabel();
labelWebsite.TextAlignment = Alignment.Center; //text aligment doesn't work with Xwt.WPF
hbox1.PackStart(labelWebsite, false);
hbox1.PackStart(new HBox(), true);
vbox1.PackStart(hbox1);
this.Content = vbox1;
}
示例10: PluginTitleWidget
public PluginTitleWidget(PluginType type)
{
PluginType = type;
label = new Label()
{
Text = type.GetName(),
TextColor = type.GetColor(),
Font = Font.WithScaledSize(2d),
HeightRequest = 30,
WidthRequest = 400,
};
MarginTop = 8;
HeightRequest = 30;
WidthRequest = 400;
AddChild(label, 0, 0);
if (App.InitOpacityAnimation != null)
{
Opacity = 0;
App.InitOpacityAnimation(this);
}
}
示例11: 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;
}
示例12: RadioButtonSample
public RadioButtonSample()
{
var b1 = new RadioButton ("Item 1");
var b2 = new RadioButton ("Item 2");
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");
PackStart (b4);
PackStart (b5);
b4.Group = b5.Group;
}
示例13: Labels
public Labels()
{
Label la = new Label ("Simple label");
PackStart (la);
la = new Label ("Label with red background") {
BackgroundColor = new Xwt.Drawing.Color (1, 0, 0)
};
PackStart (la);
la = new Label ("Label with red background and blue foreground") {
BackgroundColor = new Xwt.Drawing.Color (1, 0, 0),
TextColor = new Xwt.Drawing.Color (0, 0, 1)
};
PackStart (la);
la = new Label ("A crazy long label text with a lots of content and information in it but fortunately it should appear wrapped");
la.Wrap = WrapMode.Word;
PackStart (la);
la = new Label ("Another Label with red background") {
BackgroundColor = new Xwt.Drawing.Color (1, 0, 0),
TextColor = new Xwt.Drawing.Color (0, 0, 1)
};
PackStart (la);
la = new Label () { Markup = "Label with <b>bold</b> and <span color='#ff0000'>red</span> text" };
PackStart (la);
la = new Label () { Markup = "Label with a <a href='http://xamarin.com'>link</a> to a web site." };
PackStart (la);
}
示例14: AddPluginWidget
public AddPluginWidget(PluginType type)
{
PluginType = type;
HeightRequest = PluginWidget.Size.Height;
WidthRequest = PluginWidget.Size.Width;
Margin = PluginWidget.Margin;
Cursor = CursorType.Hand;
Label l = new Label("Add new " + type.GetName());
//l.TextColor = type.GetColor();
l.TextAlignment = Alignment.Center;
AddChild(l, new Rectangle(0, 0, PluginWidget.Size.Width, PluginWidget.Size.Height));
BackgroundColor = type.GetBGColor();
if (App.InitDropShadow != null)
App.InitDropShadow(this);
if (App.InitOpacityAnimation != null)
{
Opacity = 0;
App.InitOpacityAnimation(this);
}
}
示例15: AlignCenter
public void AlignCenter ()
{
var la = new Label ("Some text here");
la.TextAlignment = Alignment.Center;
la.BackgroundColor = Xwt.Drawing.Colors.LightGray;
CheckWidgetRender ("Label.AlignCenter.png", la);
}