示例#1
0
 public SnapToGrid(ref SnapToGrid e)
 {
     this.isLastSnapped = false;
     this.fieldWidth    = e.fieldWidth;
     this.coefSnap      = e.coefSnap;
     this.deltaSnap     = e.deltaSnap;
     this.snapType      = e.snapType;
     this.snapPoint     = e.snapPoint;
 }
示例#2
0
 public SnapToGrid(ref SnapToGrid e)
 {
     isLastSnapped = false;
     fieldWidth    = e.fieldWidth;
     coefSnap      = e.coefSnap;
     deltaSnap     = e.deltaSnap;
     snapType      = e.snapType;
     snapPoint     = e.snapPoint;
 }
        public RadShapeEditorControl()
        {
            snapToGrid      = new SnapToGrid();
            xoff            = yoff = 0;
            xOverflowOffset = yOverflowOffset = 0;
            maxWidth        = this.ClientRectangle.Width;
            maxHeight       = this.ClientRectangle.Height;
            minWidth        = 0;
            minHeight       = 0;

            //width of the guide line grid
            snapToGrid.FieldWidth    = FIELD_WIDTH;
            DRAWABLE_GRID_LINE_WIDTH = (int)snapToGrid.FieldWidth;
            //maximum distance from a guide line in pixels before snapping fires
            snapToGrid.SnapType  = SnapToGrid.SnapTypes.Fixed;
            snapToGrid.SnapFixed = 6;
            newSymmetricPoint    = referencePoint = null;
            dimensionPoints      = new ShapePoint[4];
            for (int i = 0; i < 4; ++i)
            {
                dimensionPoints[i] = new ShapePoint();
            }

            InitializeComponent();

            base.SetStyle(
                ControlStyles.OptimizedDoubleBuffer |
                ControlStyles.Opaque |
                ControlStyles.ContainerControl |
                ControlStyles.AllPaintingInWmPaint |
                ControlStyles.ResizeRedraw |
                ControlStyles.UserPaint, true);

            this.contextMenuPoint.RenderMode = ToolStripRenderMode.Professional;
            ((ToolStripProfessionalRenderer)this.contextMenuPoint.Renderer).ColorTable.UseSystemColors = true;

            this.contextMenuLine.RenderMode = ToolStripRenderMode.Professional;
            ((ToolStripProfessionalRenderer)this.contextMenuLine.Renderer).ColorTable.UseSystemColors = true;

            this.menuItemAddPoint.Click          += new EventHandler(menuItemAddPoint_Click);
            this.menuItemConvert.Click           += new EventHandler(menuItemConvert_Click);
            this.menuItemRemovePoint.Click       += new EventHandler(menuItemRemovePoint_Click);
            this.menuItemRemoveLine.Click        += new EventHandler(menuItemRemoveLine_Click);
            this.menuItemAnchorLeft.Click        += new EventHandler(menuItemAnchorLeft_Click);
            this.menuItemAnchorRight.Click       += new EventHandler(menuItemAnchorRight_Click);
            this.menuItemAnchorTop.Click         += new EventHandler(menuItemAnchorTop_Click);
            this.menuItemAnchorBottom.Click      += new EventHandler(menuItemAnchorBottom_Click);
            this.menuItemConvertLine.Click       += new EventHandler(menuItemConvert_Click);
            this.menuItemLeftTopCorner.Click     += new EventHandler(menuItemLeftTopCorner_Click);
            this.menuItemLeftBottomCorner.Click  += new EventHandler(menuItemLeftBottomCorner_Click);
            this.menuItemRightTopCorner.Click    += new EventHandler(menuItemRightTopCorner_Click);
            this.menuItemRightBottomCorner.Click += new EventHandler(menuItemRightBottomCorner_Click);
            this.menuItemLocked.Click            += new EventHandler(menuItemLocked_Click);
        }
示例#4
0
 public RadShapeEditorControl()
 {
     this.snapToGrid               = new SnapToGrid();
     this.xoff                     = this.yoff = 0;
     this.xOverflowOffset          = this.yOverflowOffset = 0;
     this.maxWidth                 = this.ClientRectangle.Width;
     this.maxHeight                = this.ClientRectangle.Height;
     this.minWidth                 = 0;
     this.minHeight                = 0;
     this.snapToGrid.FieldWidth    = 20f;
     this.DRAWABLE_GRID_LINE_WIDTH = (int)this.snapToGrid.FieldWidth;
     this.snapToGrid.SnapType      = SnapToGrid.SnapTypes.Fixed;
     this.snapToGrid.SnapFixed     = 6f;
     this.newSymmetricPoint        = this.referencePoint = (ShapePointBase)null;
     this.dimensionPoints          = new ShapePoint[4];
     for (int index = 0; index < 4; ++index)
     {
         this.dimensionPoints[index] = new ShapePoint();
     }
     this.InitializeComponent();
     this.SetStyle(ControlStyles.ContainerControl | ControlStyles.UserPaint | ControlStyles.Opaque | ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
     this.contextMenuPoint.RenderMode = ToolStripRenderMode.Professional;
     ((ToolStripProfessionalRenderer)this.contextMenuPoint.Renderer).ColorTable.UseSystemColors = true;
     this.contextMenuLine.RenderMode = ToolStripRenderMode.Professional;
     ((ToolStripProfessionalRenderer)this.contextMenuLine.Renderer).ColorTable.UseSystemColors = true;
     this.menuItemAddPoint.Click          += new EventHandler(this.menuItemAddPoint_Click);
     this.menuItemConvert.Click           += new EventHandler(this.menuItemConvert_Click);
     this.menuItemRemovePoint.Click       += new EventHandler(this.menuItemRemovePoint_Click);
     this.menuItemRemoveLine.Click        += new EventHandler(this.menuItemRemoveLine_Click);
     this.menuItemAnchorLeft.Click        += new EventHandler(this.menuItemAnchorLeft_Click);
     this.menuItemAnchorRight.Click       += new EventHandler(this.menuItemAnchorRight_Click);
     this.menuItemAnchorTop.Click         += new EventHandler(this.menuItemAnchorTop_Click);
     this.menuItemAnchorBottom.Click      += new EventHandler(this.menuItemAnchorBottom_Click);
     this.menuItemConvertLine.Click       += new EventHandler(this.menuItemConvert_Click);
     this.menuItemLeftTopCorner.Click     += new EventHandler(this.menuItemLeftTopCorner_Click);
     this.menuItemLeftBottomCorner.Click  += new EventHandler(this.menuItemLeftBottomCorner_Click);
     this.menuItemRightTopCorner.Click    += new EventHandler(this.menuItemRightTopCorner_Click);
     this.menuItemRightBottomCorner.Click += new EventHandler(this.menuItemRightBottomCorner_Click);
     this.menuItemLocked.Click            += new EventHandler(this.menuItemLocked_Click);
 }