• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Controls.TextBlock类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



TextBlock类属于System.Windows.Controls命名空间,在下文中一共展示了TextBlock类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: PageHeader

        public PageHeader()
        {
            Brush brush = new SolidColorBrush(Colors.DarkGray);
            brush.Opacity = 0.60;

            this.Background = brush;

            Border frameBorder = new Border();
            frameBorder.BorderBrush = Brushes.Gray;
            frameBorder.BorderThickness = new Thickness(2);

            DockPanel panelMain = new DockPanel();
            panelMain.Margin = new Thickness(5, 5, 5, 5);
            panelMain.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;

            txtText = new TextBlock();
            txtText.FontSize = 32;
            txtText.Margin = new Thickness(5, 0, 0, 0);
            txtText.SetResourceReference(TextBlock.ForegroundProperty, "HeaderTextColor");
            txtText.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;

            panelMain.Children.Add(txtText);

            frameBorder.Child = panelMain;

            this.Content = frameBorder;
        }
开发者ID:rhgtvcx,项目名称:tap-desktop,代码行数:27,代码来源:PageHeader.cs


示例2: Game

        public Game(UserControl userControl, Canvas drawingCanvas, Canvas debugCanvas, TextBlock txtDebug)
        {
            //Initialize
            IsActive = true;
            IsFixedTimeStep = true;
            TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 16);
            Components = new List<DrawableGameComponent>();
            World = new World(new Vector2(0, 0));
            _gameTime = new GameTime();
            _gameTime.GameStartTime = DateTime.Now;
            _gameTime.FrameStartTime = DateTime.Now;
            _gameTime.ElapsedGameTime = TimeSpan.Zero;
            _gameTime.TotalGameTime = TimeSpan.Zero;

            //Setup Canvas
            DrawingCanvas = drawingCanvas;
            DebugCanvas = debugCanvas;
            TxtDebug = txtDebug;
            UserControl = userControl;

            //Setup GameLoop
            _gameLoop = new Storyboard();
            _gameLoop.Completed += GameLoop;
            _gameLoop.Duration = TargetElapsedTime;
            DrawingCanvas.Resources.Add("gameloop", _gameLoop);
        }
开发者ID:hilts-vaughan,项目名称:Farseer-Physics,代码行数:26,代码来源:Game.cs


示例3: ExamineKeystrokes

        public ExamineKeystrokes()
        {
            Title = "Examine Keystrokes";
            FontFamily = new FontFamily("Courier New");

            Grid grid = new Grid();
            Content = grid;

            // Make one row "auto" and the other fill the remaining space.
            RowDefinition rowdef = new RowDefinition();
            rowdef.Height = GridLength.Auto;
            grid.RowDefinitions.Add(rowdef);
            grid.RowDefinitions.Add(new RowDefinition());

            // Display header text.
            TextBlock textHeader = new TextBlock();
            textHeader.FontWeight = FontWeights.Bold;
            textHeader.Text = strHeader;
            grid.Children.Add(textHeader);

            // Create StackPanel as child of ScrollViewer for displaying events.
            scroll = new ScrollViewer();
            grid.Children.Add(scroll);
            Grid.SetRow(scroll, 1);

            stack = new StackPanel();
            scroll.Content = stack;
        }
开发者ID:gawallsibya,项目名称:BIT_MFC-CShap-DotNet,代码行数:28,代码来源:ExamineKeystrokes.cs


示例4: Comment

        public Comment(Node hostNode)
        {
            HostNode = hostNode;

            var scrollViewer = new ScrollViewer
            {
                HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled,
                VerticalScrollBarVisibility = ScrollBarVisibility.Visible,
                Height = 70,
                CanContentScroll = true
            };

            var textBlock = new TextBlock
            {
                Background = Brushes.Transparent,
                TextWrapping = TextWrapping.Wrap,
                Margin = new Thickness(5),
                FontSize = 12
            };

            Child = scrollViewer;
            CornerRadius = new CornerRadius(5);
            scrollViewer.Content = textBlock;


            var bindingTextToTextBlock = new Binding("Text")
            {
                Source = this,
                Mode = BindingMode.OneWay
            };
            textBlock.SetBinding(TextBlock.TextProperty, bindingTextToTextBlock);

            hostNode.SpaceCanvas.Children.Add(this);
        }
开发者ID:bsudhakarGit,项目名称:TUM.CMS.VPLControl,代码行数:34,代码来源:Comment.cs


