本文整理汇总了C#中System.Windows.Controls.Label类的典型用法代码示例。如果您正苦于以下问题:C# Label类的具体用法?C# Label怎么用?C# Label使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Label类属于System.Windows.Controls命名空间,在下文中一共展示了Label类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Plateau
//Nous avons besoin : lignes, colonnes , score, lignes remplies et quelques effets
public Plateau(Grid TetrisGrid)
{
//État actuel des valeurs , les lignes et les colonnes sont à compter,
//elles ont déjà été déclarés dans le fichier XAML.
Lignes = TetrisGrid.RowDefinitions.Count;
Colonnes = TetrisGrid.ColumnDefinitions.Count;
Score = 0;
LignesRemplies = 0;
BlockControls = new Label[Colonnes, Lignes];
for (int i = 0; i < Colonnes; i++)
{
for (int j = 0; j < Lignes; j++)
{
BlockControls[i, j] = new Label();
BlockControls[i, j].Background = Nocolor;
BlockControls[i, j].BorderBrush = BlackColor;
BlockControls[i, j].BorderThickness = new Thickness(0.3, 0.3, 0.3, 0.3);
Grid.SetRow(BlockControls[i, j], j);
Grid.SetColumn(BlockControls[i, j], i);
TetrisGrid.Children.Add(BlockControls[i, j]);
}
}
Piece = new Piece();
pieceDessin();
}
示例2: FenetreIngredients
/// <summary>
/// Constructeur par défaut de la classe.
/// </summary>
/// <param name="plat">Un plat.</param>
/// <param name="nbPersonnes">Le nombre de personnes.</param>
public FenetreIngredients(Plat plat, int nbPersonnes)
{
CultureManager.UICultureChanged += CultureManager_UICultureChanged;
InitializeComponent();
PlatCourant = plat;
NbrPersonnes = nbPersonnes;
int nbRangees = plat.ListeIngredients.Count + 1;
GenererRangees(nbRangees);
Label entete = new Label();
entete.FontSize = 18;
entete.FontWeight = FontWeights.Bold;
entete.Content = plat.Nom;
grdIngredients.Children.Add(entete);
AfficherIngredients(new List<Aliment>(PlatCourant.ListeIngredients), nbPersonnes);
btnCalculatrice = new Button();
btnCalculatrice.Content = Nutritia.UI.Ressources.Localisation.FenetreIngredient.Calculatrice;
btnCalculatrice.Width = 150;
btnCalculatrice.Height = 25;
btnCalculatrice.FontSize = 16;
Thickness margin = new Thickness();
margin.Top = 10;
btnCalculatrice.Margin = margin;
btnCalculatrice.Style = FindResource("fontNutritia") as Style;
btnCalculatrice.Click += new RoutedEventHandler(btnCalculatrice_Click);
Grid.SetRow(btnCalculatrice, nbRangees);
grdIngredients.Children.Add(btnCalculatrice);
}
示例3: GenereateFields
public static void GenereateFields()
{
// Get the Grid from the MainWindow
Grid AuthenticationGrid = ((MainWindow)System.Windows.Application.Current.MainWindow).AuthenticationGrid;
// Build a list of Digest Auth Fields
List<string> fields = new List<string>();
fields.Add("Username");
fields.Add("Password");
for (int i = 0; i < fields.Count; i++)
{
// Add a row to the AuthGrid
RowDefinition rowDefinition = new RowDefinition();
rowDefinition.Height = GridLength.Auto;
AuthenticationGrid.RowDefinitions.Add(rowDefinition);
// Add a Label
Label label = new Label();
label.SetValue(Grid.RowProperty, i + 1);
label.SetValue(Grid.ColumnProperty, 0);
label.Name = "AuthenticationKey" + i;
label.Content = fields[i] + ":";
AuthenticationGrid.Children.Add(label);
// Add a textbox
TextBox textBox = new TextBox();
textBox.SetValue(Grid.RowProperty, i + 1);
textBox.SetValue(Grid.ColumnProperty, 1);
textBox.Name = "AuthenticationValue" + i;
AuthenticationGrid.Children.Add(textBox);
}
}
示例4: Star
public Star()
{
centerX = 285;
centerY = 285;
starGFX = new Ellipse();
starSEL = new Ellipse();
starCanvas = new Canvas();
starLabel = new Label();
starSEL.Visibility = Visibility.Hidden;
starGFX.Fill = backgroundBrush;
starLabel.FontFamily = new FontFamily(new Uri("pack://application:,,,/Fonts/"), "./#Euro Caps");
starLabel.Foreground = backgroundBrush;
starCanvas.Children.Add(starGFX);
starCanvas.Children.Add(starLabel);
starCanvas.Children.Add(starSEL);
movePoint = new Point3D(0,0,0);
rotaPoint = new Point3D(0,0,0);
starCanvas.PreviewMouseDown += MoveToSystem;
}
示例5: ContentCardImage
public ContentCardImage(Canvas parent_canvas, Color highlight_color, ExplorerContentImage explorer_image)
: base(parent_canvas, highlight_color)
{
explorerImage = explorer_image;
StackPanel background = new StackPanel();
background.Orientation = Orientation.Vertical;
background.Background = new SolidColorBrush(Color.FromRgb(255, 255, 255));
background.Margin = new Thickness(5);
Image image = explorerImage.getImage();
image.MaxWidth = 300;
image.MaxHeight = 400;
image.Margin = new Thickness(0, 0, 0, 5);
background.Children.Add(image);
Label caption = new Label();
caption.Content = explorerImage.getName();
caption.FontSize = 20;
caption.MaxWidth = 300;
caption.FontWeight = FontWeights.Bold;
background.Children.Add(caption);
setContent(background);
}
示例6: Star
public Star()
{
starColor = foregroundBrush;
starGFX = new Ellipse();
starSEL = new Ellipse();
starCanvas = new Canvas();
starLabel = new Label();
starSEL.Visibility = Visibility.Hidden;
starGFX.Fill = foregroundBrush;
starLabel.FontFamily = new FontFamily(new Uri("pack://application:,,,/Fonts/"), "./#Euro Caps");
starLabel.Foreground = fontBrush;
starCanvas.Children.Add(starLabel);
starCanvas.Children.Add(starGFX);
starCanvas.Children.Add(starSEL);
movePoint = new Point3D(0,0,0);
rotaPoint = new Point3D(0,0,0);
starCanvas.MouseLeftButtonDown += SetSelection;
starCanvas.MouseRightButtonDown +=TargetSelection;
starCanvas.MouseEnter += ShowInfoSelection;
starCanvas.MouseLeave += HideInfoSelection;
}
示例7: SetThisContent
protected override void SetThisContent()
{
Grid grid_main = new Grid();
grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
grid_main.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
////////
// Id
m_textBlock_id = new TextBlock() { VerticalAlignment = VerticalAlignment.Center };
Label label_id = new Label() { Content = "Id: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
Grid grid_id = new Grid();
grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
grid_id.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
grid_id.SetRowColumn(m_textBlock_id, 0, 1);
grid_id.SetRowColumn(label_id, 0, 0);
grid_main.SetRowColumn(grid_id, 0, 0);
////////
// Name
m_textBox_name = new TextBox() { VerticalAlignment = VerticalAlignment.Center };
ValidatorPanel validator_name = new ValidatorPanel(m_textBox_name, TextBox.TextProperty, new Validate_StringIsNotNullOrEmpty());
Label label_name = new Label() { Content = "Name: ", FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center };
Grid grid_name = new Grid();
grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
grid_name.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
grid_name.SetRowColumn(validator_name, 1, 0);
grid_name.SetRowColumn(label_name, 0, 0);
grid_main.SetRowColumn(grid_name, 1, 0);
////////
// FIN
ThisContent = new ActivatableContent() { Content = grid_main, FirstFocus = m_textBox_name, Validators = new ValidatorBase[] {
validator_name
}};
}
示例8: Board
public Board(Grid TetrisGrid)
{
rows = TetrisGrid.RowDefinitions.Count;
cols = TetrisGrid.ColumnDefinitions.Count;
score = 0;
linesFilled = 0;
blockControls = new Label[cols, rows];
for (int i = 0; i < cols; i++)
{
for (int j = 0; j < rows; j++)
{
blockControls[i, j] = new Label();
blockControls[i, j].Background = NoBrush;
blockControls[i, j].BorderThickness = new Thickness(1, 1, 1, 1);
Grid.SetColumn(blockControls[i, j], j);
Grid.SetRow(blockControls[i, j], i);
TetrisGrid.Children.Add((blockControls[i, j]));
}
}
currTetrimino = new Tetrimino();
currTetriminoDraw();
}
示例9: CheckBoxContent
public CheckBoxContent(String path, String content, RoutedEventHandler checkBoxHandler, string thumbnail, int start, int end, UInt32 uniqueId)
: this(path, content, checkBoxHandler)
{
UniqueIdLabel = new Label();
UniqueIdLabel.Padding = new Thickness(0, 0, 0, 0);
UniqueIdLabel.Margin = new Thickness(4, 0, 0, 4);
UniqueIdLabel.VerticalAlignment = System.Windows.VerticalAlignment.Center;
UniqueId = uniqueId;
Thumbnail = new Image();
Thumbnail.Margin = new Thickness(2, 0, 0, 2);
Thumbnail.Width = 128;
Thumbnail.VerticalAlignment = System.Windows.VerticalAlignment.Center;
if (!String.IsNullOrEmpty(thumbnail) && File.Exists(thumbnail))
{
Thumbnail.Source = new BitmapImage(new Uri(thumbnail));
}
StartTextBox = new TextBox();
StartTextBox.Padding = new Thickness(0, 0, 0, 0);
StartTextBox.Margin = new Thickness(2, 0, 0, 2);
StartTextBox.VerticalAlignment = System.Windows.VerticalAlignment.Center;
Start = start;
EndTextBox = new TextBox();
EndTextBox.Padding = new Thickness(0, 0, 0, 0);
EndTextBox.Margin = new Thickness(2, 0, 0, 2);
EndTextBox.VerticalAlignment = System.Windows.VerticalAlignment.Center;
End = end;
Children.Insert(1, EndTextBox);
Children.Insert(1, StartTextBox);
Children.Insert(1, Thumbnail);
Children.Insert(1, UniqueIdLabel);
}
示例10: button2_Click
private void button2_Click(object sender, RoutedEventArgs e)
{
Label itemname = new Label();
itemname.Width = wrapPanel1.Width*(0.2f);
itemname.Content = "Item Name";
TextBox itemval = new TextBox();
itemval.Width = wrapPanel1.Width * (0.2f);
Label itemnamet = new Label();
itemnamet.Width = wrapPanel1.Width * (0.2f);
itemnamet.Content = "Type";
TextBox itemvalt = new TextBox();
itemvalt.Width = wrapPanel1.Width * (0.2f);
ComponentItem citem = new ComponentItem();
citem.lb = itemname;
citem.tb = itemval;
citem.lbtype = itemnamet;
citem.tbtype = itemvalt;
items.Add(citem);
wrapPanel1.Children.Add(itemname);
wrapPanel1.Children.Add(itemval);
wrapPanel1.Children.Add(itemnamet);
wrapPanel1.Children.Add(itemvalt);
}
示例11: ProcessorFamily
public ProcessorFamily(Panel parentPanel, int idx, string name)
{
Index = idx;
Name = name;
SelectedProcessor = null;
LabelName = new Label();
LabelName.Content = "Choose " + name;
DockPanel.SetDock(LabelName, Dock.Top);
LabelName.Height = 30.0;
LabelName.HorizontalContentAlignment = HorizontalAlignment.Center;
parentPanel.Children.Add(LabelName);
ComboProcessors = new ComboBox();
DockPanel.SetDock(ComboProcessors, Dock.Top);
ComboProcessors.Height = 25.0;
ComboProcessors.Margin = new Thickness(30.0, 5.0, 30.0, 5.0);
ComboProcessors.HorizontalContentAlignment = HorizontalAlignment.Center;
parentPanel.Children.Add(ComboProcessors);
ComboProcessors.SelectionChanged += ComboProcessors_SelectionChanged;
ParametersPanel = new ParametersSelectionPanel();
ParametersPanel.MinHeight = 20.0;
DockPanel.SetDock(ParametersPanel, Dock.Top);
parentPanel.Children.Add(ParametersPanel);
}
示例12: ExerciseView
// We want to control how depth data gets converted into false-color data
// for more intuitive visualization, so we keep 32-bit color frame buffer versions of
// these, to be updated whenever we receive and process a 16-bit frame.
/*const int RED_IDX = 2;
const int GREEN_IDX = 1;
const int BLUE_IDX = 0;
byte[] depthFrame32 = new byte[320 * 240 * 4];*/
public ExerciseView(Exercise ex)
{
InitializeComponent();
this.ex = ex;
statusText.Text = ex.statusMessage;
passSound = new SoundPlayer("Sounds/ExercisePass.wav");
passSound.LoadAsync();
failSound = new SoundPlayer("Sounds/ExerciseFail.wav");
failSound.LoadAsync();
#if DEBUG
lastTime = DateTime.Now;
fpsLabel = new Label();
fpsLabel.Content = "FPS:";
fpsLabel.FontSize = (double)Application.Current.Resources["SmallButtonFont"];
fpsLabel.HorizontalContentAlignment = HorizontalAlignment.Center;
fpsLabel.HorizontalAlignment = HorizontalAlignment.Left;
bottomPanel.Children.Insert(0, fpsLabel);
#endif
#if AUDIOUI
SharedContent.Sr.registerSpeechCommand(SharedContent.Commands.Stop, selectedResponse);
#endif
//SharedContent.Nui.DepthFrameReady += new EventHandler<ImageFrameReadyEventArgs>(nuiDepthFrameReady);
SharedContent.Nui.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(nuiSkeletonFrameReady);
SharedContent.Nui.VideoFrameReady += new EventHandler<ImageFrameReadyEventArgs>(nuiColorFrameReady);
}
示例13: ListColoredLabels
public ListColoredLabels()
{
Title = "List Colored Labels";
ListBox lstbox = new ListBox();
lstbox.Height = 150;
lstbox.Width = 150;
lstbox.SelectionChanged += ListBoxOnSelectionChanged;
Content = lstbox;
//label ��Ʈ�ѷ� ����Ʈ�ڽ��� ä���....
PropertyInfo[] props = typeof(Colors).GetProperties();
foreach (PropertyInfo prop in props)
{
Color clr = (Color)prop.GetValue(null, null);
bool isBlack = .222 * clr.R + .707 * clr.G + .071 * clr.B > 128;
//--------------------------------------------------------------
Label lbl = new Label(); //---->label ����....
lbl.Content = prop.Name;
lbl.Background = new SolidColorBrush(clr);
lbl.Foreground = isBlack ? Brushes.Black : Brushes.White;
lbl.Width = 100;
lbl.Margin = new Thickness(15, 0, 0, 0);
lbl.Tag = clr;
//-------------------------------------------------------------
lstbox.Items.Add(lbl); //-->ListBox�� Label�� �߰�
}
}
示例14: fillGrid
private void fillGrid()
{
if (content == null) return;
StackPanel sp = new StackPanel();
sp.Orientation = Orientation.Vertical;
maingrid.Children.Clear();
foreach (object o in content)
{
StackPanel param = new StackPanel();
param.Orientation = Orientation.Horizontal;
// TODO: get the param name
Label name = new Label();
name.Content = o.GetType().Name;
param.Children.Add(name);
// TODO: change to modifiable controller (slider or buzz equiv)
TextBox value = new TextBox();
value.Text = o.ToString();
param.Children.Add(value);
//ParameterSlider ps = new ParameterSlider();
//ps.
sp.Children.Add(param);
}
maingrid.Children.Add(sp);
}
示例15: Resultado
public Resultado(Conexao con, String dono, String nomeSala)
{
this.conexao = con;
this.dono = dono;
sala = nomeSala;
InitializeComponent();
conexao.Send("exibircolocacao/" + sala);
String message = conexao.Receive();
String[] tokens = message.Split('{');
for (int i = 0; i < tokens.Length; i++)
{
String[] tokens1 = tokens[i].Split('|');
jogadores.Add(tokens1[0]);
ranking.Add(tokens1[1]);
}
int altura = 12;
for (int i = 0; i < jogadores.Count; i++)
{
int posicao = i + 1;
Label ponto = new Label();
ponto.Content = posicao.ToString() + "º lugar: " + jogadores[i] + " com " + ranking[i] + " pontos.";
ponto.FontSize = 17;
ponto.Height = 33;
ponto.HorizontalAlignment = HorizontalAlignment.Left;
ponto.VerticalAlignment = VerticalAlignment.Top;
ponto.Margin = new Thickness(12, altura, 0, 0);
gridinha.Children.Add(ponto);
altura += 26;
}
}