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


C# Controls.Image类代码示例

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


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

示例1: DeserializeGridTile

        // Deserializes a serialized grid tile, making it fit for use in our editor grid.
        public GridTile DeserializeGridTile(GridTileSerializable tile)
        {
            if (tile.Image == null) return null;

            try
            {
                // Effectively creating an image out of the byte array in the serialized grid tile.
                Image myImage = new Image();
                using (MemoryStream stream = new MemoryStream(tile.Image))
                {
                    PngBitmapDecoder decoder = new PngBitmapDecoder(stream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.OnLoad);
                    BitmapSource bitmapSource = decoder.Frames[0];
                    myImage.Source = bitmapSource;
                }

                return new GridTile(tile.Rotation, tile.Id, myImage, tile.CollisionMap)
                {
                    Row = tile.Row,
                    Column = tile.Column,
                    CollisionMap = tile.CollisionMap
                };
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return null;
            }
        }
开发者ID:Ceteareth,项目名称:ToolsInnlevering01,代码行数:29,代码来源:GridTileHandler.cs

示例2: GetWpfCompatibleImage

		public static Image GetWpfCompatibleImage(System.Drawing.Image image, int newWidth = -1, int maxHeight = -1, string cachedName = null)
		{
			Image result = null;
			string uriPath;
			var filePath = GetImageFilePath(cachedName, out uriPath);

			try
			{
				if (image != null)
				{
					if (!File.Exists(filePath))
					{
						var img = newWidth > 0
							? Shared.Utility.ResizeImage(image, newWidth, maxHeight)
							: image;
						img.Save(filePath, ImageFormat.Png);
					}
					result = new Image { Source = new BitmapImage(new Uri(filePath)) };
				}
			}
			catch (Exception e)
			{
				Logger.TraceErr(MethodBase.GetCurrentMethod(), e);
			}
			return result;
		}
开发者ID:CarverLab,项目名称:onCore.root,代码行数:26,代码来源:ImageHelper.cs

示例3: Chooser_Load

 private void Chooser_Load(object sender, EventArgs e)
 {
     //label2.Text = CardName;
     Guid card = Guid.Empty;
     string[] list = new string[SetList.Count];
     int i = 0;
     foreach (CardModel Card in SetList)
     {
         Set CardSet = Card.Set;
         list[i] = CardSet.Name;
         i++;
     }
     List<string> unique = new List<string>();
     unique.AddRange(list.Distinct());
     comboChooser.Sorted = true;
     foreach (string setname in unique) { comboChooser.Items.Add(setname); }
     comboChooser.Text = comboChooser.Items[0].ToString();
     // Default Image
     GamesRepository proxy = new GamesRepository();
     Game mygame = proxy.Games[GameIndex];
     card = SetList[0].Id;
     label2.Text = SetList[0].Name;
     BitmapImage img = new BitmapImage();
     System.Windows.Controls.Image CardImage = new System.Windows.Controls.Image();
     mtgPicture1.Image = SourceConvert.BitmapFromUri(img != null ? CardModel.GetPictureUri(mygame,
         mygame.GetCardById(card).Set.Id, mygame.GetCardById(card).ImageUri) : mygame.GetCardBackUri());
     selectedCard = card;
 }
开发者ID:drilus,项目名称:Proxy-Printer,代码行数:28,代码来源:Chooser.cs

示例4: ViewCursor

        private static void ViewCursor(Image img, string source)
        {
            var cursor = GetCursor(source);
            if (cursor == null)
            {
                return;
            }

            using (var bmp = new Bitmap(cursor.Size.Width, cursor.Size.Height))
            {
                using (var g = Graphics.FromImage(bmp))
                {
                    var drawingRect = new Rectangle(0, 0, cursor.Size.Width, cursor.Size.Height);
                    g.FillRectangle(Brushes.White, drawingRect);
                    cursor.Draw(g, drawingRect);
                }
                var ms = new MemoryStream();
                bmp.Save(ms, ImageFormat.Bmp);
                ms.Seek(0, SeekOrigin.Begin);
                var bi = new BitmapImage();
                bi.BeginInit();
                bi.StreamSource = ms;
                bi.EndInit();
                img.Source = bi;
            }
        }
开发者ID:CuteITGuy,项目名称:CB.Xaml,代码行数:26,代码来源:CursorServices.cs

示例5: VideoStreamDisplay

 public VideoStreamDisplay(System.Windows.Controls.Image img, int rotationAngle, Uri streamUri)
 {
     _dispImage = img;
     _rotationAngle = rotationAngle;
     _streamUri = streamUri;
     _decoder.FrameReady += handleFrameFn;
 }
开发者ID:robdobsn,项目名称:RdCamViewSysTray,代码行数:7,代码来源:VideoStreamDisplays.cs

