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


C# Panel.SetValue方法代碼示例

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


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

示例1: CreateForHanyu

 private FrameworkElement CreateForHanyu( Word word, bool showEnglish = false )
 {
     var chars = WordDatabase.Characters( word );
     _mainPanel = CreateStackPanel(
         CreateTextBlock( "SimSun", 30,
             chars.Select( c => new Run {
                 Text = c.Hanyu,
                 Foreground = new SolidColorBrush( ToneColor( c.Pinyin ) )
             } ).ToArray( ) ),
         CreateTextBlock( "Times New Roman", 20,
             chars.Select( c => new Run {
                 Text = " " + c.PinyinDiacritics + " ",
                 Foreground = new SolidColorBrush( ToneColor( c.Pinyin ) )
             } ).ToArray( ) ),
             CreateEnglishPanel( showEnglish ? word.ShortEnglish : "" ) );
     _mainPanel.SetValue( ToolTipService.ShowDurationProperty, 60000 );
     return _mainPanel;
 }
開發者ID:rbrother,項目名稱:ChineseWriter,代碼行數:18,代碼來源:WordPanel.cs

示例2: SetIsFieldGroup

 public static void SetIsFieldGroup(Panel target, bool isFieldGroup)
 {
     target.SetValue(IsFieldGroupProperty, isFieldGroup);
 }
開發者ID:modulexcite,項目名稱:SilverlightToolkit,代碼行數:4,代碼來源:DataField.cs

示例3: InitializeHost

        /// <summary>
        /// Initialize the panel hosting control presenters to duplicate (creating a virtual carousel)
        /// </summary>
        /// <param name="panel">Carousel panel</param>
        /// <param name="presenter">Main control presenter</param>
        /// <param name="left">Control to add to the left</param>
        /// <param name="right">Control to add to the right</param>
        /// <param name="pad">Number of empty padding pixels to add to 'left' and 'right'</param>
        private void InitializeHost(Panel panel, FrameworkElement presenter, FrameworkElement left, FrameworkElement right, double pad)
        {
            // reset/initialize layout with dummy values
            if (panel.Children.Count == 1)
            {
                panel.Children.Insert(0, new Rectangle());
                panel.Children.Add(new Rectangle());
            }
            panel.SetValue(Canvas.LeftProperty, 0.0);

            // insert items ?
            if (Items.Count > 0)
            {
                WriteableBitmap bitmap;
                Image image;
                int width;
                int height;

                // duplicate left
                width = (int)(left.ActualWidth + pad);
                height = (int)left.ActualHeight;
                bitmap = new WriteableBitmap(width, height);
                bitmap.Render(left, null);
                bitmap.Invalidate();
                image = new Image();
                image.Source = bitmap;
                panel.Children[0] = image;
                double offset = bitmap.PixelWidth;

                // duplicate right
                width = (int)(right.ActualWidth + pad);
                height = (int)right.ActualHeight;
                bitmap = new WriteableBitmap(width, height);
                bitmap.Render(right, new TranslateTransform() { X = pad });
                bitmap.Invalidate();
                image = new Image();
                image.Source = bitmap;
                panel.Children[2] = image;

                // adjust panel position
                panel.SetValue(Canvas.LeftProperty, -offset);
            }
        }
開發者ID:JamesHay,項目名稱:FlightsNorway,代碼行數:51,代碼來源:PanoramaView.cs


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