示例5: Create

        public static Uri Create(string filename, string text, SolidColorBrush backgroundColor, double textSize, Size size)
        {
            var background = new Rectangle();
            background.Width = size.Width;
            background.Height = size.Height;
            background.Fill = backgroundColor;

            var textBlock = new TextBlock();
            textBlock.Width = 500;
            textBlock.Height = 500;
            textBlock.TextWrapping = TextWrapping.Wrap;
            textBlock.Text = text;
            textBlock.FontSize = textSize;
            textBlock.Foreground = new SolidColorBrush(Colors.White);
            textBlock.FontFamily = new FontFamily("Segoe WP");

            var tileImage = "/Shared/ShellContent/" + filename;
            using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication())
            {
                var bitmap = new WriteableBitmap((int)size.Width, (int)size.Height);
                bitmap.Render(background, new TranslateTransform());
                bitmap.Render(textBlock, new TranslateTransform() { X = 39, Y = 88 });
                var stream = store.CreateFile(tileImage);
                bitmap.Invalidate();
                bitmap.SaveJpeg(stream, (int)size.Width, (int)size.Height, 0, 99);
                stream.Close();
            }
            return new Uri("ms-appdata:///local" + tileImage, UriKind.Absolute);
        }
开发者ID:halllo,项目名称:DailyQuote,代码行数:29,代码来源:LockScreenImage.cs


示例6: MainTab

 public MainTab(int page, TabItem newTab, Image newVerso, Image newRecto, Grid canvas, Grid vGrid, Grid rGrid, Button delBtn, ScatterView SV, ScatterViewItem si, Grid vSwipeGrid, Grid rSwipeGrid, Grid vTranslationGrid, Grid rTranslationGrid, Grid vBoxesGrid, Grid rBoxesGrid, TextBlock headerText, SurfaceWindow1.language language)
 {
     _page = page;
     _tab = newTab;
     _verso = newVerso;
     _recto = newRecto;
     _canvas = canvas;
     _vGrid = vGrid;
     _rGrid = rGrid;
     _SVI = si;
     _delButton = delBtn;
     numFingersRecto = 0;
     numFingersVerso = 0;
     fingerPos = new List<Point>();
     avgTouchPoint = new Point(-1, 0);
     _vSwipeGrid = vSwipeGrid;
     _rSwipeGrid = rSwipeGrid;
     _vTranslationGrid = vTranslationGrid;
     _rTranslationGrid = rTranslationGrid;
     _vBoxesGrid = vBoxesGrid;
     _rBoxesGrid = rBoxesGrid;
     _twoPage = true;
     _SV = SV;
     _headerTB = headerText;
     _currentLanguage = language;
     _previousLanguage = _currentLanguage;
     _worker = new Workers(this);
 }
开发者ID:straboulsi,项目名称:fauvel,代码行数:28,代码来源:Tab.cs


示例7: UserControl_DataContextChanged

        private void UserControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            var selectedItem = (DataContext as IEntityGridViewModel).SelectedItem;

            if (selectedItem == null)
                return;

                Type type = selectedItem.GetType();
            var relationshipProperties = type.GetProperties()
             .Where(t =>
                     t.Name != "Relationships" &&
                     t.GetGetMethod().IsVirtual &&
                     t.PropertyType.IsGenericType &&
                     t.PropertyType.GetGenericTypeDefinition() == typeof(ICollection<>))
             .ToList();

            foreach (var property in relationshipProperties)
            {
                //Binding binding = new Binding() { Path = new PropertyPath("SelectedItem." + property.Name), Source = this.DataContext };

                TextBlock textBlock = new TextBlock() { Text = property.Name };
                //BindingOperations.SetBinding(textBlock, TextBlock.TextProperty, binding);

                relatedEntitiesStackPanel.Children.Add(textBlock);

                Binding binding = new Binding() { Path = new PropertyPath("SelectedItem." + property.Name), Source = this.DataContext };

                DataGridControl listView = new DataGridControl();
                var value = property.GetValue(selectedItem) as System.Collections.IEnumerable;
                //listView.ItemsSource = value;
                BindingOperations.SetBinding(listView, DataGrid.ItemsSourceProperty, binding);

                relatedEntitiesStackPanel.Children.Add(listView);
            }
        }
开发者ID:jweimann,项目名称:webdb,代码行数:35,代码来源:RelatedEntitiesView.xaml.cs


