Ejemplo n.º 1
0
        public DrawFrame(DesignPanel tD, int width, int height, Image backImage)
        {
            TDPanel = tD;

            this.SetStyle(ControlStyles.Selectable, true);

            InitializeComponent();

            this.BackColor = Color.FromArgb(192, 192, 192);
            this.SetStyle(ControlStyles.Selectable, true);
            this.AutoScroll = false;
            this.Cursor     = Cursors.Arrow;

            DrawPanel          = CreateDrawPanel(tD, width, height, backImage);
            DrawPanel.TabIndex = 0;
            DrawPanel.Select();
            DrawPanel.BackColor = Color.White;

            this.Controls.Add(DrawPanel);
            this.SetLocation();

            //事件初始化

            this.SizeChanged += new EventHandler(DrawFrame_SizeChanged);
            this.DfVScrollBar.ValueChanged += new EventHandler(DfVScrollBar_ValueChanged);
            this.DfHScrollBar.ValueChanged += new EventHandler(DfHScrollBar_ValueChanged);
            this.DfVScrollBar.SmallChange   = 10;
            this.DfHScrollBar.SmallChange   = 10;
        }
Ejemplo n.º 2
0
 public LockRectCommand(DesignPanel tdPanel, List <Rect> lockedRects)
 {
     TDPanel     = tdPanel;
     LockedRects = lockedRects;
     LockedLines = new List <PartitionLine>();
     CommandInfo = "锁定矩形";
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 工厂模式动态创建DrawFrame
        /// </summary>
        protected override DrawFrame CreateDrawFrame(DesignPanel tD, int width, int height, Image backImage)
        {
            TmpltDrawFrame df = new TmpltDrawFrame(tD, width, height, backImage);

            df.TmpltDoc = TmpltDoc;
            return(df);
        }
Ejemplo n.º 4
0
 public HRuler(DesignPanel tD)
 {
     TDPanel  = tD;
     StartPos = 0F;
     CurPos   = 0;
     InitializeComponent();
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 创建画板
        /// </summary>
        /// <param name="tD"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <param name="backImage"></param>
        /// <returns></returns>
        protected override DrawPanel CreateDrawPanel(DesignPanel tD, int width, int height, Image backImage)
        {
            TmpltDrawPanel drawPanel = new TmpltDrawPanel(tD, width, height, backImage);

            drawPanel.TmpltDoc = TmpltDoc;
            return(drawPanel);
        }
Ejemplo n.º 6
0
 public DisLockRectCommand(DesignPanel tdPanel, List <Rect> unLockedRect)
 {
     TDPanel       = tdPanel;
     UnLockedRects = unLockedRect;
     UnLockedLines = new List <PartitionLine>();
     CommandInfo   = "解开锁定矩形";
 }
Ejemplo n.º 7
0
 public VRuler(DesignPanel tD)
 {
     TDPanel     = tD;
     MaximumSize = new Size(Int32.MaxValue, Int32.MaxValue);
     StartPos    = 0F;
     CurPos      = 0;
     InitializeComponent();
 }
Ejemplo n.º 8
0
        public ChangeSnipPerpertyCommand(DesignPanel tdPanel, SnipRect pastedSnipRect, SnipData newData)
        {
            PastedSnipRect = pastedSnipRect;
            NewSnipData    = newData;
            OldSnipData    = new SnipData(pastedSnipRect.SnipData);

            TDPanel          = tdPanel;
            TDPanel.Modified = true;
            CommandInfo      = "更改页面片属性";
        }
Ejemplo n.º 9
0
 public PartRectCommand(DesignPanel tdPanel, bool isRow, List <Rect> addedRects, Rect removedRect, List <PartitionLine> newLines)
 {
     IsRow      = isRow;
     AddedRects = addedRects;
     RemovedRects.Add(removedRect);
     AddedLines       = newLines;
     TDPanel          = tdPanel;
     TDPanel.Modified = true;
     CommandInfo      = "合并矩形";
 }
Ejemplo n.º 10
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="tdPanel"></param>
        /// <param name="selectedRects">将要置为选择状态之矩形</param>
        /// <param name="disSelectedRects">将取消选择状态之矩形</param>
        /// <param name="selectedLines">将被选择的直线</param>
        /// <param name="disSelectedLines">将被取消选择的直线</param>
        public SelectCommand(DesignPanel tdPanel, List <Rect> selectedRects, List <Rect> disSelectedRects, List <PartitionLine> selectedLines, List <PartitionLine> disSelectedLines)
        {
            TDPanel = tdPanel;

            SelectedRects.AddRange(selectedRects);
            DisSelectedRects.AddRange(disSelectedRects);
            SelectedLines.AddRange(selectedLines);
            DisSelectedLines.AddRange(disSelectedLines);

            CommandInfo = "更改选择对象";
        }
Ejemplo n.º 11
0
 public CilpPanelCommand(DesignPanel tdPanel, Rect rect, Image img)
 {
     _width      = rect.Width;
     _height     = rect.Height;
     _x          = rect.X;
     _y          = rect.Y;
     _rect       = rect;
     TDPanel     = tdPanel;
     _listLine   = tdPanel.DrawPanel.ListLine;
     CommandInfo = "切割画板";
     _backImg    = img;
 }
Ejemplo n.º 12
0
        public PasteSnipDataCommand(DesignPanel tdPanel, List <Rect> pastedSnipRects, SnipData newData, TmpltXmlDocument doc)
        {
            PastedSnipRects = pastedSnipRects;
            Doc             = doc;
            NewSnipData     = newData;
            dPanel          = tdPanel;
            foreach (Rect rect in PastedSnipRects)
            {
                OldSnipDatas[rect] = rect.SnipData;
            }

            CommandInfo = "粘贴页面片数据";
        }
Ejemplo n.º 13
0
        public AddLineCommand(DesignPanel tdPanel, int start, int end, int position, bool isRow)
        {
            Init();
            AddedLines.Add(new PartitionLine(start, end, position, isRow));

            Start    = start;
            End      = end;
            Position = position;
            IsRow    = isRow;

            TDPanel          = tdPanel;
            TDPanel.Modified = true;
            CommandInfo      = "插入直线";
        }
Ejemplo n.º 14
0
        public AddLineCommand(DesignPanel tdPanel, PartitionLine addedLine)
        {
            Init();
            AddedLines.Add(addedLine);

            Start    = addedLine.Start;
            End      = addedLine.End;
            Position = addedLine.Position;
            IsRow    = addedLine.IsRow;

            TDPanel          = tdPanel;
            TDPanel.Modified = true;
            CommandInfo      = "插入直线";
        }
Ejemplo n.º 15
0
        public DeleteLineCommand(DesignPanel tdPanel, PartitionLine line, List <Rect> addedRects, List <Rect> removedRects)
        {
            Start    = line.Start;
            End      = line.End;
            Position = line.Position;
            IsRow    = line.IsRow;


            AddedRects   = addedRects;
            RemovedRects = removedRects;

            TDPanel          = tdPanel;
            TDPanel.Modified = true;
            CommandInfo      = "删除直线";
        }
Ejemplo n.º 16
0
        public TmpltDrawPanel(DesignPanel tDPanel, int width, int height, Image backImage)
            : base(tDPanel, width, height, backImage)
        {
            ResourcesReader.SetObjectResourcesHelper(this);

            InitializeComponent();

            //双缓存
            this.DoubleBuffered = true;
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.UserPaint, true);
            _lockedImg      = GetImage("lockedImage");
            _selectedImg    = GetImage("selectedImage");
            _hasSnip        = GetImage("hasSnipImage");
            _hasContentSnip = GetImage("hasContentSnipImage");
        }
Ejemplo n.º 17
0
        public MergeRectCommand(DesignPanel tdPanel)
        {
            TDPanel = tdPanel;

            List <Rect> selectedRects = tdPanel.DrawPanel.ListRect.GetSelectedRects();
            Rectangle   boundaryRect  = CommonFuns.FindRectsBorder(selectedRects);

            ///保存边界矩形
            BoundaryRect = new Rectangle(
                boundaryRect.X,
                boundaryRect.Y,
                boundaryRect.Width,
                boundaryRect.Height
                );

            CommandInfo = "合并矩形";
        }
Ejemplo n.º 18
0
        public MoveLineCommand(DesignPanel tdPanel,
                               PartitionLine movedLine,
                               int movedToPos,
                               PartitionLine firstBorderLine,
                               PartitionLine secondBorderLine)
        {
            TDPanel = tdPanel;

            MovedLine = movedLine;

            MovedToPos       = movedToPos;
            FirstBorderLine  = firstBorderLine;
            SecondBorderLine = secondBorderLine;

            ///初始化Rects
            InitRects();
            ///初始化直线数据:NewLines,EndPointLines,StartPointLines
            InitLines();

            TDPanel.Modified = true;
            CommandInfo      = "移动直线";
        }
Ejemplo n.º 19
0
 public TmpltVRuler(DesignPanel tD)
     : base(tD)
 {
     //InitContextMenu();
 }
Ejemplo n.º 20
0
 /// <summary>
 /// 动态创建VRuler
 /// </summary>
 protected override VRuler CreateVRuler(DesignPanel tD)
 {
     return(new TmpltVRuler(tD));
 }
Ejemplo n.º 21
0
 internal TmpltDrawFrame(DesignPanel tD, int width, int height, Image backImage)
     : base(tD, width, height, backImage)
 {
     InitializeComponent();
 }
Ejemplo n.º 22
0
 protected virtual HRuler CreateHRuler(DesignPanel tD)
 {
     return(new HRuler(tD));
 }
Ejemplo n.º 23
0
 protected virtual VRuler CreateVRuler(DesignPanel tD)
 {
     return(new VRuler(tD));
 }
Ejemplo n.º 24
0
 /// <summary>
 /// 动态创建DrawPanel
 /// </summary>
 /// <param name="tD"></param>
 /// <param name="width"></param>
 /// <param name="height"></param>
 /// <returns></returns>
 protected virtual DrawPanel CreateDrawPanel(DesignPanel tD, int width, int height, Image backImage)
 {
     return(new DrawPanel(tD, width, height, backImage));
 }
Ejemplo n.º 25
0
 public RectList(DesignPanel tD)
 {
     SnipRectList = new SDList <Rect>();
     TDPanel      = tD;
 }