Changeset 4068 for trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/Tools/AlignTopEdgesTool.cs
- Timestamp:
- 07/22/10 00:44:01 (14 years ago)
- 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/AlignTopEdgesTool.cs
r2768 r4068 1 using System;2 using System.Collections.Generic;3 using System.Text;4 using System.Collections;5 1 using System.Drawing; 6 using System.Windows.Forms;7 2 8 namespace Netron.Diagramming.Core 9 { 10 // ---------------------------------------------------------------------- 3 namespace Netron.Diagramming.Core { 4 // ---------------------------------------------------------------------- 5 /// <summary> 6 /// Aligns the top edges of the selected entities. 7 /// </summary> 8 // ---------------------------------------------------------------------- 9 public class AlignTopEdgesTool : AlignmentToolBase { 10 // ------------------------------------------------------------------ 11 11 /// <summary> 12 /// Aligns the top edges of the selected entities.12 /// Constructor. 13 13 /// </summary> 14 // ---------------------------------------------------------------------- 15 public class AlignTopEdgesTool : AlignmentToolBase 16 { 17 // ------------------------------------------------------------------ 18 /// <summary> 19 /// Constructor. 20 /// </summary> 21 /// <param name="toolName">string: The name of this tool</param> 22 // ------------------------------------------------------------------ 23 public AlignTopEdgesTool(string toolName) 24 : base(toolName) 25 { 26 } 14 /// <param name="toolName">string: The name of this tool</param> 15 // ------------------------------------------------------------------ 16 public AlignTopEdgesTool(string toolName) 17 : base(toolName) { 18 } 27 19 28 // ------------------------------------------------------------------ 29 /// <summary> 30 /// Aligns the top edges of all selected entities. The vertical 31 /// location of the first entity in the selection is used for all 32 /// other entities vertical location. 33 /// </summary> 34 // ------------------------------------------------------------------ 35 public override void Align(IDiagramEntity[] entities) 36 { 37 // We want to align the top edges, so we need to set the 38 // vertical location of each shape to one value. We're 39 // going use the first entity in the selection to determine 40 // this setting. 41 Point offset; 20 // ------------------------------------------------------------------ 21 /// <summary> 22 /// Aligns the top edges of all selected entities. The vertical 23 /// location of the first entity in the selection is used for all 24 /// other entities vertical location. 25 /// </summary> 26 // ------------------------------------------------------------------ 27 public override void Align(IDiagramEntity[] entities) { 28 // We want to align the top edges, so we need to set the 29 // vertical location of each shape to one value. We're 30 // going use the first entity in the selection to determine 31 // this setting. 32 Point offset; 42 33 43 for (int i = 1; i < entities.Length; i++) 44 { 45 IDiagramEntity entity = entities[i]; 34 for (int i = 1; i < entities.Length; i++) { 35 IDiagramEntity entity = entities[i]; 46 36 47 48 49 50 51 37 // Keep the entities same y location but offset it's 38 // x location. 39 offset = new Point( 40 0, 41 this.topEdgeOfFirstEntity - entity.Rectangle.Top); 52 42 53 // Move the entity by this amount. 54 entity.MoveBy(offset); 55 } 56 } 43 // Move the entity by this amount. 44 entity.MoveBy(offset); 45 } 57 46 } 47 } 58 48 }
Note: See TracChangeset
for help on using the changeset viewer.