public static bool is_visible(this OLVColumn col) { Debug.Assert(col.Tag != null); bool is_line_col = col.fixed_index() == 0; bool visible = is_line_col ? col.Width > 1 : col.IsVisible; return visible; }
public static int col_width(this OLVColumn col) { Debug.Assert(col.Tag != null); bool is_line_col = col.fixed_index() == 0; if (is_line_col) { if (col.is_visible()) return col.Width; else return col.lv_tag().line_width; } else return col.Width; }
public static void col_width(this OLVColumn col, int width) { Debug.Assert(col.Tag != null); bool is_line_col = col.fixed_index() == 0; bool show = col.is_visible(); if (is_line_col) { if (show) { col.MaximumWidth = -1; col.Width = width; } else { col.lv_tag().line_width = width; // ... don't allow resizing col.MaximumWidth = col.Width = 1; } col.IsVisible = true; } else { col.Width = width; col.IsVisible = show; } }
public static void is_visible(this OLVColumn col, bool show) { Debug.Assert(col.Tag != null); if (col.is_visible() == show) return; // 1.6.6 for Line column - we can't hide it (due to some weird b_ug in ListView); so we just set its width to 1 bool is_line_col = col.fixed_index() == 0; if (is_line_col) { // for line column - simple trick - save the old width in "Tag" property if (show) { col.MaximumWidth = -1; col.Width = col.lv_tag().line_width > 0 ? col.lv_tag().line_width : 80; } else { col.lv_tag().line_width = col.Width; col.MaximumWidth = col.Width = 1; } col.IsVisible = true; } else col.IsVisible = show; }