解决办法是在控件初始化时,通过下面方法再次加载图片:

ucCanvas.CreateCoordinateImage.Source = GetImageIcon(global::MainApplication.Properties.Resources.DL_Coordinate2);
private static BitmapImage GetImageIcon(System.Drawing.Bitmap bitmap)
        {
            BitmapImage bitmapImage = new BitmapImage();

            try
            {

                System.IO.MemoryStream ms = new System.IO.MemoryStream();
                bitmap.Save(ms, bitmap.RawFormat);
                bitmapImage.BeginInit();
                bitmapImage.StreamSource = ms;
                bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
                bitmapImage.EndInit();
                bitmapImage.Freeze();


            }
            catch (Exception ex)
            {

                Utilities.ShowExceptionMessage(ex);
            }

            return bitmapImage;
        }

相关文章:

  • 2022-12-23
  • 2021-11-23
  • 2022-12-23
  • 2021-11-29
  • 2021-12-15
  • 2021-05-31
  • 2022-01-25
  • 2022-12-23
猜你喜欢
  • 2021-12-18
  • 2021-12-10
  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
  • 2021-12-23
  • 2022-12-23
相关资源
相似解决方案