//protected override void OnMouseUp(MouseEventArgs e)
            //{
            //    base.OnMouseUp(e);
            //    if (e.X >= _lastLeft)
            //    {
            //        IsRight = true;
            //    }
            //    else
            //        IsRight = false;

            //}

            protected override void OnSplitterMoved(SplitterEventArgs sevent)
            {
                base.OnSplitterMoved(sevent);
                if (this.Left >= _lastLeft)
                {
                    OffSet  = this.Left - _lastLeft;
                    IsRight = true;
                }
                else
                {
                    OffSet  = _lastLeft - this.Left;
                    IsRight = false;
                }

                //Update effect control
                LayerControl.ComputeEffectWidth(_layerCtrl, this);
                //computer critical value
                LayerControl.ComputerCritical(_layerCtrl, this);
                //Update effect data
                LayerControl.ComputeEffectWidth(_layerCtrl);

                var msgCtrl = MessageControl.Current;

                msgCtrl.SetShapeVisible(_layerCtrl);
                msgCtrl.ChangedService.MarkChanged();
                msgCtrl.ShapeControl.Invalidate();

                ControlService.RefreshPropertyGrid(_layerCtrl._layer);

                _layerCtrl.SetMaxWidth(30);
            }
Пример #2
0
            private void MouseMove(object sender, MouseEventArgs e)
            {
                if (e.Button == MouseButtons.Left)
                {
                    Point currentPoint = new Point(Cursor.Position.X, Cursor.Position.Y);
                    var   offset       = currentPoint.X - _lastPoint.X;
                    if (Math.Abs(offset) >= Constance.Effect.UnitWidth)
                    {
                        offset = offset / Constance.Effect.UnitWidth * Constance.Effect.UnitWidth;
                        int left = 0;
                        if (_layerCtrl.plLeft.Width + offset <= 0)
                        {
                            left = _layerCtrl.plLeft.Width;
                            _layerCtrl.plLeft.Width   = 0;
                            _layerCtrl.plRight.Width += left;

                            _lastPoint.X = _lastPoint.X - left;
                            _lastPoint.Y = currentPoint.Y;
                        }
                        else
                        {
                            _layerCtrl.plLeft.Width  += offset;
                            _layerCtrl.plRight.Width -= offset;
                            _lastPoint.X              = currentPoint.X;
                            _lastPoint.Y              = currentPoint.Y;
                        }
                        _layerCtrl.MoveUpdateEffect();

                        MessageControl.Current.SetShapeVisible(_layerCtrl);
                        //_layerCtrl.MoveUpdateEffect();
                        ControlService.RefreshPropertyGrid(_layerCtrl._layer);
                        MessageControl.Current.ChangedService.MarkChanged();
                        //SessionState.Instance["EffectMouseMove"] = true;

                        _layerCtrl.SetMaxWidth();
                    }
                    //SessionState.Instance.Remove("EffectMouseMove");
                }
            }
Пример #3
0
        private static void SnapLayers1(Control layerContainer)
        {
            int preID = -1;
            int count = 0;

            //Snap static Layers
            foreach (LayerControl frameLayer in layerContainer.Controls)
            {
                if (frameLayer.IsSelected)
                {
                    count++;
                }
            }

            for (int i = 0; i < layerContainer.Controls.Count; i++)
            {
                LayerControl item = layerContainer.Controls[i] as LayerControl;

                if (item.IsSelected)
                {
                    if (count == 1 && i > 0)
                    {
                        preID = i - 1;
                    }
                    if (preID > -1)
                    {
                        LayerControl prev   = layerContainer.Controls[preID] as LayerControl;
                        int          offset = prev.LayerRight - item.LayerLeft;
                        item.SetMaxWidth(offset);
                        item.PlRightWidth -= offset;;
                        item.LayerLeft     = prev.LayerRight;
                    }
                    preID = i;
                }
            }
        }