コード例 #1
0
 private void SnippingTool_AreaSelected(object sender, EventArgs e)
 {
     //Image_Capture owa = null;
     if (owa == null)
     {
         owa = (Image_Capture)this.ModelItem.GetCurrentValue();
     }
     if (SnippingTool.UniqueId == owa.ImageId)
     {
         string processDirectory = SelectHelper.ProjectLocation + "\\Images";
         if (!Directory.Exists(processDirectory))
         {
             Directory.CreateDirectory(processDirectory);
         }
         string ScreenPath = processDirectory + "\\" + owa.ImageId + ".png";
         var    bmp        = SnippingTool.Image;
         owa.Width  = SnippingTool.Image.Width;
         owa.Height = SnippingTool.Image.Height;
         owa.Top    = SnippingTool.Top;
         owa.Left   = SnippingTool.Left;
         bmp.Save(ScreenPath, ImageFormat.Bmp);
         img.Source    = new BitmapImage(new Uri(ScreenPath, UriKind.RelativeOrAbsolute));
         owa.ImagePath = ScreenPath;
     }
     window.Height = height;
     window.Width  = width;
     if (window.WindowState == WindowState.Minimized)
     {
         window.WindowState = WindowState.Normal;
     }
 }
コード例 #2
0
 private void ActivityDesigner_Loaded(object sender, RoutedEventArgs e)
 {
     window = Window.GetWindow(this);
     //height = window.Height;
     //width = window.Width;
     owa = (Image_Capture)this.ModelItem.GetCurrentValue();
     if ((owa.ImagePath != null) && (!string.IsNullOrEmpty(owa.ImagePath.Expression.ToString())))
     {
         img.Source = new BitmapImage(new Uri(owa.ImagePath.Expression.ToString(), UriKind.RelativeOrAbsolute));
     }
 }