示例8: AttachControl

        public override bool AttachControl(FilterPropertiesControl control)
        {
            Control = control;

            Grid grid = new Grid();
            int rowIndex = 0;

            TextBlock brightnessText = new TextBlock();
            brightnessText.Text = "Threshold";
            Grid.SetRow(brightnessText, rowIndex++);

            Slider brightnessSlider = new Slider();
            brightnessSlider.Minimum = 0.0;
            brightnessSlider.Maximum = 1.0;
            brightnessSlider.Value = _colorSwapFilter.Threshold;
            brightnessSlider.ValueChanged += brightnessSlider_ValueChanged;
            Grid.SetRow(brightnessSlider, rowIndex++);


            for (int i = 0; i < rowIndex; ++i)
            {
                RowDefinition rd = new RowDefinition();
                grid.RowDefinitions.Add(rd);
            }

            grid.Children.Add(brightnessText);
            grid.Children.Add(brightnessSlider);

            control.ControlsContainer.Children.Add(grid);

            return true;
        }
开发者ID:sachin4203,项目名称:ClassicPhotoEditor,代码行数:32,代码来源:MynewFilter3.cs


示例9: GenerateTextBlock

 private TextBlock GenerateTextBlock()
 {
     TextBlock textBlock = new TextBlock();
     textBlock.TextWrapping = TextWrapping.Wrap;
     textBlock.Margin = new Thickness(10);
     return textBlock;
 }
开发者ID:g360230,项目名称:quran-phone,代码行数:7,代码来源:TextBlockSplitter.cs


示例10: SetEvidence

        internal void SetEvidence(
            IDictionary<string, Tuple<FObservation, FRandomVariable[]>> evidences,
            IDictionary<string, string> abbreviations)
        {
            var evidencesSorted
                = evidences.OrderBy(kvp => kvp.Key);

            xEvidenceList.Children.Clear();

            foreach (var kvp in evidencesSorted)
            {
                // Scenario label.
                TextBlock scenarioLabel = new TextBlock();
                scenarioLabel.Text = kvp.Key;
                xEvidenceList.Children.Add(scenarioLabel);

                // Observation values.
                Observation.Observation obsControl = new Observation.Observation();
                var observation = kvp.Value.Item1;
                var observationVariables = kvp.Value.Item2;
                obsControl.SetData(observation, observationVariables, abbreviations);
                xEvidenceList.Children.Add(obsControl);
                obsControl.Margin = new Thickness(0, 0, 0, 12);
            }
        }
开发者ID:duckmaestro,项目名称:F-AI,代码行数:25,代码来源:EvidenceInspector.xaml.cs


示例11: MakeGivenGrid

        protected override Grid MakeGivenGrid()
        {
            //Set up grid
            Grid grid = new Grid();
            grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
            grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
            grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });

            //Create the description text
            TextBlock desc = new TextBlock();
            desc.TextWrapping = TextWrapping.Wrap;
            desc.Text = "Specify a midpoint.";
            desc.Margin = new Thickness(0, 0, 0, 10);

            //Create a combo box to choose from
            optionsBox = new ComboBox();
            optionsBox.MinWidth = 200;

            //Align elements in grid and add them to it
            Grid.SetColumn(desc, 0);
            Grid.SetRow(desc, 0);
            grid.Children.Add(desc);
            Grid.SetColumn(optionsBox, 0);
            Grid.SetRow(optionsBox, 1);
            grid.Children.Add(optionsBox);

            return grid;
        }
开发者ID:wcatykid,项目名称:GeoShader,代码行数:28,代码来源:AddMidpoint.cs


示例12: ExtTreeNode

        public ExtTreeNode(Image icon, string title)
            : this()
        {
            if (icon != null)
            {
                this.icon = icon;
            }
            else//test inti icon
            {
                this.icon = new Image();
                BitmapImage bitmapImage = new BitmapImage();
                bitmapImage.BeginInit();
                bitmapImage.UriSource = new Uri(@"pack://application:,,,/ATNET;component/icons/add.png", UriKind.RelativeOrAbsolute);
                //bitmapImage.UriSource = new Uri(@"../../icons/add.png", UriKind.RelativeOrAbsolute);
                bitmapImage.EndInit();
                this.icon.Source = bitmapImage;
            }

            this.icon.Width = 16;
            this.icon.Height = 16;

            this.title = title;

            TextBlock tb = new TextBlock();
            tb.Text = title;
            Grid grid = new Grid();
            grid.ColumnDefinitions.Add(new ColumnDefinition());
            grid.ColumnDefinitions.Add(new ColumnDefinition());
            grid.Children.Add(this.icon);
            grid.Children.Add(tb);
            Grid.SetColumn(this.icon, 0);
            Grid.SetColumn(tb, 1);
            this.Header = grid;
        }
开发者ID:ichengzi,项目名称:atnets,代码行数:34,代码来源:ExtTreeNode.cs


