Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/22/10 00:44:01 (14 years ago)
Author:
swagner
Message:

Sorted usings and removed unused usings in entire solution (#1094)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Tools/ImageExportTool.cs

    r2868 r4068  
    11using System;
    2 using System.Collections.Generic;
    3 using System.Text;
     2using System.Drawing;
    43using System.Windows.Forms;
    5 using System.Drawing;
    6 using System.IO;
    7 using System.Drawing.Imaging;
    84
    9 namespace Netron.Diagramming.Core
    10 {
    11     // ----------------------------------------------------------------------
     5namespace Netron.Diagramming.Core {
     6  // ----------------------------------------------------------------------
     7  /// <summary>
     8  /// A tool that uses the ImageExporter to create an image from the
     9  /// currently selected entities and adds the image to the clipboard.
     10  /// The ImageExporter is used indirectly by calling
     11  /// 'Selection.ToBitmap()'.
     12  /// </summary>
     13  // ----------------------------------------------------------------------
     14  public class ImageExportTool : AbstractTool {
     15    // ------------------------------------------------------------------
    1216    /// <summary>
    13     /// A tool that uses the ImageExporter to create an image from the
    14     /// currently selected entities and adds the image to the clipboard.
    15     /// The ImageExporter is used indirectly by calling
    16     /// 'Selection.ToBitmap()'.
     17    /// Initializes a new instance of the <see cref="T:ImageExportTool"/>
     18    /// class.
    1719    /// </summary>
    18     // ----------------------------------------------------------------------
    19     public class ImageExportTool : AbstractTool
    20     {
    21         // ------------------------------------------------------------------
    22         /// <summary>
    23         /// Initializes a new instance of the <see cref="T:ImageExportTool"/>
    24         /// class.
    25         /// </summary>
    26         /// <param name="name">string: The name of the tool.</param>
    27         // ------------------------------------------------------------------
    28         public ImageExportTool(string toolName)
    29             : base(toolName)
    30         {
     20    /// <param name="name">string: The name of the tool.</param>
     21    // ------------------------------------------------------------------
     22    public ImageExportTool(string toolName)
     23      : base(toolName) {
     24    }
     25
     26    #region Methods
     27
     28    // ------------------------------------------------------------------
     29    /// <summary>
     30    /// Called when the tool is activated.
     31    /// </summary>
     32    // ------------------------------------------------------------------
     33    protected override void OnActivateTool() {
     34      if (this.Controller.Model.Selection.SelectedItems.Count == 0) {
     35        MessageBox.Show("No shapes are selected.  " +
     36            "Please make a selection first.",
     37            "Image Export Error",
     38            MessageBoxButtons.OK,
     39            MessageBoxIcon.Information);
     40        return;
     41      }
     42
     43      try {
     44        // Create an image using the ImageExporter and copy it to
     45        // the clipboard.
     46        Bitmap image = this.Controller.Model.Selection.ToBitmap();
     47        if (image != null) {
     48          Clipboard.SetImage(image);
    3149        }
     50      }
     51      catch (Exception exc) {
     52        throw new InconsistencyException(
     53            "The Copy operation failed.", exc);
     54      }
     55      finally {
     56        DeactivateTool();
     57      }
     58    }
    3259
    33         #region Methods
    34 
    35         // ------------------------------------------------------------------
    36         /// <summary>
    37         /// Called when the tool is activated.
    38         /// </summary>
    39         // ------------------------------------------------------------------
    40         protected override void OnActivateTool()
    41         {
    42           if (this.Controller.Model.Selection.SelectedItems.Count == 0)
    43             {
    44                 MessageBox.Show("No shapes are selected.  " +
    45                     "Please make a selection first.",
    46                     "Image Export Error",
    47                     MessageBoxButtons.OK,
    48                     MessageBoxIcon.Information);
    49                 return;
    50             }
    51 
    52             try
    53             {
    54                 // Create an image using the ImageExporter and copy it to
    55                 // the clipboard.
    56               Bitmap image = this.Controller.Model.Selection.ToBitmap();
    57                 if (image != null)
    58                 {                   
    59                     Clipboard.SetImage(image);
    60                 }
    61             }
    62             catch (Exception exc)
    63             {
    64                 throw new InconsistencyException(
    65                     "The Copy operation failed.", exc);
    66             }
    67             finally
    68             {
    69                 DeactivateTool();
    70             }
    71         }
    72 
    73         #endregion
    74     }
     60    #endregion
     61  }
    7562}
Note: See TracChangeset for help on using the changeset viewer.