private bg_color ( BrightIdeasSoftware.OLVListItem item ) : Color | ||
item | BrightIdeasSoftware.OLVListItem | |
리턴 | Color |
private void set_text(bool force) { if (drawer_ == null) { return; } if (sel_row_ == parent_.sel_row_idx && sel_col_ == parent_.sel_col_idx && !force) { return; } sel_row_ = parent_.sel_row_idx; sel_col_ = parent_.sel_col_idx; string txt = parent_.sel_subitem_text; ++ignore_change_; Multiline = txt.IndexOfAny(util.any_enter_char) >= 0; var prints = parent_.sel.override_print(parent_, txt, sel_col_); print_info.to_single_enter_char(ref txt, ref prints); Clear(); AppendText(txt); var full_row = parent_.list.GetItem(sel_row_); int last_idx = 0; for (int print_idx = 0; print_idx < prints.Count; ++print_idx) { int cur_idx = prints[print_idx].Item1, cur_len = prints[print_idx].Item2; string before = txt.Substring(last_idx, cur_idx - last_idx); if (before != "") { Select(last_idx, cur_idx - last_idx); SelectionColor = drawer_.print_fg_color(full_row, default_print_); SelectionBackColor = drawer_.bg_color(full_row, sel_col_); } Select(cur_idx, cur_len); SelectionColor = drawer_.print_fg_color(full_row, prints[print_idx].Item3); SelectionBackColor = drawer_.print_bg_color(full_row, prints[print_idx].Item3); last_idx = cur_idx + cur_len; } last_idx = prints.Count > 0 ? prints.Last().Item1 + prints.Last().Item2 : 0; if (last_idx < txt.Length) { Select(last_idx, txt.Length - last_idx); SelectionColor = drawer_.print_fg_color(full_row, default_print_); SelectionBackColor = drawer_.bg_color(full_row, sel_col_); } // ... safety net SelectionStart = 0; SelectionLength = 0; --ignore_change_; }
private void show_sub_item(log_view lv, info_type type, RichTextBox text_ctrl) { match_item item = lv.sel; int row = lv.sel_row_idx; string txt = (item as filter.match).line.part(type); int col_idx = log_view_cell.info_type_to_cell_idx(type); var prints = lv.sel.override_print(lv, txt, col_idx, column_formatter_base.format_cell.location_type.details_pane).format_text.to_single_enter_char(); // ... text has changed txt = prints.text; text_ctrl.Clear(); text_ctrl.AppendText(txt); var full_row = lv.list.GetItem(row); text_ctrl.BackColor = drawer_.bg_color(full_row, col_idx, prints); var parts = prints.parts(default_print_); foreach (var part in parts) { text_ctrl.Select(part.start, part.len); text_ctrl.SelectionColor = drawer_.print_fg_color(full_row, part); text_ctrl.SelectionBackColor = drawer_.print_bg_color(full_row, part); } }
private void show_sub_item(log_view lv, info_type type, RichTextBox text_ctrl) { match_item item = lv.sel; int row = lv.sel_row_idx; string txt = (item as filter.match).line.part(type); int col = log_view_cell.info_type_to_cell_idx(type); var prints = lv.sel.override_print(lv, txt, col); print_info.to_single_enter_char(ref txt, ref prints); text_ctrl.Clear(); text_ctrl.AppendText(txt); var full_row = lv.list.GetItem(row); text_ctrl.BackColor = drawer_.bg_color(full_row, col); int last_idx = 0; for (int print_idx = 0; print_idx < prints.Count; ++print_idx) { int cur_idx = prints[print_idx].Item1, cur_len = prints[print_idx].Item2; string before = txt.Substring(last_idx, cur_idx - last_idx); if (before != "") { text_ctrl.Select(last_idx, cur_idx - last_idx); text_ctrl.SelectionColor = drawer_.print_fg_color(full_row, default_print_); text_ctrl.SelectionBackColor = drawer_.bg_color(full_row, col); } text_ctrl.Select(cur_idx, cur_len); text_ctrl.SelectionColor = drawer_.print_fg_color(full_row, prints[print_idx].Item3); text_ctrl.SelectionBackColor = drawer_.print_bg_color(full_row, prints[print_idx].Item3); last_idx = cur_idx + cur_len; } last_idx = prints.Count > 0 ? prints.Last().Item1 + prints.Last().Item2 : 0; if (last_idx < txt.Length) { text_ctrl.Select(last_idx, txt.Length - last_idx); text_ctrl.SelectionColor = drawer_.print_fg_color(full_row, default_print_); text_ctrl.SelectionBackColor = drawer_.bg_color(full_row, col); } }
public override void Render(Graphics g, Rectangle r) { // 1.3.30+ solved rendering issue :) DrawBackground(g, r); var i = ListItem.RowObject as match_item; if (i == null) { return; } var col_idx = Column.fixed_index(); var col_type = log_view_cell.cell_idx_to_type(col_idx); drawer_.cached_sel = parent_.multi_sel_idx_ui_thread; var text = GetText(); override_print_ = category_formatted(cache_.override_print(i, text, ListItem.Index, col_idx), i, col_type); text = override_print_.text; bg_color_ = drawer_.bg_color(ListItem, col_idx, override_print_); Brush brush = brush_.brush(bg_color_); g.FillRectangle(brush, r); StringFormat fmt = new StringFormat(StringFormatFlags.NoWrap); fmt.LineAlignment = StringAlignment.Center; fmt.Trimming = override_print_.align == HorizontalAlignment.Left ? StringTrimming.EllipsisCharacter : StringTrimming.None; fmt.Alignment = StringAlignment.Near; int left = 0; if (override_print_.align != HorizontalAlignment.Left) { var full_text_size = drawer_.text_width(g, text, drawer_.font(override_print_.merge_parts)) + image_width(); int width = r.Width; int extra = width - full_text_size; left = override_print_.align == HorizontalAlignment.Right ? extra - 5 : extra / 2; } left += image_width(); draw_string(left, text, g, brush, r, fmt); draw_image(g, r); }