public DecoResourceTreeView() : base() { _treeStructureColumn = new TreeStructureColumn(); Columns.Add(_treeStructureColumn); _iconColumn = new ResourceIconColumn(); Columns.Add(_iconColumn); _nameColumn = new RichTextColumn(); _nameColumn.AutoSize = true; Columns.Add(_nameColumn); }
private void Initialize() { AllowColumnReorder = false; AllowDrop = true; ExecuteDoubleClickAction = false; HeaderStyle = ColumnHeaderStyle.None; HideSelection = false; Location = new System.Drawing.Point(0, 0); ShowContextMenu = false; MultiSelect = false; _chboxColumn = AddCheckBoxColumn(); _nameColumn = new RichTextColumn(); _nameColumn.AutoSize = true; Columns.Add(_nameColumn); }
public ResourceTreePaneBase() { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); _resourceTree = new ResourceListView2(); _resourceTree.Dock = DockStyle.Fill; _resourceTree.BorderStyle = BorderStyle.None; _resourceTree.ContextProvider = this; TreeStructureColumn treeStructureColumn = new TreeStructureColumn(); treeStructureColumn.Width = 20; _resourceTree.Columns.Add(treeStructureColumn); _resourceTree.Columns.Add(new ResourceIconColumn()); _resourceTree.JetListView.KeyDown += HandleResourceTreeKeyDown; _resourceTree.JetListView.ActiveNodeChanged += HandleActiveNodeChanged; _resourceTree.KeyNavigationCompleted += HandleKeyNavigationCompleted; _textColumn = new RichTextColumn(); _textColumn.SizeToContent = true; _textColumn.ItemToolTipCallback = HandleToolTipCallback; _resourceTree.Columns.Add(_textColumn); Controls.Add(_resourceTree); Controls.SetChildIndex(_resourceTree, 0); _toolbarManager = new ToolbarActionManager(_toolBar); _toolbarManager.ContextProvider = this; _dataProvider = new ResourceTreeDataProvider(); SetStyle(ControlStyles.Selectable, false); UnreadManager unreadManager = (UnreadManager)Core.UnreadManager; if (unreadManager.Enabled) { _unreadDecorator = new UnreadNodeDecorator(); _textColumn.AddNodeDecorator(_unreadDecorator); } }
protected override void DrawItemText(Graphics g, Rectangle rcText, object item, Color textColor, RowState state, string highlightText) { IResource res = (IResource)item; string context = _highlightDataProvider.GetContext(res); if (context != null) { RichText richText = (RichText)_contextCache [res.Id]; if (richText == null) { richText = new RichText(context, new RichTextParameters(OwnerControl.Font, new TextStyle(FontStyle.Regular, Color.DarkGreen, Color.Transparent))); OffsetData[] data = _highlightDataProvider.GetContextHighlightData(res); if (data != null) { for (int i = 0; i < data.Length; i++) { richText.SetStyle(FontStyle.Bold, data [i].Start, data [i].Length); } } _contextCache [res.Id] = richText; } g.DrawLine(_barPen, rcText.X + 2, rcText.Y + 1, rcText.X + 2, rcText.Y + rcText.Height - 2); ShiftRectForText(ref rcText); RichTextColumn.FormatRowRichText(ref richText, textColor, state, highlightText); richText.DrawClipped(g, rcText); } else { base.DrawItemText(g, rcText, item, textColor, state, highlightText); } }