private void FillData() { area_height = screen.Height / (num_vertical_leds + 2); area_width = screen.Width / (num_horizontal_leds + 2); int margin_top = (screen.Height - area_height * (num_vertical_leds + 2)) / 2; int margin_left = (screen.Width - area_width * (num_horizontal_leds + 2)) / 2; // вертикальные полосы for (int i = 1; i <= num_vertical_leds; ++i) { Data[i - 1] = new AreaForLED(margin_left, screen.Height - (i + 1) * area_height - margin_top, area_width, area_height); Data[2 * num_vertical_leds + num_horizontal_leds - i] = new AreaForLED(screen.Width - area_width - margin_left, screen.Height - (i + 1) * area_height - margin_top, area_width, area_height); } // горизонтальные полосы for (int i = 1; i <= num_horizontal_leds; ++i) { Data[num_vertical_leds + i - 1] = new AreaForLED(i * area_width + margin_left, margin_top, area_width, area_height); Data[2 * num_vertical_leds + 2 * num_horizontal_leds - i] = new AreaForLED(i * area_width + margin_left, screen.Height - area_height - margin_top, area_width, area_height); } // левый верхний угол CornerData[0] = new AreaForLED(margin_left, margin_top, area_width, area_height); // правый верхний угол CornerData[1] = new AreaForLED(screen.Width - area_width - margin_left, margin_top, area_width, area_height); // правый нижний угол CornerData[2] = new AreaForLED(screen.Width - area_width - margin_left, screen.Height - area_height - margin_top, area_width, area_height); // правый левый угол CornerData[3] = new AreaForLED(margin_left, screen.Height - area_height - margin_top, area_width, area_height); }
public void RefreshSettings(int num_vertical_leds, int num_horizontal_leds) { this.num_vertical_leds = num_vertical_leds; this.num_horizontal_leds = num_horizontal_leds; screen_capture.RefreshScreenResolution(); screen.Width = screen_capture.Width; screen.Height = screen_capture.Height; Data = new AreaForLED[2 * num_vertical_leds + 2 * num_horizontal_leds]; FillData(); }
public DataToSend(int num_vertical_leds, int num_horizontal_leds) { this.num_vertical_leds = num_vertical_leds; this.num_horizontal_leds = num_horizontal_leds; Data = new AreaForLED[2 * num_vertical_leds + 2 * num_horizontal_leds]; CornerData = new AreaForLED[4]; screen_capture = new ScreenCapture(0, 0); screen.Width = screen_capture.Width; screen.Height = screen_capture.Height; FillData(); }