當前位置: 首頁>>代碼示例>>C#>>正文


C# TextBlock.get_Foreground方法代碼示例

本文整理匯總了C#中System.Windows.Controls.TextBlock.get_Foreground方法的典型用法代碼示例。如果您正苦於以下問題:C# TextBlock.get_Foreground方法的具體用法?C# TextBlock.get_Foreground怎麽用?C# TextBlock.get_Foreground使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Windows.Controls.TextBlock的用法示例。


在下文中一共展示了TextBlock.get_Foreground方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: DrawScales

 private void DrawScales(Rectangle rc, List<MarkerData> s, double lastRightStationPosition, double firstLeftStationXPos)
 {
     DateTime timeStart = this.m_tgd.TimeStart;
     TimeSpan span = TimeSpan.FromMinutes(1.0);
     double num = 16.0;
     double num2 = 18.0;
     double num3 = 5.0;
     while (timeStart <= this.m_tgd.TimeStop)
     {
         double y = this.DateTime2PointY(timeStart, rc);
         if ((timeStart.Minute == 0) || ((timeStart.Minute % 10) == 0))
         {
             this.DrawHorScaleLine(rc, y);
             this.DrawStationTimeScale(y, s, true);
             TextBlock block = new TextBlock();
             block.SetValue(Canvas.TopProperty, y - (num2 / 2.0));
             block.SetValue(Canvas.LeftProperty, ((firstLeftStationXPos - num) - num3) - 1.0);
             block.SetValue(FrameworkElement.WidthProperty, num);
             block.SetValue(FrameworkElement.HeightProperty, num2);
             block.set_TextAlignment(0);
             TextBlock block2 = new TextBlock();
             block2.SetValue(Canvas.TopProperty, y - (num2 / 2.0));
             block2.SetValue(Canvas.LeftProperty, (lastRightStationPosition + num3) + 2.0);
             block2.SetValue(FrameworkElement.WidthProperty, num);
             block2.SetValue(FrameworkElement.HeightProperty, num2);
             block2.set_TextAlignment(0);
             if (timeStart.Minute == 0)
             {
                 block.set_Text(timeStart.Hour.ToString("00"));
                 block.set_FontSize(15.0);
                 block.set_FontFamily(new FontFamily("Arial"));
                 block.set_Foreground(new SolidColorBrush(Colors.get_Black()));
                 block.set_FontStyle(FontStyles.get_Normal());
                 block.set_FontWeight(FontWeights.get_Bold());
             }
             else if ((timeStart.Minute % 10) == 0)
             {
                 block.set_Text(timeStart.Minute.ToString());
                 block.set_FontSize(13.0);
                 block.set_FontFamily(new FontFamily("Arial"));
                 block.set_Foreground(new SolidColorBrush(Colors.get_Gray()));
                 block.set_FontStyle(FontStyles.get_Normal());
                 block.set_FontWeight(FontWeights.get_Normal());
             }
             block2.set_Text(block.get_Text());
             block2.set_FontStyle(block.get_FontStyle());
             block2.set_FontWeight(block.get_FontWeight());
             block2.set_FontSize(block.get_FontSize());
             block2.set_FontFamily(block.get_FontFamily());
             block2.set_Foreground(block.get_Foreground());
             this.CanvasRoot.get_Children().Add(block);
             this.CanvasRoot.get_Children().Add(block2);
         }
         else
         {
             this.DrawStationTimeScale(y, s, false);
         }
         timeStart = timeStart.Add(span);
     }
 }
開發者ID:belsoft,項目名稱:traingraph,代碼行數:60,代碼來源:TrainGraphControl.cs


注:本文中的System.Windows.Controls.TextBlock.get_Foreground方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。