public VideoStreamDisplay(System.Windows.Controls.Image img, int rotationAngle, Uri streamUri) { _dispImage = img; _rotationAngle = rotationAngle; _streamUri = streamUri; _decoder.FrameReady += handleFrameFn; }
// 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; } }
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; } }
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; }
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; }
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); }
public ProcessInfo(string processName, int processId, string processPath, Image processIcon) { ProcessName = processName; ProcessPath = processPath; ProcessId = processId; ProcessIcon = processIcon; }
public ProcessInfo() { ProcessName = "processName"; ProcessPath = "processPath"; ProcessId = 0; ProcessIcon = new Image(); }
public WebCamWindow(string applicationName) { InitializeComponent(); _webCam = new WebCamCapture { FrameNumber = ((0ul)), TimeToCapture_milliseconds = FrameNumber }; _webCam.ImageCaptured += webCam_ImageCaptured; _frameImage = SourceImage; _applicationName = applicationName; }
/// <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); }
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; }
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()); }
internal void PrintImage() { PrintImage pi = new PrintImage(); System.Windows.Controls.Image pImage = new System.Windows.Controls.Image(); pImage.Source = ImageCtrl.Source; pi.Print(pImage); }
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; }
protected override void UpdateWhiskerPositions(System.Windows.Controls.Image image, SizeChangedEventArgs e) { foreach (WhiskerAngleFrameViewModel whisker in Frames) { whisker.UpdatePositions(LastKnownImageWidth, LastKnownImageHeight); } CreateCenterLine(); }
public Metodos(Reader objReader, System.Windows.Controls.Image pbFingerprint) { variables = new Variables(); variables.patchCapturaHuella = "c:\\Huellas\\"; device = new SelectorHuella.Metodos(); variables.currentReader = objReader; variables.pbFingerprint = pbFingerprint; device.InitializeDevice(ref objReader); }
private void LeftMouseDownOnWheel(Image image) { if (image is IInputElement element) { _isLeftMouseOnWheelPressed = true; Mouse.Capture(element); SelectColorOnWheel(element); } }
private void ChangeBitMap(Image image) { if (image is IInputElement element) { MouseElement = element; _clickAction.Action(this); } }
private static void DisplayPicture(System.Windows.Controls.Image photo, string path, Action callback) { Application.Current.Dispatcher.BeginInvoke( DispatcherPriority.Background, new Action(() => { photo.Visibility = Visibility.Visible; photo.Source = new BitmapImage(new Uri(path)); callback?.Invoke(); })); }
public SkeletonDraw(KinectSensor sensor, System.Windows.Controls.Image Image) { this.sensor = sensor; this.Image = Image; drawingGroup = new DrawingGroup(); imageSource = new DrawingImage(drawingGroup); Image.Source = imageSource; }
public void SizeChanged(object sender, SizeChangedEventArgs e) { System.Windows.Controls.Image image = (System.Windows.Controls.Image)sender; LastKnownImageWidth = image.ActualWidth; LastKnownImageHeight = image.ActualHeight; UpdateWhiskerPositions(image.ActualWidth, image.ActualHeight); }
/// <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; }
public GameOver(Image canvas, Bitmap prevState, Game game, IGameScreen screen) { _canvas = canvas; _prevState = prevState; _game = game; _screen = screen; _buffer = new Bitmap(180, 360); Redraw(); }
public RenderObject(GameObject GameObject, System.Windows.UIElement element, RenderObjectType objectType, Dimension Size, System.Windows.Controls.Canvas Canvas, Renderer controller) { //Create new UI Element if (element is null) { switch (objectType) { case RenderObjectType.rectangle: element = new System.Windows.Shapes.Rectangle() { Width = Size.Width, Height = Size.Height, Fill = new System.Windows.Media.SolidColorBrush(GameObject.color), Stroke = new System.Windows.Media.SolidColorBrush(GameObject.color), RenderTransform = new System.Windows.Media.TransformGroup(), RenderTransformOrigin = new System.Windows.Point(0.5, 0.5) }; System.Windows.Media.TransformGroup transformGroup = (System.Windows.Media.TransformGroup)element.RenderTransform; rotateTransform = new System.Windows.Media.RotateTransform(90); //Rotation is different system than used transformGroup.Children.Add(rotateTransform); translateTransform = new System.Windows.Media.TranslateTransform(GameObject.position.x * Renderer.FieldSize, GameObject.position.y * Renderer.FieldSize); transformGroup.Children.Add(translateTransform); element.RenderTransform = transformGroup; break; case RenderObjectType.image: element = new System.Windows.Controls.Image() { Width = Size.Width * Renderer.FieldSize, //TODO: Fix the difference in size between the two types Height = Size.Height * Renderer.FieldSize, Source = Renderer.BitmapToImageSource(new System.Drawing.Bitmap(((ImageEntity)GameObject).CurrentImage())), RenderTransform = new System.Windows.Media.TransformGroup(), RenderTransformOrigin = new System.Windows.Point(0.5, 0.5) }; transformGroup = (System.Windows.Media.TransformGroup)element.RenderTransform; rotateTransform = new System.Windows.Media.RotateTransform(90); //Rotation is different system than used transformGroup.Children.Add(rotateTransform); translateTransform = new System.Windows.Media.TranslateTransform(GameObject.position.x * Renderer.FieldSize, GameObject.position.y * Renderer.FieldSize); transformGroup.Children.Add(translateTransform); element.RenderTransform = transformGroup; break; default: break; } } gameObject = GameObject; uIElement = element; type = objectType; size = Size; renderer = controller; canvas = Canvas; Canvas.Children.Add(uIElement); }
public GameBoyPrinterEmulatorWindow(IControllerReader reader) { if (Properties.Settings.Default.UpgradeRequired) { Properties.Settings.Default.Upgrade(); Properties.Settings.Default.UpgradeRequired = false; Properties.Settings.Default.Save(); } InitializeComponent(); DataContext = this; _reader = reader ?? throw new ArgumentNullException(nameof(reader)); SelectedPalette = Properties.Settings.Default.SelectedPalette; PrintSize = Properties.Settings.Default.PrintSize; using (Bitmap bmp = new Bitmap(Properties.Resources.PrintImage)) { _imageBuffer = new BitmapPixelMaker(480, 432); _imageBuffer.SetColor(palettes[SelectedPalette][0][3], palettes[SelectedPalette][1][3], palettes[SelectedPalette][2][3]); for (int i = 0; i < bmp.Width; ++i) { for (int j = 0; j < bmp.Height; ++j) { System.Drawing.Color pixel = bmp.GetPixel(i, j); if (pixel.R == 255 && pixel.G == 255 && pixel.B == 255) { _imageBuffer.SetRed(i, j, palettes[SelectedPalette][0][0]); _imageBuffer.SetGreen(i, j, palettes[SelectedPalette][1][0]); _imageBuffer.SetBlue(i, j, palettes[SelectedPalette][2][0]); } } } WriteableBitmap wbitmap = _imageBuffer.MakeBitmap(96, 96); // Create an Image to display the bitmap. _image = new System.Windows.Controls.Image { Stretch = Stretch.None, Margin = new Thickness(0) }; _ = GameBoyPrinterEmulatorWindowGrid.Children.Add(_image); _image.Source = wbitmap; _reader.ControllerStateChanged += Reader_ControllerStateChanged; _reader.ControllerDisconnected += Reader_ControllerDisconnected; CheckPalette(SelectedPalette); CheckSize(PrintSize); } }
private void SetIcon(MessageWindowIcon icon) { IconBox.Visibility = Visibility.Visible; IconBox.Width = 32; IconBox.Height = 32; var img = new Image(); switch (icon) { case MessageWindowIcon.Error: img.Source = ConvertBitmap(SystemIcons.Error.ToBitmap()); SystemSounds.Hand.Play(); IconBox.Content = img; break; case MessageWindowIcon.Exclamation: img.Source = ConvertBitmap(SystemIcons.Exclamation.ToBitmap()); SystemSounds.Exclamation.Play(); IconBox.Content = img; break; case MessageWindowIcon.Info: img.Source = ConvertBitmap(SystemIcons.Information.ToBitmap()); IconBox.Content = img; SystemSounds.Asterisk.Play(); break; case MessageWindowIcon.Question: img.Source = ConvertBitmap(SystemIcons.Question.ToBitmap()); IconBox.Content = img; SystemSounds.Question.Play(); break; case MessageWindowIcon.Warning: img.Source = ConvertBitmap(SystemIcons.Warning.ToBitmap()); IconBox.Content = img; SystemSounds.Exclamation.Play(); break; case MessageWindowIcon.PDFCreator: IconBox.Width = 45; IconBox.Height = 45; IconBox.Content = FindResource("PDFCreatorLogo"); break; case MessageWindowIcon.PDFForge: IconBox.Width = 45; IconBox.Height = 45; IconBox.Content = FindResource("RedFlame"); break; case MessageWindowIcon.None: IconBox.Visibility = Visibility.Collapsed; break; } }
//public static List<Hyperlink> GetHyperLinksContainingSelection(this TextSelection pos) //{ // var results = new List<Hyperlink>(); // foreach (var inline in pos.Start.Paragraph.Inlines) // { // if (inline is Hyperlink link) // { // try // { // if (link.Inlines.Contains((Inline)pos.Start.Parent)) // results.Add(link); // } // catch (InvalidCastException ex) // { // MessageBox.Show(ex.ToString()); // } // } // } // return results; //} public static void InsertAdornedImage(this FlowDocument document, System.Windows.Controls.Image image) { image.LostFocus += OnLostFocus; image.MouseDown += OnMouseDown; image.Stretch = System.Windows.Media.Stretch.None; var imageContainer = new BlockUIContainer(image); document.Blocks.Add(imageContainer); }
public ImageProcessingNetwork(System.Windows.Controls.Image picture, System.Windows.Controls.Button button1, System.Windows.Controls.Button button2, ITargetBlock <string> targetBlock) { image = picture; toolStripButton1 = button1; toolStripButton2 = button2; headBlock = targetBlock; }
private System.Windows.Point EndPosition; // 本次移动结束时的坐标点位置 /// <summary> /// 按下鼠标左键,准备开始拖动图片 /// </summary> /// <param name="p"></param> private void MouseLeftButtonDownCommand(object[] p) { object sender = p[0]; MouseButtonEventArgs e = p[1] as MouseButtonEventArgs; System.Windows.Controls.Image img = sender as System.Windows.Controls.Image; movingObject = img; StartPosition = e.GetPosition(img); }
public static System.Windows.Controls.Image CaptureScreenAsImage() { var bmp = CaptureScreen(); var img = new System.Windows.Controls.Image(); img.Source = bmp; return(img); }
public static void AgregarEventoCambiarImagen(System.Windows.Controls.Image controlImage) { controlImage.MouseDown += controlImage_MouseDown; controlImage.DataContext = false; controlImage.ToolTip = "Click izquierdo para cambiar | Click derecho para borrar"; if (controlImage.Source == null) { AsignarFondoBlancoImage(controlImage); } }
private void OnMoreInfoImageTouched(object sender, TouchEventArgs e) { System.Windows.Controls.Image img = e.OriginalSource as System.Windows.Controls.Image; if (img == null) { return; } StartupManagerTask.ShowDetail(img); e.Handled = true; }
private Smiley CreateSmiley(string name, string directory) { System.Windows.Controls.Image image = new System.Windows.Controls.Image(); image.Source = GetImage(new string[] { "Smileys", directory, name }); return(new Smiley { Name = name.Split('.')[0], Pic = image }); }
static Action <VideoFrame> UpdateImage(System.Windows.Controls.Image img) { var wbmp = img.Source as WriteableBitmap; return(new Action <VideoFrame>(frame => { var rect = new Int32Rect(0, 0, frame.Width, frame.Height); wbmp.WritePixels(rect, frame.Data, frame.Stride * frame.Height, frame.Stride); })); }
public override FrameworkElement Draw(int pageNr) { var bitmap = new BitmapImage(new Uri(Reference, UriKind.Relative)); var control = new System.Windows.Controls.Image() { Source = bitmap, Height = bitmap.Height }; return(control); }
/// <summary> Initializes a new instance of the <see cref="UntiledCanvas"/> class. If the parameter /// <paramref name="addToMap"/> is set to true, the new canvas instance is added to the parent map. </summary> /// <param name="mapView"> The parent map instance. </param> /// <param name="untiledProvider"> The instance of the provider delivering bitmaps of a map. </param> /// <param name="addToMap"> Indicates that the map should be inserted to the parent map initially. </param> public UntiledCanvas(MapView mapView, IUntiledProvider untiledProvider, bool addToMap) : base(mapView, addToMap) { this.untiledProvider = untiledProvider; mapImage = new Image { IsHitTestVisible = false }; Children.Add(mapImage); }
public override UIElement Draw() { System.Windows.Controls.Image myImage = new System.Windows.Controls.Image(); myImage.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(Path, UriKind.RelativeOrAbsolute)); myImage.Width = this.Width; myImage.Height = this.Heigth; System.Windows.Controls.Canvas.SetLeft(myImage, this.Left); System.Windows.Controls.Canvas.SetTop(myImage, this.Top); return((UIElement)myImage); }
/// <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; }
public Window1() { InitializeComponent(); BitmapImg = ImageToBitmapImage(System.Drawing.Image.FromFile(@"C:\some.img")); Img = new System.Windows.Controls.Image() { Source = BitmapImg }; DataContext = this; }
private void OnMoreInfoImageMouseDown(object sender, MouseButtonEventArgs e) { System.Windows.Controls.Image img = e.OriginalSource as System.Windows.Controls.Image; if (img == null) { return; } OpenWithTask.ShowDetail(img); e.Handled = true; }
/// <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); }
private static void Sample2() { var application = new Application(); var window = new Window() { Height = 600, Width = 800, }; var stackPanel = new System.Windows.Controls.StackPanel(); window.Content = stackPanel; SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext(application.Dispatcher)); var urls = new[] { "http://weblogs.asp.net/blogs/nmarun/image_thumb_283DC50D.png", "http://weblogs.asp.net/blogs/nmarun/image_thumb_09FFF1D5.png", "http://weblogs.asp.net/blogs/nmarun/image_thumb_420B7DCA.png", "http://weblogs.asp.net/blogs/nmarun/image_thumb_5615AE0E.png", }; var imageDownloader = new TransformBlock <string, System.Drawing.Image>(url => DownloadImage(url)); var bitmapSourceCreater = new TransformBlock <System.Drawing.Image, BitmapSource>(image => { var bitmap = new System.Drawing.Bitmap(image); var bmpPtr = bitmap.GetHbitmap(); var bitmapSource = Imaging.CreateBitmapSourceFromHBitmap(bmpPtr, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); //freeze bitmapSource and clear memory to avoid memory leaks bitmapSource.Freeze(); DeleteObject(bmpPtr); return(bitmapSource); }); var blockOptions = new ExecutionDataflowBlockOptions { TaskScheduler = TaskScheduler.FromCurrentSynchronizationContext(), }; var uiOperator = new ActionBlock <BitmapSource>(bitmapSource => { var image = new System.Windows.Controls.Image() { Source = bitmapSource, Height = 100, }; stackPanel.Children.Add(image); }, blockOptions); imageDownloader.LinkTo(bitmapSourceCreater); bitmapSourceCreater.LinkTo(uiOperator); foreach (string url in urls) { imageDownloader.Post(url); } application.Run(window); }
private void ResetImageStrethch(System.Windows.Controls.Image img, Bitmap bImg) { if (bImg.Width <= img.Width) { img.Stretch = Stretch.None; } else { img.Stretch = Stretch.Fill; } }
//render image using bytes private void RenderImageBytes(System.Windows.Controls.Image control, byte[] bytes) { MemoryStream byteStream = new MemoryStream(bytes); BitmapImage imageSource = new BitmapImage(); imageSource.BeginInit(); imageSource.StreamSource = byteStream; imageSource.EndInit(); control.Source = imageSource; }
/// <summary> /// Show the Default Splash Screen /// </summary> private void ShowDefaultSplashScreen() { Uri path = new Uri("pack://application:,,,/Resources/splash.jpg"); this.splashScreen = new System.Windows.Controls.Image() { Name = "Splash", Source = new BitmapImage(path) }; this.Scene.Children.Add(this.splashScreen); }
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); }
/** * The constructor */ public Image() { mImage = new System.Windows.Controls.Image(); mStretch = new System.Windows.Media.Stretch(); mImage.HorizontalAlignment = HorizontalAlignment.Left; mImage.VerticalAlignment = VerticalAlignment.Top; mStretch = System.Windows.Media.Stretch.None; mImage.Stretch = mStretch; View = mImage; }
public MainWindow() { boton_elegir = new System.Windows.Controls.Image(); boton_video = new System.Windows.Controls.Image(); cargar_imagenes(1); Tangulo.Interval = 1000; Tvideo.Interval = 1000; Tdisfraz.Interval = 1000; Tangulo.Elapsed += new System.Timers.ElapsedEventHandler(Tangulo_Elapsed); Tvideo.Elapsed += new System.Timers.ElapsedEventHandler(Tvideo_Elapsed); Tdisfraz.Elapsed += new System.Timers.ElapsedEventHandler(Tdisfraz_Elapsed); InitializeComponent(); this.Unloaded += new RoutedEventHandler(MainWindow_Unloaded); }
/// <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; }
private void AddImage(ImageBrowser browser, BitmapImage bitmapImage, string file) { var imageControl = new System.Windows.Controls.Image { Opacity = 0.5, Margin = new System.Windows.Thickness(10, 10, 10, 10), Source = bitmapImage, Tag = file }; imageControl.MouseDown += ImageControlMouseDown; imageControl.MouseEnter += ImageControlMouseEnter; imageControl.MouseLeave += ImageControlMouseLeave; browser.Add(imageControl); }
public Spel(System.Windows.Controls.Image tekenBlad) { _tekenBlad = tekenBlad; _monster_timer = new DispatcherTimer { Interval = new TimeSpan(0, 0, 0, 0, 100) }; _monster_timer.Tick += MonsterTimerElapsed; _projectiel_timer = new DispatcherTimer { Interval = new TimeSpan(0, 0, 0, 0, 5) }; _projectiel_timer.Tick += ProjectielTimerElapsed; _huidigeLevel = 1; HuidigeLevel = LevelFactory.CreateLevel(_huidigeLevel, this); StartLevel(); }
public static ImageSource GetImageByID(int ID) { Photo photo = null; foreach (var p in Entities.Photo) if (p.ID == ID) photo = p; BitmapImage PhotoBitmap = new BitmapImage(); PhotoBitmap = LoadImage(photo.PhotoByte); System.Windows.Controls.Image PhotoImage = new System.Windows.Controls.Image(); PhotoImage.Source = PhotoBitmap; PhotoImage.Stretch = Stretch.Uniform; PhotoImage.Margin = new Thickness(5); ImageSource source = PhotoBitmap; return source; }
public ImageDatabase(string folder) { EntityStats = new Image {Source = new BitmapImage(new Uri(folder + "stats.png"))}; EntityStatsClickThrou = new Image {Source = new BitmapImage(new Uri(folder + "stats_click_throu.png"))}; Chrono = new Image {Source = new BitmapImage(new Uri(folder + "chrono.png"))}; Chronobar = new Image {Source = new BitmapImage(new Uri(folder + "chronobar.png"))}; Close = new Image {Source = new BitmapImage(new Uri(folder + "close.png"))}; History = new Image {Source = new BitmapImage(new Uri(folder + "historic.png"))}; Copy = new Image {Source = new BitmapImage(new Uri(folder + "copy.png"))}; Config = new Image {Source = new BitmapImage(new Uri(folder + "config.png"))}; Chat = new Image {Source = new BitmapImage(new Uri(folder + "chat.png"))}; Link = new Image {Source = new BitmapImage(new Uri(folder + "link.png"))}; Icon = new BitmapImage(new Uri(folder + "shinra.ico")); Tray = new Icon(folder + "shinra.ico"); }
/** * The constructor */ public Image() { mImage = new System.Windows.Controls.Image(); mStretch = new System.Windows.Media.Stretch(); mParentCanvas = new Grid(); mImage.HorizontalAlignment = HorizontalAlignment.Left; mImage.VerticalAlignment = VerticalAlignment.Top; mStretch = System.Windows.Media.Stretch.None; mImage.Stretch = mStretch; mParentCanvas.Children.Add(mImage); View = mParentCanvas; }
public System.Windows.Controls.Image ByteToWPFImage(byte[] blob) { MemoryStream stream = new MemoryStream(); stream.Write(blob, 0, blob.Length); stream.Position = 0; System.Drawing.Image img = System.Drawing.Image.FromStream(stream); System.Windows.Media.Imaging.BitmapImage bi = new System.Windows.Media.Imaging.BitmapImage(); bi.BeginInit(); MemoryStream ms = new MemoryStream(); img.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp); ms.Seek(0, SeekOrigin.Begin); bi.StreamSource = ms; bi.EndInit(); System.Windows.Controls.Image image2 = new System.Windows.Controls.Image() { Source = bi }; return image2; }
public NativeWPListViewCell(String cellId) { image = new Image(); headingLabel = new Label() { FontAttributes = FontAttributes.Italic, TextColor = Color.Lime, BackgroundColor = Color.Default }; subheadingLabel = new Label() { FontAttributes = FontAttributes.Bold, TextColor = Color.Lime, BackgroundColor = Color.Default }; }
/// <summary> /// Redraws the whole barcode /// </summary> public override void RedrawAll() { Children.Clear(); if (Value != null) { var DrawObject = BarcodeDrawFactory.GetSymbology((BarcodeSymbology)(int)BarcodeSymbology); var img = DrawObject.Draw(Value.ToString(), 30); var bmpImage = ImageToBitmapImage(new Bitmap(img)); var BarcodeImage = new Image(); BarcodeImage.Stretch = Stretch.UniformToFill; BarcodeImage.Source = bmpImage; BarcodeImage.Width = this.Width; BarcodeImage.Height = this.Height; Children.Add(BarcodeImage); } }
public static System.Windows.Controls.Image ConvertDrawingImageToWPFImage(System.Drawing.Image gdiImg) { System.Windows.Controls.Image img = new System.Windows.Controls.Image(); //convert System.Drawing.Image to WPF image using (System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(gdiImg)) { IntPtr hBitmap = bmp.GetHbitmap(); System.Windows.Media.ImageSource WpfBitmap = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); img.Source = WpfBitmap; img.Width = 500; img.Height = 600; img.Stretch = System.Windows.Media.Stretch.None; ScreenCapture.GDI32.DeleteObject(hBitmap); } return img; }
public void InitializeWebCam(Image videoOutput, Image diffOutput, Image rects) { this.webcam = new WebCamCapture { FrameNumber = 0, TimeToCapture_milliseconds = FrameNumber }; this.webcam.ImageCaptured += this.webcam_ImageCaptured; this.videoOutput = videoOutput; this.diffOutput = diffOutput; this.rects = rects; }
public GdiMedia() { //Commands OpenFileCommand = new RelayCommand(o => { }, o => false); OpenDiscCommand = new RelayCommand(o => { }, o => false); OpenStreamCommand = new RelayCommand(o => { }, o => false); OpenDeviceCommand = new RelayCommand(o => { }, o => false); OpenProcessCommand = new RelayCommand(OpenProcess); _media = new Image(); _timer = new DispatcherTimer(DispatcherPriority.Send); _timer.Interval = new TimeSpan(0, 0, 0, 0, 125); _timer.Tick += TimerOnTick; }