示例13: OnApplyTemplate

    public override void OnApplyTemplate()
    {
        if (MapDetailsControl != null)
        {
            MapDetailsControl.MapDetailsChanged -= RaiseMapDetailsChanged;
            MapDetailsControl.MapSelectedForOpening -= RaiseMapSelectedForOpening;
        }

        if (ResultsListBox != null)
            ResultsListBox.SelectionChanged -= ResultListBox_SelectionChanged;

        base.OnApplyTemplate();

        MapDetailsControl = GetTemplateChild("MapDetailsControl") as MapDetailsControl;
        ResultsListBox = GetTemplateChild("ResultsListBox") as ListBox;
        SearchResultsTextBlock = GetTemplateChild("SearchResultsTextBlock") as TextBlock;
        DataPager = GetTemplateChild("DataPager") as DataPager;

        if (MapDetailsControl != null)
        {
            MapDetailsControl.MapDetailsChanged += RaiseMapDetailsChanged;
            MapDetailsControl.MapSelectedForOpening += RaiseMapSelectedForOpening;
        }

        if (ResultsListBox != null)
        {
            ResultsListBox.SelectionChanged += ResultListBox_SelectionChanged;
            ResultsListBox.DataContext = this;
        }
        if (_isDirty)
            GenerateResults();
    }
开发者ID:Esri,项目名称:arcgis-viewer-silverlight,代码行数:32,代码来源:MyMapsControl.xaml.cs


示例14: setChoices

        public void setChoices(List<string> choices)
        {
            TextBlock txtBlock;
            
            if (choices == null || choices.Count == 0)
            {
                return;
            }

            choicesList = choices;
            listBox.Items.Clear();

            foreach (string str in choices)
            {
                txtBlock = new TextBlock();

                txtBlock.TextWrapping = TextWrapping.Wrap;
                txtBlock.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
                txtBlock.Width = 370;
                txtBlock.Text = str;
                txtBlock.Margin = new Thickness(0, 2, 0, 2);

                listBox.Items.Add(txtBlock);
            }

            //listBox.ItemsSource = choices;
        }
开发者ID:rokuan,项目名称:iris,代码行数:27,代码来源:MenuBox.xaml.cs


示例15: Button_Loaded

 private void Button_Loaded(object sender, RoutedEventArgs args)
 {
     System.Windows.Controls.Button button = sender as System.Windows.Controls.Button;
     if (button != null)
     {
         StackPanel panel = new StackPanel()
         {
             Orientation = Orientation.Horizontal
         };
         Image shield = new Image()
         {
             Width = 24,
             Source = Shield
         };
         panel.Children.Add(shield);
         Rectangle rect = new Rectangle()
         {
             Width = 10
         };
         panel.Children.Add(rect);
         TextBlock text = new TextBlock()
         {
             Text = (button.Command as RoutedUICommand).Text
         };
         panel.Children.Add(text);
         button.Content = panel;
     }
 }
开发者ID:Qibbi,项目名称:OpenSAGE,代码行数:28,代码来源:ButtonElevated.xaml.cs


示例16: CreateListPanel

        public UIElement CreateListPanel(TwitterList list)
        {
            var s = new StackPanel();
            var si = new StackPanel();
            s.Orientation = Orientation.Horizontal;
            Image img = new Image { Width = 36, Height = 36 };
            BitmapImage bi = new BitmapImage(new Uri(list.User.ProfileImageUrlHttps));
            img.Source = bi;
            s.Children.Add(img);

            var ti = new TextBlock { FontSize = 20 };
            ti.Text = (list.Mode == "private" ? "*" : "") + list.Name;
            ti.TextWrapping = TextWrapping.Wrap;
            var de = new TextBlock { Foreground = Brushes.Gray };
            de.Text = list.Description;
            de.TextWrapping = TextWrapping.Wrap;
            var cn = new TextBlock();
            cn.Text = list.MemberCount.ToString() + "人が追加されています";
            si.Children.Add(ti);
            si.Children.Add(cn);
            si.Children.Add(de);
            s.Children.Add(si);
            s.Tag = list;
            return s;
        }
开发者ID:kb10uy,项目名称:Kbtter,代码行数:25,代码来源:ExListWindow.xaml.cs


