当前位置: 首页>>代码示例>>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;未经允许,请勿转载。