コード例 #1
0
ファイル: Form1.cs プロジェクト: shaiatias/learning-c-sharp
        private void ActionSort()
        {
            Rectangle_List.Sort((x, y) => x.Width * x.Height - y.Width * y.Height);
            Square_List.Sort((x, y) => x.Width * x.Height - y.Width * y.Height);

            if (RectangleSquare_1 == "Rectangle")
            {
                Arrange(UC_1, Rectangle_List);
                Arrange(UC_2, Square_List);
            }
            else
            {
                Arrange(UC_1, Square_List);
                Arrange(UC_2, Rectangle_List);
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: shaiatias/learning-c-sharp
        void Action_resultControl()
        {
            for (int i = 0; i < UC_1.arrControls.Length; i++)
            {
                Control temp = UC_1.arrControls[i];
                if (temp.Width != temp.Height)
                {
                    Rectangle_List.Add(temp);
                }
                else
                {
                    Square_List.Add(temp);
                }
            }
            for (int i = 0; i < UC_2.arrControls.Length; i++)
            {
                Control temp = UC_2.arrControls[i];
                if (temp.Width != temp.Height)
                {
                    Rectangle_List.Add(temp);
                }
                else
                {
                    Square_List.Add(temp);
                }
            }

            Control tempControl = null;

            if (RectangleSquare_1 == "Rectangle")
            {
                Rectangle_List = Filter_ButtonLabel_RedGreenBlue(Rectangle_List, ButtonLabel_1, RedGreenBlue_1);
                if (MinMax_1 == "Max")
                {
                    tempControl = Max_Control(Rectangle_List);
                }
                else
                {
                    tempControl = Min_Control(Rectangle_List);
                }

                resultControl_1.BackColor = tempControl.BackColor;
                resultControl_1.Size      = tempControl.Size;

                Square_List = Filter_ButtonLabel_RedGreenBlue(Square_List, ButtonLabel_2, RedGreenBlue_2);
                if (MinMax_2 == "Max")
                {
                    tempControl = Max_Control(Square_List);
                }
                else
                {
                    tempControl = Min_Control(Square_List);
                }
                resultControl_2.BackColor = tempControl.BackColor;
                resultControl_2.Size      = tempControl.Size;
            }
            else
            {
                Square_List = Filter_ButtonLabel_RedGreenBlue(Square_List, ButtonLabel_1, RedGreenBlue_1);
                if (MinMax_1 == "Max")
                {
                    tempControl = Max_Control(Square_List);
                }
                else
                {
                    tempControl = Min_Control(Square_List);
                }
                resultControl_1.BackColor = tempControl.BackColor;
                resultControl_1.Size      = tempControl.Size;

                Rectangle_List = Filter_ButtonLabel_RedGreenBlue(Rectangle_List, ButtonLabel_2, RedGreenBlue_2);
                if (MinMax_2 == "Max")
                {
                    tempControl = Max_Control(Rectangle_List);
                }
                else
                {
                    tempControl = Min_Control(Rectangle_List);
                }

                resultControl_2.BackColor = tempControl.BackColor;
                resultControl_2.Size      = tempControl.Size;
            }
        }