本文整理汇总了C#中System.Windows.Controls.Label类的典型用法代码示例。如果您正苦于以下问题:C# Label类的具体用法?C# Label怎么用?C# Label使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Label类属于System.Windows.Controls命名空间,在下文中一共展示了Label类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:clusson,项目名称:Tetris-WPF,代码行数:28,代码来源:Plateau.cs
示例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);
}
开发者ID:Nutritia,项目名称:nutritia,代码行数:39,代码来源:FenetreIngredients.xaml.cs
示例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);
}
}
开发者ID:MattGong,项目名称:RESTful,代码行数:33,代码来源:BasicAuth.cs
示例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;
}
开发者ID:saturnineNL,项目名称:huiswerk-les-13,代码行数:26,代码来源:Star.cs
示例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);
}
开发者ID:MikeOrtman,项目名称:MultitouchExplorer,代码行数:25,代码来源:ContentCardImage.cs
示例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;
}
开发者ID:saturnineNL,项目名称:GMV,代码行数:29,代码来源:Star.cs
示例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
}};
}
开发者ID:ianeller-romey,项目名称:CompJS_TTTD,代码行数:35,代码来源:UserControl_AudioType.cs
示例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();
}
开发者ID:nm777taka,项目名称:practiceTetris,代码行数:26,代码来源:MainWindow.xaml.cs
示例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);
}
开发者ID:greymind,项目名称:ClipSynth,代码行数:35,代码来源:CheckBoxContent.cs
示例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);
}
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:32,代码来源:NewComponentWindow.xaml.cs
示例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);
}
开发者ID:KFlaga,项目名称:Cam3D,代码行数:27,代码来源:ParametrizedProcessorsSelectionPanel.xaml.cs
示例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);
}
开发者ID:drrobson,项目名称:Group42_FYDP,代码行数:39,代码来源:ExerciseView.xaml.cs
示例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�� �߰�
}
}
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:31,代码来源:ListColoredLabels.cs
示例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);
}
开发者ID:roceal,项目名称:peerpressure,代码行数:29,代码来源:ParameterViewer.xaml.cs
示例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;
}
}
开发者ID:Bonei,项目名称:general-ifrn,代码行数:35,代码来源:Resultado.xaml.cs
示例16: Fill
private static Grid Fill()
{
Grid grid = new Grid();
for (int i = 0; i < Dane.n1; i++)
{
grid.RowDefinitions.Add(new RowDefinition());
}
for (int i = 0; i < Dane.n2; i++)
{
grid.ColumnDefinitions.Add(new ColumnDefinition());
}
for (int i = 0; i < Dane.n1; i++)
{
for (int j = 0; j < Dane.n2; j++)
{
Label label = new Label();
label.Background = Dane.TloKolor;
Grid.SetRow(label, i);
Grid.SetColumn(label, j);
grid.Children.Add(label);
Dane.tablica[i, j] = label;
}
}
return grid;
}
开发者ID:MaciekAiR,项目名称:Snake,代码行数:32,代码来源:DynamicGrid.cs
示例17: ImageAnimation
public void ImageAnimation(Label Button, bool on)
{
String imageFileName = Button.Name;
if (on) imageFileName += "_on";
imageFileName += ".png";
setBackgroundImage(imageFileName, Button);
}
开发者ID:Tune389,项目名称:LanPartyLauncher,代码行数:7,代码来源:MainWindow.xaml.cs
示例18: AddRunOnForms
private void AddRunOnForms()
{
/* Update the UI Grid to fit everything */
for (int i = 0; i < 2; i++)
{
RowDefinition rowDef = new RowDefinition();
rowDef.Height = System.Windows.GridLength.Auto;
ParametersGrid.RowDefinitions.Add(rowDef);
}
Grid.SetRow(ButtonsPanel, ParametersGrid.RowDefinitions.Count - 1);
Label runOnLabel = new Label();
runOnLabel.Content = "Choose where to run the test job:";
Grid.SetRow(runOnLabel, ParametersGrid.RowDefinitions.Count - 3);
Grid.SetColumn(runOnLabel, 0);
Grid.SetColumnSpan(runOnLabel, 2);
IList<string> runOnOptions = new List<string>();
runOnOptions.Add("Azure");
foreach (HybridRunbookWorkerGroup group in this.hybridGroups)
{
runOnOptions.Add(group.Name);
}
ComboBox runOnComboBox = new ComboBox();
runOnComboBox.ItemsSource = runOnOptions;
runOnComboBox.SelectedIndex = 0;
runOnComboBox.SelectionChanged += changeRunOnSelection;
Grid.SetRow(runOnComboBox, ParametersGrid.RowDefinitions.Count - 2);
Grid.SetColumn(runOnComboBox, 0);
Grid.SetColumnSpan(runOnComboBox, 2);
/* Add to Grid */
ParametersGrid.Children.Add(runOnLabel);
ParametersGrid.Children.Add(runOnComboBox);
}
开发者ID:BruceLangworthy,项目名称:azure-automation-ise-addon,代码行数:35,代码来源:RunbookParamDialog.xaml.cs
示例19: CriarProcesso
//============== Funções ====================================
public void CriarProcesso(double top, double left)
{
Rectangle rectangle;
rectangle = new Rectangle();
Canvas.SetTop(rectangle, top);
Canvas.SetLeft(rectangle, left);
rectangle.Fill = System.Windows.Media.Brushes.White;
rectangle.Height = 20;
rectangle.Width = 40;
rectangle.StrokeThickness = 2;
rectangle.Stroke = System.Windows.Media.Brushes.Gray;
for (int i = 0; i < Processos.Count; i++)
{
if (Processos[i].Left == left && Processos[i].Top == top)
{
Label lbl = new Label();
lbl.Content = "P" + Processos[i].ID;
Canvas.SetLeft(lbl, left + 10);
Canvas.SetTop(lbl, top - 2);
rectangle.Name = ("P" + Processos[i].ID);
Elementos.Add(rectangle);
Elementos.Add(lbl);
Processos[i].Texto = lbl;
break;
}
}
}
开发者ID:marlonluft,项目名称:DeadLockWPF,代码行数:34,代码来源:Funcoes.cs
示例20: TrackMouse
private void TrackMouse(string message)
{
var mouseMove =
Observable.FromEvent<MouseEventArgs, MouseEventHandler>(
(f) => new MouseEventHandler((sender, args) => f(args)),
handler => MouseMove += handler,
handler => MouseMove -= handler);
var chars = message.ToCharArray();
for (int i = 0; i < chars.Length; i++)
{
var c = message[i].ToString();
var label = new Label() { Content = c };
canvas.Children.Add(label);
int closure = i;
mouseMove
.Select(e => e.GetPosition(canvas))
.Delay(closure * 100)
.OnDispatcher()
.Subscribe(pos =>
{
Canvas.SetLeft(label, pos.X + closure * 10);
Canvas.SetTop(label, pos.Y);
});
}
}
开发者ID:JamesTryand,项目名称:fsharpx,代码行数:25,代码来源:MainWindow.xaml.cs
注:本文中的System.Windows.Controls.Label类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论