コード例 #1
0
ファイル: MvButton.cs プロジェクト: hanks5178/mv_design
        private MvButton GetFirstFeederInPanel(Control control)
        {
            if (control is GroupBox)
            {
                foreach (Control c in control.Controls)
                {
                    MvButton button = c as MvButton;
                    if (button != null)
                    {
                        return(button);
                    }
                }
            }

            return(null);
        }
コード例 #2
0
ファイル: MvButton.cs プロジェクト: hanks5178/mv_design
        void PlaceFeeder(MvButton feeder, Control control)
        {
            if (feeder == null)
            {
                return;
            }

            if (control is GroupBox)
            {
                PanelTag tag = control.Tag as PanelTag;
                feeder.Info.PanelX = tag.Index;
                feeder.IsArranged  = true;
                this.Location      = LocationOnGroupBox;
                control.Controls.Add(feeder);
                feeder.BringToFront();
            }
        }
コード例 #3
0
ファイル: MvButton.cs プロジェクト: hanks5178/mv_design
        void UnPlaceFeeder(MvButton feeder)
        {
            if (feeder == null)
            {
                return;
            }

            if (feeder.Parent is GroupBox)
            {
                feeder.Location = new Point(feeder.Parent.Location.X + feeder.Location.X, feeder.Parent.Location.Y + feeder.Location.Y);
                feeder.Parent.Controls.Remove(feeder);
                PanelArranged.Controls.Add(feeder);

                this.IsArranged = false;
            }

            feeder.BringToFront();
        }
コード例 #4
0
ファイル: MvButton.cs プロジェクト: hanks5178/mv_design
        private MvButton FlyToTheTarget(Control sourceGroupBox, Control targetControl)
        {
            MvButton sourceFeeder = GetFirstFeederInPanel(sourceGroupBox);
            MvButton targetFeeder = GetFirstFeederInPanel(targetControl);

            if (sourceFeeder == null)
            {
                return(targetFeeder);
            }

            if (targetControl is GroupBox)
            {
                Point targetLocation = new Point(targetControl.Location.X + LocationOnGroupBox.X, targetControl.Location.Y + LocationOnGroupBox.Y);
                Point feederLocation = new Point(sourceGroupBox.Location.X + LocationOnGroupBox.X, sourceGroupBox.Location.Y + LocationOnGroupBox.Y);
                sourceGroupBox.Controls.Remove(sourceFeeder);
                sourceFeeder.IsArranged = false;
                this.PanelArranged.Controls.Add(sourceFeeder);

                FlyTo(sourceFeeder, feederLocation, targetLocation, 50);

                PanelTag tag = targetControl.Tag as PanelTag;
                sourceFeeder.Info.PanelX = tag.Index;
                sourceFeeder.IsArranged  = true;
                sourceFeeder.Location    = LocationOnGroupBox;
                targetControl.Controls.Add(sourceFeeder);
            }
            else
            {
                Point feederLocation = new Point(sourceGroupBox.Location.X + sourceFeeder.Location.X, sourceGroupBox.Location.Y + sourceFeeder.Location.Y);
                Point targetLocation = new Point(sourceGroupBox.Location.X + 50, sourceGroupBox.Location.Y + 15);

                sourceGroupBox.Controls.Remove(sourceFeeder);
                sourceFeeder.IsArranged = false;
                this.PanelArranged.Controls.Add(sourceFeeder);

                FlyTo(sourceFeeder, feederLocation, targetLocation, 25);

                sourceFeeder.Location = targetLocation;
            }

            UnPlaceFeeder(targetFeeder);

            return(targetFeeder);
        }
コード例 #5
0
ファイル: MvButton.cs プロジェクト: hanks5178/mv_design
 public PanelTag(int index)
 {
     this.Index   = index;
     this.IsEmpty = true;
     this.Feeder  = null;
 }