示例6: Radar

        private int _refresherY; //HAND coordinate

        #endregion Fields

        #region Constructors

        public Radar(Image imageBox)
        {
            ImageBox = imageBox;

            _bitmapWidth = (int)imageBox.Width;
            _bitmapHeight = (int)imageBox.Height;

            _offset = (_bitmapWidth - Constans.RADAR_WIDTH) / 2;

            //create Bitmap
            Bmp = new Bitmap(_bitmapHeight, _bitmapWidth);

            //center
            _centerX = (int)imageBox.Height / 2;
            _centerY = (int)imageBox.Width / 2;

            //initial degree of HAND
            _currentDegree = 0;

            //timer
            _timer.Interval = 1; //in millisecond
            _timer.Tick += ReloadRadar;

            _landscape = LandscapeProvider.CreateLandscape();

            //Draw start position of radar
            ReloadRadar(null, null);
        }
开发者ID:IhorHolovatsky,项目名称:CourseWork2,代码行数:34,代码来源:RadarProvider.cs

示例7: ProcessInfo

 public ProcessInfo(string processName, int processId, string processPath, Image processIcon)
 {
     ProcessName = processName;
     ProcessPath = processPath;
     ProcessId = processId;
     ProcessIcon = processIcon;
 }
开发者ID:tailored,项目名称:netwatch,代码行数:7,代码来源:ProcessInfo.cs

示例8: AddPicture

 /// <summary>
 /// Adds the picture to the rich textbox.
 /// </summary>
 /// <param name="imagelocation">The imagelocation.</param>
 private void AddPicture(string imagelocation)
 {
     var bitmap = new BitmapImage(new Uri(imagelocation));
     var image = new Image {Source = bitmap, Width = 35};
     var uiContainer = new InlineUIContainer(image);
     var tp = txtMessageToSend.CaretPosition;
     if (tp.Paragraph != null) tp.Paragraph.Inlines.Add(uiContainer);
 }
开发者ID:lebroit,项目名称:LeBroITSolutions,代码行数:12,代码来源:Chat.xaml.cs

示例9: InitializeWebCam

 public void InitializeWebCam(ref System.Windows.Controls.Image ImageControl)
 {
     webcam = new WebCamCapture();
     webcam.FrameNumber = ((ulong)(0ul));
     webcam.TimeToCapture_milliseconds = FrameNumber;
     webcam.ImageCaptured += new WebCamCapture.WebCamEventHandler(webcam_ImageCaptured);
     _FrameImage = ImageControl;
 }
开发者ID:JoshVarty,项目名称:telepath-logger-net,代码行数:8,代码来源:WebCam.cs

示例10: 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

示例11: WebCamWindow

 public WebCamWindow(string applicationName)
 {
     InitializeComponent();
     _webCam = new WebCamCapture { FrameNumber = ((0ul)), TimeToCapture_milliseconds = FrameNumber };
     _webCam.ImageCaptured += webCam_ImageCaptured;
     _frameImage = SourceImage;
     _applicationName = applicationName;
 }
开发者ID:njmube,项目名称:PointOfSales,代码行数:8,代码来源:WebCamWindow.xaml.cs

示例12: convertDrawingImageToWPFImage

        private System.Windows.Media.ImageSource convertDrawingImageToWPFImage(System.Drawing.Image gdiImg)
        {
            System.Windows.Controls.Image img = new System.Windows.Controls.Image();

              System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(gdiImg);
              IntPtr hBitmap = bmp.GetHbitmap();
              return System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
        }
开发者ID:edv222,项目名称:SLOTax,代码行数:8,代码来源:MainWindow.xaml.cs

示例13: PrintImage

        internal void PrintImage()
        {
            PrintImage pi = new PrintImage();
              System.Windows.Controls.Image pImage = new System.Windows.Controls.Image();
              pImage.Source = ImageCtrl.Source;

              pi.Print(pImage);
        }
开发者ID:hxshandle,项目名称:PrintCat,代码行数:8,代码来源:PrintCatImageImplement.cs

示例14: ToWPFImage

        /// <summary>
        /// Convert the icon in a WPF-Image
        /// </summary>
        /// <param name="icon"></param>
        /// <param name="width">Width of new Image</param>
        /// <param name="height">Height of new Image</param>
        /// <returns>WPF-Image-Control</returns>
        public static System.Windows.Controls.Image ToWPFImage(this Icon icon, int width, int height)
        {
            System.Windows.Controls.Image img = new System.Windows.Controls.Image();
            img.Width = width;
            img.Height = height;
            img.Source = icon.ToBitmapSource();

            return img;
        }
开发者ID:CHiiLD,项目名称:net-toolkit,代码行数:16,代码来源:IconExtensions.cs

示例15: GetImageFromWeb

		/// <summary>
		/// Gets the image from web.
		/// </summary>
		/// <param name="url">The URL.</param>
		/// <returns>System.Windows.Controls.Image.</returns>
		private System.Windows.Controls.Image GetImageFromWeb(string url)
		{
			var image = new System.Windows.Controls.Image();

			var uri = new Uri(url, UriKind.Absolute);

			image.Source = new BitmapImage(uri);

			return image;
		}
开发者ID:jdluzen,项目名称:Xamarin-Forms-Labs,代码行数:15,代码来源:WebImageRenderer.cs


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