示例17: SetService

 public void SetService(List<EpgServiceInfo> serviceList)
 {
     stackPanel_service.Children.Clear();
     foreach (EpgServiceInfo info in serviceList)
     {
         TextBlock item = new TextBlock();
         item.Text = info.service_name;
         if (info.remote_control_key_id != 0)
         {
             item.Text += "\r\n" + info.remote_control_key_id.ToString();
         }
         else
         {
             item.Text += "\r\n" + info.network_name + " " + info.SID.ToString();
         }
         item.Width = Settings.Instance.ServiceWidth - 2;
         item.Margin = new Thickness(1, 1, 1, 1);
         item.Background = CommonManager.Instance.CustServiceColor;
         item.Foreground = Brushes.White;
         item.TextAlignment = TextAlignment.Center;
         item.FontSize = 12;
         item.MouseLeftButtonDown += new MouseButtonEventHandler(item_MouseLeftButtonDown);
         item.DataContext = info;
         stackPanel_service.Children.Add(item);
     }
 }
开发者ID:xceza7,项目名称:EDCB,代码行数:26,代码来源:ServiceView.xaml.cs


示例18: InitializeComponent

 public void InitializeComponent()
 {
     if (!this._contentLoaded)
     {
         this._contentLoaded = true;
         Application.LoadComponent(this, new Uri("/TWC.OVP;component/Controls/ErrorMessageBox.xaml", UriKind.Relative));
         this.LayoutRoot = (Grid) base.FindName("LayoutRoot");
         this.DetailsEnabledStates = (VisualStateGroup) base.FindName("DetailsEnabledStates");
         this.ErrorMessageDetailDisabled = (VisualState) base.FindName("ErrorMessageDetailDisabled");
         this.ErrorMessageDetailEnabled = (VisualState) base.FindName("ErrorMessageDetailEnabled");
         this.DetailsStates = (VisualStateGroup) base.FindName("DetailsStates");
         this.DetailsVisible = (VisualState) base.FindName("DetailsVisible");
         this.DetailsNotVisible = (VisualState) base.FindName("DetailsNotVisible");
         this.BackgroundRectangle = (Rectangle) base.FindName("BackgroundRectangle");
         this.InnerDialogGrid = (Grid) base.FindName("InnerDialogGrid");
         this.DialogRectangle = (Rectangle) base.FindName("DialogRectangle");
         this.CloseButton = (Button) base.FindName("CloseButton");
         this.ErrorMessageTitleTextBlock = (TextBlock) base.FindName("ErrorMessageTitleTextBlock");
         this.ErrorMessageTextBlock = (TextBlock) base.FindName("ErrorMessageTextBlock");
         this.ButtonOK = (Button) base.FindName("ButtonOK");
         this.Icon = (TextBlock) base.FindName("Icon");
         this.SimpleErrorDetails = (Grid) base.FindName("SimpleErrorDetails");
         this.ShowDetailsToggle = (TextToggleButton) base.FindName("ShowDetailsToggle");
         this.DetailsTextBox = (TextBox) base.FindName("DetailsTextBox");
     }
 }
开发者ID:BigBri41,项目名称:TWCTVWindowsPhone,代码行数:26,代码来源:ErrorMessageBox.cs


示例19: God

 public God(string name, int hours, GodPos pos, TextBlock output)
 {
     this.name = name;
     this.hours = hours;
     this.pos = pos;
     this.output = output;
 }
开发者ID:reed665,项目名称:BoatQuest,代码行数:7,代码来源:God.cs


示例20: SimpleUIBoundToCustomer

        public SimpleUIBoundToCustomer()
        {
            var stack = new StackPanel();
            Content = stack;

            var textBlock = new TextBlock();
            textBlock.SetBinding(TextBlock.TextProperty, new Binding("FirstName"));
            stack.Children.Add(textBlock);

            textBlock = new TextBlock();
            textBlock.SetBinding(TextBlock.TextProperty, new Binding("LstName")); //purposefully misspelled
            stack.Children.Add(textBlock);

            textBlock = new TextBlock();
            textBlock.SetBinding(TextBlock.TextProperty, new Binding()); //context
            stack.Children.Add(textBlock);

            var checkbox = new CheckBox();
            checkbox.SetBinding(CheckBox.IsCheckedProperty, new Binding("asdfsdf")); //does not exist
            stack.Children.Add(checkbox);

            var tooltip = new ToolTip();
            tooltip.SetBinding(System.Windows.Controls.ToolTip.ContentProperty, new Binding("asdfasdasdf")); // does not exist
            stack.ToolTip = tooltip;

            var childUserControl = new SimpleUIBoundToCustomerByAttachedPorperty();
            stack.Children.Add(childUserControl);
        }
开发者ID:ssethi,项目名称:TestFrameworks,代码行数:28,代码来源:SimpleUIBoundToCustomer.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Controls.TextBox类代码示例发布时间:2022-05-26
下一篇:
C# Controls.TabItem类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap