protected void add_control(Control c) { if (c.Tag is string) { mwl.tag_infos ti = new mwl.tag_infos((string)c.Tag); //if(tab_index > 0) c.TabIndex = tab_index; if (this.controls.ContainsKey(ti.name_ctrl)) { throw new Exception($"controllo '{ti.name_ctrl}' è già presente nel form '{this.name_view}'!"); } c.Tag = ti; this.controls.Add(ti.name_ctrl, c); } }
protected virtual void save_controls_child() { foreach (Control c in this.controls.Values) { if (c is DataGridView && c.Tag != null && c.Tag is mwl.tag_infos) { mwl.tag_infos ti = (mwl.tag_infos)c.Tag; ti.del_var("first-scroll-row"); if (((DataGridView)c).FirstDisplayedScrollingRowIndex > 0) { ti.set_var("first-scroll-row", ((DataGridView)c).FirstDisplayedScrollingRowIndex); } } } this.saved_controls = true; }
protected virtual void reload_controls_child() { if (!this.saved_controls) { return; } foreach (Control c in this.controls.Values) { if (c is DataGridView && c.Tag != null && c.Tag is mwl.tag_infos) { mwl.tag_infos ti = (mwl.tag_infos)c.Tag; if (ti.exists_var("first-scroll-row")) { if (((DataGridView)c).Rows.Count > 0 && ti.int_var("first-scroll-row") >= 0) { ((DataGridView)c).FirstDisplayedScrollingRowIndex = ti.int_var("first-scroll-row") < ((DataGridView)c).Rows.Count - 1 ? ti.int_var("first-scroll-row") : ((DataGridView)c).Rows.Count - 1; } } } } this.saved_controls = false; }