Esempio n. 1
0
        public ConfigForm(MainForm mainForm, Kugelmatik kugelmatik)
        {
            this.mainForm = mainForm;
            this.kugelmatik = kugelmatik;

            InitializeComponent();

            propertyGrid.SelectedObject = kugelmatik.Config;
            clusterPropertyGrid.SelectedObject = kugelmatik.ClusterConfig;
        }
        public ClusterControlDetailed(MainForm form, Cluster cluster)
        {
            if (cluster == null)
                throw new ArgumentNullException(nameof(cluster));

            this.Form = form;

            InitializeComponent();

            const int padding = 2; // Abstand zwischen zwei StepperControls
            int height = 0;

            steppers = new StepperControl[Cluster.Width * Cluster.Height];

            // im folgenden wird über X und Y Koordinaten eine Tabelle erzeugt
            for (int y = 0; y < Cluster.Height; y++)
            {
                Label labelRow = new Label();
                labelRow.Text = (Cluster.Height - y).ToString();
                labelRow.AutoSize = true;
                steppersPanel.Controls.Add(labelRow);

                for (int x = 0; x < Cluster.Width; x++)
                {
                    StepperControl stepper = new StepperControl(cluster.GetStepperByPosition(x, Cluster.Height - 1 - y));
                    steppersPanel.Controls.Add(stepper);

                    steppers[y * Cluster.Width + x] = stepper;

                    Label labelColumn = new Label();
                    labelColumn.Text = (x + 1).ToString();
                    labelColumn.AutoSize = true;
                    steppersPanel.Controls.Add(labelColumn);
                    labelColumn.Location = new Point(x * (stepper.Width + padding) + labelRow.Width + stepper.Width / 2 - labelColumn.Width / 2, 0);

                    stepper.Location = new Point(x * (stepper.Width + padding) + labelRow.Width, y * (stepper.Height + padding) + labelColumn.Height);
                    stepper.Click += (sender, e) =>
                    {
                        ShowStepper((StepperControl)sender);
                    };
                    height = stepper.Height + padding;
                }

                labelRow.Location = new Point(0, y * height + height / 2 - labelRow.Height / 2);
            }

            ShowCluster(cluster);
        }
Esempio n. 3
0
 public ClusterForm(MainForm form)
 {
     this.Form = form;
     InitializeComponent();
 }