当前位置: 首页>>代码示例>>C#>>正文


C# Label.SetResourceReference方法代码示例

本文整理汇总了C#中System.Windows.Controls.Label.SetResourceReference方法的典型用法代码示例。如果您正苦于以下问题:C# Label.SetResourceReference方法的具体用法?C# Label.SetResourceReference怎么用?C# Label.SetResourceReference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Controls.Label的用法示例。


在下文中一共展示了Label.SetResourceReference方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TextControl

        public TextControl(string name, string value = "pending...")
        {
            var foreground = new SolidColorBrush((Color)FindResource(VsColors.CaptionTextKey));

            _lblName = new Label();
            _lblName.Padding = new Thickness(3, 3, 0, 3);
            _lblName.FontWeight = FontWeights.Bold;
            _lblName.Content = name + ": ";
            _lblName.SetResourceReference(TextBlock.ForegroundProperty, EnvironmentColors.ComboBoxFocusedTextBrushKey);
            Children.Add(_lblName);

            _lblValue = new Label();
            _lblValue.Padding = new Thickness(0, 3, 10, 3); ;
            _lblValue.Content = value;
            _lblValue.SetResourceReference(TextBlock.ForegroundProperty, EnvironmentColors.ComboBoxFocusedTextBrushKey);
            Children.Add(_lblValue);
        }
开发者ID:japj,项目名称:ExtensibilityTools,代码行数:17,代码来源:TextControl.cs

示例2: lbContentBing

        private void lbContentBing(Label lb,string sourceKey)
        {
            object obj_Item = TryFindResource(sourceKey);

            if (obj_Item != null)
            {
                lb.SetResourceReference(Label.ContentProperty, sourceKey);
            }
            else
            {
                lb.Content = sourceKey + "_undefined";
            }
        }
开发者ID:hehaiyang7133862,项目名称:VICO_Current,代码行数:13,代码来源:UserManageUnit.xaml.cs

示例3: addItem

        public void addItem(string str_key)
        {
            string str_Item = string.Empty;

            object obj_Item = TryFindResource(str_key);

            Label lb = new Label();
            lb.Height = 35;
            if (obj_Item != null)
            {
                lb.SetResourceReference(Label.ContentProperty, str_key);
            }
            else
            {
                lb.Content = str_key + "_undefined";
            }
            lb.FontSize = 14;
            lb.Foreground = Brushes.Black;
            lb.VerticalContentAlignment = VerticalAlignment.Center;
            lb.Margin = new Thickness(10, 0, 0, 0);

            Border bd = new Border();
            bd.BorderBrush = new SolidColorBrush(Color.FromArgb(0xff, 0x90, 0x90, 0x90));
            bd.Background = Brushes.White;
            bd.BorderThickness = new Thickness(1, 0, 1, 1);
            bd.Height = 35;
            bd.Width = bdMain.Width;
            bd.Child = lb;
            bd.Tag = _itemsCount;
            bd.MouseUp += new MouseButtonEventHandler(bd_MouseUp);

            sPanelItems.Children.Add(bd);

            _itemsCount++;
        }
开发者ID:hehaiyang7133862,项目名称:VICO_Current,代码行数:35,代码来源:myComboBox.xaml.cs

