public static bool Move_Button(int button_number, int x, int y) { if (button_number >= 0 && button_number <= _max_buttons) { int top_left_x = _button[button_number - 1].Get_Top_Left().Get_X(); int top_left_y = _button[button_number - 1].Get_Top_Left().Get_Y(); int bottom_right_x = _button[button_number - 1].Get_Bottom_Right().Get_X(); int bottom_right_y = _button[button_number - 1].Get_Bottom_Right().Get_Y(); top_left_x += x; top_left_y += y; bottom_right_x += x; bottom_right_y += y; _button[button_number - 1] = new My_Button(new Point(top_left_x, top_left_y), new Point(bottom_right_x, bottom_right_y)); return(true); } else { Console.WriteLine("button number not good"); return(false); } }
public static bool Create_New_Button(int x1, int y1, int x2, int y2) { bool answer = true; Point top_left; Point bottom_right; for (int i = 0; i < _button.Length; i++) { if (_button[i] == null) { top_left = new Point(x1, y1); bottom_right = new Point(x2, y2); _button[i] = new My_Button(top_left, bottom_right); _button_index++; answer = true; break; } } if (_button_index == _max_buttons) { answer = false; } return(answer); }