예제 #1
0
        private void Updated()
        {
            var presets = KCDatabase.Instance.FleetPreset;

            if (presets == null || presets.MaximumCount <= 0)
            {
                return;
            }

            TablePresets.Enabled = false;
            TablePresets.SuspendLayout();

            if (TableControls.Count < presets.MaximumCount)
            {
                for (int i = TableControls.Count; i < presets.MaximumCount; i++)
                {
                    var control = new TablePresetControl(this);
                    control.ConfigurationChanged(this);
                    TableControls.Add(control);
                    control.AddToTable(TablePresets, i);
                }

                ControlHelper.SetTableRowStyles(TablePresets, ControlHelper.GetDefaultRowStyle());
            }

            for (int i = 0; i < TableControls.Count; i++)
            {
                TableControls[i].Update(i + 1);
            }

            TablePresets.ResumeLayout();
            TablePresets.Enabled = true;
        }
예제 #2
0
        private void ConfigurationChanged()
        {
            var config = Utility.Configuration.Config;

            Font = Utility.Configuration.Config.UI.MainFont;
            bool fixShipNameWidth = config.FormFleet.FixShipNameWidth;

            TablePresets.SuspendLayout();
            foreach (var item in TableControls)
            {
                item.ConfigurationChanged(this);
            }

            for (int i = 1; i < TablePresets.ColumnCount; i++)
            {
                ControlHelper.SetTableColumnStyle(TablePresets, i, fixShipNameWidth ?
                                                  new ColumnStyle(SizeType.Absolute, config.FormFleet.FixedShipNameWidth + 4) :
                                                  new ColumnStyle(SizeType.AutoSize));
            }
            ControlHelper.SetTableRowStyles(TablePresets, ControlHelper.GetDefaultRowStyle());
            TablePresets.ResumeLayout();
        }