示例4: VisualMessage

        public VisualMessage( string StreamerNick, SmilesDataDase Db, ChatMessage Data )
        {
            this.Data = Data;

            List<Uri> Urls = new List<Uri>();

            string UserText = Data.Text;// HttpUtility.HtmlDecode(Data.Text.Replace(":s:", " :s:").Replace("  ", " "));

            UserText = UriDetector.Replace(
                UserText,
                new MatchEvaluator(( m ) => {
                    Urls.Add(new Uri(m.Value, UriKind.RelativeOrAbsolute));
                    return LinkReplacer + " ";
                })
            );

            // parse text
            WrapPanel wp = new WrapPanel() {
                Orientation = System.Windows.Controls.Orientation.Horizontal,
            };
            List<string> ttt = new List<string>();

            // Тоже странный кусок:
            int nxd = UserText.IndexOf("<b>");
            if (nxd >= 0) {
                int nxd2 = UserText.IndexOf("</b>");
                TalkTo = UserText.Substring(nxd + 3, nxd2 - nxd - 3);
                if (UserText.Length <= (nxd2 + 6)) {
                    UserText = "";
                } else {
                    UserText = UserText.Substring(nxd2 + 6);
                }

                if (TalkTo == StreamerNick) {
                    wp.SetResourceReference(WrapPanel.StyleProperty, "StreamerContainer");
                } else {
                    wp.SetResourceReference(WrapPanel.StyleProperty, "NormalTextContainer");
                }

                ttt.Add(TalkTo + ",");
            } else {
                TalkTo = "";
            }

            ttt.AddRange(UserText.Split(' '));

               // if (UseLabel) {

                Label name = new Label() { Content = Data.Name + ": " };
                name.SetResourceReference(Label.StyleProperty, "LabelNameStyle");
                wp.Children.Add(name);
                int linkIndex = 0;

                for (int j = 0; j < ttt.Count; ++j) {
                    if (ttt[j] == LinkReplacer) {
                        Label link = new Label() {
                            Content = "link ",
                            Cursor = Cursors.Hand,
                            ToolTip = Urls[linkIndex],
                            Tag = Urls[linkIndex]
                        };
                        link.SetResourceReference(Label.StyleProperty, "LabelLinkStyle");
                        link.MouseLeftButtonUp += ( sender, b ) => {
                            Uri u = ((Label)sender).Tag as Uri;
                            System.Diagnostics.Process.Start(u.ToString());
                        };
                        wp.Children.Add(link);
                        linkIndex++;
                    } else {
                        //if (j != (ttt.Count - 1))
                        ttt[j] += ' ';

                        if (CreateSmile(Db, ttt[j], wp)) {
                            // Ура смайл ебать есть
                        } else {
                            Label txt = new Label() { Content = ttt[j] };
                            if (TalkTo + ", " == ttt[j]) {
                                txt.SetResourceReference(Label.StyleProperty, "LabelNameTextStyle");
                            } else {
                                txt.SetResourceReference(Label.StyleProperty, "LabelTextStyle");
                            }
                            wp.Children.Add(txt);
                        }
                    }
                }

            //} else {

            //    TextBlock name = new TextBlock() { Text = Data.Name + ": " };
            //    name.SetResourceReference(TextBlock.StyleProperty, "NameStyle");
            //    wp.Children.Add(name);
            //    int linkIndex = 0;

            //    for (int j = 0; j < ttt.Count; ++j) {
            //        if (ttt[j] == LinkReplacer) {
            //            TextBlock link = new TextBlock() {
            //                Text = "link ",
            //                Cursor = Cursors.Hand,
            //                ToolTip = Urls[linkIndex],
            //                Tag = Urls[linkIndex]
//.........这里部分代码省略.........
开发者ID:recston,项目名称:Sc2tvChatPub,代码行数:101,代码来源:VisualMessage.cs

示例5: SetIco_NoUpdate

 private void SetIco_NoUpdate()
 {
     Grid grid = new Grid();
     grid.Width = 100;
     grid.Height = 100;
     Label lb = new Label();
     lb.SetResourceReference(Label.ContentProperty, "ico-noUpdate");
     grid.Children.Add(lb);
     bd_1.Child = grid;
 }
开发者ID:qq576053126,项目名称:Dont_Starve_Backup_Tools_WPF,代码行数:10,代码来源:UpdateWindow.xaml.cs

示例6: AddWord

 private void AddWord( WrapPanel wp, List<string> ttt, int j )
 {
     Label txt = new Label() { Content = ttt[j] };
     if (TalkTo + ", " == ttt[j]) {
         txt.SetResourceReference(Label.StyleProperty, "LabelNameTextStyle");
     } else {
         txt.SetResourceReference(Label.StyleProperty, "LabelTextStyle");
     }
     wp.Children.Add(txt);
 }
开发者ID:JustOxlamon,项目名称:Sc2tvChatPub,代码行数:10,代码来源:VisualMessage.cs

示例7: BuildHeaderArea

        private FrameworkElement BuildHeaderArea()
        {
            Grid header = new Grid();
            header.ColumnDefinitions.Add(new ColumnDefinition());
            header.ColumnDefinitions.Add(new ColumnDefinition {Width = GridLength.Auto});
            header.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });

            //Move grip containing the icon and title
            Grid moveGrip = new Grid();
            moveGrip.ColumnDefinitions.Add(new ColumnDefinition
            {
                Width = GridLength.Auto
            });
            moveGrip.ColumnDefinitions.Add(new ColumnDefinition());
            moveGrip.SetResourceReference(Border.BackgroundProperty, EnvironmentColors.ToolWindowBackgroundBrushKey);
            moveGrip.SetValue(Grid.ColumnProperty, 0);
            moveGrip.MouseLeftButtonDown += TitleBarLeftMouseButtonDown;

            Image icon = new Image
            {
                VerticalAlignment = VerticalAlignment.Center,
                Margin = new Thickness(10, 5, 4, 0)
            };
            icon.SetBinding(Image.SourceProperty, new Binding
            {
                Source = this,
                Path = new PropertyPath("Icon"),
                Mode = BindingMode.OneWay
            });
            moveGrip.Children.Add(icon);

            Label label = new Label
            {
                VerticalAlignment = VerticalAlignment.Center,
                Margin = new Thickness(0, 2, 0, 0)
            };
            label.SetValue(Grid.ColumnProperty, 1);
            label.SetBinding(ContentControl.ContentProperty, new Binding
            {
                Source = this,
                Path = new PropertyPath("Title"),
                Mode = BindingMode.OneWay
            });
            label.SetResourceReference(ForegroundProperty, EnvironmentColors.MainWindowActiveCaptionTextBrushKey);
            moveGrip.Children.Add(label);
            header.Children.Add(moveGrip);

            //Close button
            FrameworkElement closeGlyph;
            Path buttonPath;
            GenerateCloseGlyph(out closeGlyph, out buttonPath);

            Style closeButtonStyle = new Style(typeof(Button));
            closeButtonStyle.Setters.Add(new Setter(HeightProperty, (double)25));
            closeButtonStyle.Setters.Add(new Setter(WidthProperty, (double)25));
            closeButtonStyle.Setters.Add(new Setter(FocusVisualStyleProperty, null));
            closeButtonStyle.Setters.Add(new Setter(ForegroundProperty, new DynamicResourceExtension(EnvironmentColors.MainWindowButtonActiveGlyphBrushKey)));
            closeButtonStyle.Setters.Add(new Setter(BackgroundProperty, null));
            closeButtonStyle.Setters.Add(new Setter(BorderBrushProperty, new DynamicResourceExtension(EnvironmentColors.MainWindowButtonActiveBorderBrushKey)));
            closeButtonStyle.Setters.Add(new Setter(TemplateProperty, FindResource("FlatButton")));

            Trigger closeButtonHoverTrigger = new Trigger
            {
                Property = IsMouseOverProperty,
                Value = true
            };

            closeButtonHoverTrigger.Setters.Add(new Setter(ForegroundProperty, new DynamicResourceExtension(EnvironmentColors.MainWindowButtonHoverActiveGlyphBrushKey)));
            closeButtonHoverTrigger.Setters.Add(new Setter(BackgroundProperty, new DynamicResourceExtension(EnvironmentColors.MainWindowButtonHoverActiveBrushKey)));
            closeButtonHoverTrigger.Setters.Add(new Setter(BorderBrushProperty, new DynamicResourceExtension(EnvironmentColors.MainWindowButtonHoverActiveBorderBrushKey)));
            closeButtonStyle.Triggers.Add(closeButtonHoverTrigger);

            Trigger closeButtonPressTrigger = new Trigger
            {
                Property = ButtonBase.IsPressedProperty,
                Value = true
            };

            closeButtonPressTrigger.Setters.Add(new Setter(ForegroundProperty, new DynamicResourceExtension(EnvironmentColors.MainWindowButtonDownGlyphBrushKey)));
            closeButtonPressTrigger.Setters.Add(new Setter(BackgroundProperty, new DynamicResourceExtension(EnvironmentColors.MainWindowButtonDownBrushKey)));
            closeButtonPressTrigger.Setters.Add(new Setter(BorderBrushProperty, new DynamicResourceExtension(EnvironmentColors.MainWindowButtonDownBorderBrushKey)));
            closeButtonStyle.Triggers.Add(closeButtonPressTrigger);

            Button closeButton = new Button
            {
                Style = closeButtonStyle,
                Name = "closeButton",
                Content = closeGlyph,
                HorizontalContentAlignment = HorizontalAlignment.Center,
                VerticalContentAlignment = VerticalAlignment.Center
            };

            closeButton.SetValue(Grid.ColumnProperty, 2);
            header.Children.Add(closeButton);
            buttonPath.SetBinding(Shape.FillProperty, new Binding
            {
                Path = new PropertyPath("Foreground"),
                Source = closeButton,
                Mode = BindingMode.OneWay
            });
//.........这里部分代码省略.........
开发者ID:madskristensen,项目名称:Packman,代码行数:101,代码来源:ThemedWindow.cs

示例8: addItem

        private void addItem(string str_key)
        {
            TabItem item = new TabItem();
            item.Margin = new Thickness(0);
            item.Padding = new Thickness(0);
            item.Height = 0;

            string str_Item = string.Empty;

            object obj_Item = TryFindResource(str_key);

            Label lb_Item = new Label();
            lb_Item.FontSize = 14;
            if (obj_Item != null)
            {
                lb_Item.SetResourceReference(Label.ContentProperty, str_key);
            }
            else
            {
                lb_Item.Content = str_key + "_undefined";
            }
            lb_Item.Height = 35;
            lb_Item.VerticalContentAlignment = VerticalAlignment.Center;
            lb_Item.Margin = new Thickness(10, 0, 0, 0);

            item.Content = lb_Item;

            tbSelected.Items.Add(item);
        }
开发者ID:hehaiyang7133862,项目名称:VICO_Current,代码行数:29,代码来源:myTabControl.xaml.cs


注:本文中的System.Windows.Controls.Label.SetResourceReference方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。