private void ResizeSymbol() { Stream stream = null; Bitmap bitmap = null; if (iconSource != null && iconSource.SelectedIcon != null) { var bitmapImage = iconSource.SelectedIcon.Icon as BitmapImage; if (bitmapImage != null) { stream = bitmapImage.StreamSource; } } else if (!string.IsNullOrEmpty(ImagePath)) { stream = new MemoryStream(File.ReadAllBytes(ImagePath)); //actualPointStyle.Image.SetPathFilename(imagePath); actualPointStyle.SetImageIconPath(imagePath); } else { return; } try { bitmap = new Bitmap(System.Drawing.Image.FromStream(stream), new System.Drawing.Size(imageWidth, imageHeight)); MemoryStream ms = new MemoryStream(); bitmap.Save(ms, ImageFormat.Png); ms.Seek(0, SeekOrigin.Begin); var bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.StreamSource = ms; bitmapImage.EndInit(); PreviewSource = bitmapImage; actualPointStyle.Image = new GeoImage(ms); if (string.IsNullOrEmpty(actualPointStyle.Image.GetPathFilename()) && IconSource.SelectedIcon != null && ms == null) { var selectedSubCategoryName = IconSource.SelectedCategory.HasSubCategories ? IconSource.SelectedSubCategory.CategoryName + delimiter : ""; string selectedIconUri = iconFalgs + IconSource.SelectedCategory.CategoryName + delimiter + selectedSubCategoryName + IconSource.SelectedIcon.IconName; //actualPointStyle.Image.SetPathFilename(selectedIconUri); actualPointStyle.SetImageIconPath(selectedIconUri); } } catch (Exception ex) { GisEditor.LoggerManager.Log(LoggerLevel.Debug, ex.Message, new ExceptionInfo(ex)); } finally { if (bitmap != null) { bitmap.Dispose(); } } }