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


C# System.Windows.Controls.Image.Arrange方法代码示例

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


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

示例1: PrintPage

 private static UIElement PrintPage(BitmapSource bitmap)
 {
     var bitmapSize = new System.Windows.Size(bitmap.PixelWidth, bitmap.PixelHeight);
     var image = new System.Windows.Controls.Image { Source = bitmap };
     image.Measure(bitmapSize);
     image.Arrange(new System.Windows.Rect(new System.Windows.Point(0, 0), bitmapSize));
     return image;
 }
开发者ID:nukolai,项目名称:xaml-sdk,代码行数:8,代码来源:PrintingService_SL.cs

示例2: GenerateWindowIcon

        /// <summary>
        ///     Loads the BowIcon from resources and colors it according to the current theme
        /// </summary>
        /// <returns></returns>
        public static RenderTargetBitmap GenerateWindowIcon()
        {
            var iconImage = new System.Windows.Controls.Image
            {
                Source = (DrawingImage) Application.Current.MainWindow.Resources["BowIcon"],
                Stretch = Stretch.Uniform,
                Margin = new Thickness(20)
            };

            iconImage.Arrange(new Rect(0, 0, 100, 100));
            var bitmap = new RenderTargetBitmap(100, 100, 96, 96, PixelFormats.Pbgra32);
            bitmap.Render(iconImage);
            return bitmap;
        }
开发者ID:SpoinkyNL,项目名称:Artemis,代码行数:18,代码来源:ImageUtilities.cs

示例3: MenuItem_Click_1

        private void MenuItem_Click_1(object sender, RoutedEventArgs e)
        {

            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            saveFileDialog1.Filter = "JPeg Image|*.jpg|Bitmap Image|*.bmp|Gif Image|*.gif";
            saveFileDialog1.Title = "Save an Image File";
            saveFileDialog1.ShowDialog();




            if (saveFileDialog1.FileName != "")
            {
                FileStream stream = new FileStream(saveFileDialog1.FileName, FileMode.Create);


                TiffBitmapEncoder encoder = new TiffBitmapEncoder();

                //   var bitmap = BitmapFrame.Create(  );
                //  TextBlock myTextBlock = new TextBlock();
                //   myTextBlock.Text = "Codec Author is: " + encoder.CodecInfo.Author.ToString();
                //    bitmap = image.Source;

                //var bitmap = BitmapFrame();
                //2. Create an Image control which will accept the DrawingImage as its Source
                System.Windows.Controls.Image myImage = new System.Windows.Controls.Image();
                myImage.Source = image.Source;
                myImage.Arrange(new Rect(0, 0, 500, 500));  //Required

                //3. Render the Image control's content to a RenderTargetBitmap
                RenderTargetBitmap rtb = new RenderTargetBitmap(500, 500, 96, 96, System.Windows.Media.PixelFormats.Default);
                rtb.Render(myImage);

                //4. Now the RenderTargetBitmap can be used with the JpegBitmapEncoder
                encoder.Frames.Add(BitmapFrame.Create(rtb));
                //    MessageBox.Show(myPalette.Colors.Count.ToString());
                encoder.Save(stream);


                stream.Close();
            }
        }
开发者ID:vjblind,项目名称:image-facile-c-,代码行数:42,代码来源:MainWindow.xaml.cs


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