/// <summary> /// Tells the row owner about this element. /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); // Find the columns collection and set the ItemsSource. DataGrid grid = ParentDataGrid; if (grid != null) { ItemsSource = new ColumnHeaderCollection(grid.Columns); grid.ColumnHeadersPresenter = this; DataGridHelper.TransferProperty(this, VirtualizingStackPanel.IsVirtualizingProperty); DataGridColumnHeader fillerColumnHeader = GetTemplateChild(ElementFillerColumnHeader) as DataGridColumnHeader; if (fillerColumnHeader != null) { DataGridHelper.TransferProperty(fillerColumnHeader, DataGridColumnHeader.StyleProperty); DataGridHelper.TransferProperty(fillerColumnHeader, DataGridColumnHeader.HeightProperty); } } else { ItemsSource = null; } }
internal static void PaintColumnMoveMarker(Graphics g, AdvTree tree, int columnMoveMarkerIndex, ColumnHeaderCollection columns) { if (columnMoveMarkerIndex == -1) throw new ArgumentException("columnMoveMarkerIndex must be grater or equal than 0"); if (columns == null) throw new ArgumentNullException("columns"); Color lineColor = ColorScheme.GetColor("834DD5"); Color fillColor = ColorScheme.GetColor("CCCFF8"); Size markerSize = new Size(10, 14); ColumnHeader header = null; if (columnMoveMarkerIndex == columns.Count) header = columns.LastVisibleColumn; else header = columns[columnMoveMarkerIndex]; Rectangle markerBounds = Rectangle.Empty; if (columnMoveMarkerIndex == columns.Count) markerBounds = new Rectangle(header.Bounds.Right - markerSize.Width, header.Bounds.Bottom - markerSize.Height, markerSize.Width, markerSize.Height); else if (columns[columnMoveMarkerIndex] == columns.FirstVisibleColumn) markerBounds = new Rectangle(header.Bounds.X, header.Bounds.Bottom - markerSize.Height, markerSize.Width, markerSize.Height); else markerBounds = new Rectangle(header.Bounds.X - markerSize.Width / 2 - tree.NodeLayout.GetCellLayout().LayoutSettings.CellHorizontalSpacing, header.Bounds.Bottom - markerSize.Height, markerSize.Width, markerSize.Height); if (tree.AutoScrollPosition.X != 0) markerBounds.Offset(tree.AutoScrollPosition.X, 0); using (GraphicsPath path = CreateMarker(markerBounds)) { using (SolidBrush brush = new SolidBrush(fillColor)) g.FillPath(brush, path); using (Pen pen = new Pen(lineColor, 1)) g.DrawPath(pen, path); } }
public TreeListView() { _columns = new ColumnHeaderCollection(); _panel = new TreeListPanel(); _panel.TreeListView = this; Scrollable = true; }
public TreeListView() { _columns = new ColumnHeaderCollection(); _panel = new TreeListPanel(); _panel.TreeListView = this; Scrollable = true; }
/// <summary> /// Tells the row owner about this element. /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); // Find the columns collection and set the ItemsSource. DataGrid grid = ParentDataGrid; if (grid != null) { ItemsSource = new ColumnHeaderCollection(grid.Columns); grid.ColumnHeadersPresenter = this; DataGridHelper.TransferProperty(this, VirtualizingStackPanel.IsVirtualizingProperty); DataGridColumnHeader fillerColumnHeader = GetTemplateChild(ElementFillerColumnHeader) as DataGridColumnHeader; if (fillerColumnHeader != null) { DataGridHelper.TransferProperty(fillerColumnHeader, DataGridColumnHeader.StyleProperty); DataGridHelper.TransferProperty(fillerColumnHeader, DataGridColumnHeader.HeightProperty); } } else { ItemsSource = null; } }
/// <summary> /// Initialize a new instance <see cref="ListView"/> /// </summary> public ListView() { Background = Color.NotSet; Foreground = Color.NotSet; headerForeground = Color.Yellow; summaryText = string.Empty; showSummary = false; AutoSize = false; showGridLine = true; columns = 1; FocusForeground = Color.Black; FocusBackground = Color.Cyan; ColumnHeaders = new ColumnHeaderCollection <T>(this); Items = new ListViewItemCollection <T>(this); gridBorderChars = new GridSpanBorderChars('╔', '═', '╗', '║', '║', '╚', '═', '╝', '╤', '╢', '╧', '╟', '│', '─', '┼', '┬', '┤', '┴', '├', '┌', '┐', '┘', '└'); groupBase = new ListViewGroupBase <T>(this) { borderColor = Application.SystemColors.BorderColor, borderChars = gridBorderChars, }; OnFocusChanged += InternalFocusChanged; }
public ListView () { background_color = Color.White;//ThemeEngine.Current.ColorWindow; groups = new ListViewGroupCollection (this); items = new ListViewItemCollection (this); items.Changed += new CollectionChangedHandler (OnItemsChanged); checked_indices = new CheckedIndexCollection (this); checked_items = new CheckedListViewItemCollection (this); columns = new ColumnHeaderCollection (this); foreground_color = SystemColors.WindowText; selected_indices = new SelectedIndexCollection (this); selected_items = new SelectedListViewItemCollection (this); items_location = new Point [16]; items_matrix_location = new ItemMatrixLocation [16]; reordered_items_indices = new int [16]; item_tooltip = new ToolTip (); item_tooltip.Active = false; insertion_mark = new ListViewInsertionMark (this); InternalBorderStyle = BorderStyle.Fixed3D; header_control = new HeaderControl (this); header_control.Visible = false; Controls.AddImplicit (header_control); item_control = new ItemControl (this); Controls.AddImplicit (item_control); h_marker = v_marker = 0; keysearch_tickcnt = 0; // scroll bars are disabled initially h_scroll.Visible = false; //h_scroll.ValueChanged += new EventHandler(HorizontalScroller); v_scroll.Visible = false; //v_scroll.ValueChanged += new EventHandler(VerticalScroller); // event handlers base.KeyDown += new KeyEventHandler(ListView_KeyDown); SizeChanged += new EventHandler (ListView_SizeChanged); //GotFocus += new EventHandler (FocusChanged); //LostFocus += new EventHandler (FocusChanged); //MouseWheel += new MouseEventHandler(ListView_MouseWheel); //MouseEnter += new EventHandler (ListView_MouseEnter); Invalidated += new InvalidateEventHandler (ListView_Invalidated); BackgroundImageTiled = false; this.SetStyle (ControlStyles.UserPaint | ControlStyles.StandardClick | ControlStyles.UseTextForAccessibility , false); }
void InitializeComponent() { _treeMenu = new ContextMenuStrip(); _treeMenuHelper = new ActionMenuHelper(); _treeMenuHelper.BuildContextMenu(_treeMenu); ContextMenuStrip = _treeMenu; HideSelection = false; // Sort the nodes using their compare to function UseCompareTo = true; DragDropSupport ddSupport = new DragDropSupport(this); ImageList = PresentationMap._icons; _columns = new ColumnHeaderCollection(); }
public void ColumnAutoSize() { AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); ColumnHeaderCollection cc = Columns; for (int i = 0; i < cc.Count; i++) { int colWidth = TextRenderer.MeasureText(cc[i].Text, Font).Width + 20; if (colWidth > cc[i].Width) { cc[i].Width = colWidth; } } }
public ListView() { items = new ListViewItemCollection(this); columns = new ColumnHeaderCollection(this); listItems = new ArrayList(); autoArrange = true; hideSelection = true; labelWrap = true; multiSelect = true; scrollable = true; activation = ItemActivation.Standard; alignStyle = ListViewAlignment.Top; borderStyle = BorderStyle.Fixed3D; headerStyle = ColumnHeaderStyle.Clickable; sorting = SortOrder.None; viewStyle = View.LargeIcon; }
/// <summary> /// Tells the row owner about this element. /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); // Find the columns collection and set the ItemsSource. DataGrid grid = ParentDataGrid; if (grid != null) { ItemsSource = new ColumnHeaderCollection(grid.Columns); grid.ColumnHeadersPresenter = this; DataGridHelper.TransferProperty(this, VirtualizingStackPanel.IsVirtualizingProperty); } else { ItemsSource = null; } }
/// <include file='doc\ListView.uex' path='docs/doc[@for="ListView.ListView"]/*' /> /// <devdoc> /// Creates an empty ListView with default styles. /// </devdoc> public ListView() : base() { listViewState = new System.Collections.Specialized.BitVector32(LISTVIEWSTATE_scrollable | LISTVIEWSTATE_multiSelect | LISTVIEWSTATE_labelWrap | LISTVIEWSTATE_hideSelection | LISTVIEWSTATE_autoArrange | LISTVIEWSTATE_showGroups); listViewState1 = new System.Collections.Specialized.BitVector32(LISTVIEWSTATE1_useCompatibleStateImageBehavior); SetStyle(ControlStyles.UserPaint, false); SetStyle(ControlStyles.StandardClick, false); SetStyle(ControlStyles.UseTextForAccessibility, false); odCacheFont = Font; odCacheFontHandle = FontHandle; SetBounds(0,0,121,97); listItemCollection = new ListViewItemCollection(new ListViewNativeItemCollection(this)); columnHeaderCollection = new ColumnHeaderCollection(this); }
void InitializeComponent() { _treeMenu = new ContextMenuStrip(); _treeMenuHelper = new ActionMenuHelper(); _treeMenuHelper.BuildContextMenu(_treeMenu); ContextMenuStrip = _treeMenu; HideSelection = false; // Sort the nodes using their compare to function UseCompareTo = true; DragDropSupport ddSupport = new DragDropSupport(this); ImageList = PresentationMap._icons; _columns = new ColumnHeaderCollection(); }
public static void NewMethod(this ColumnHeaderCollection collection) { //do stuff here }
public ColumnCollection(ColumnHeaderCollection columnCollection) { _base = columnCollection; }
internal override void PaintColumnHeaders(ColumnHeaderCollection columns, Graphics g, bool treeControlHeader) { // Setup rendering TreeRenderer renderer = m_SystemRenderer; if (this.Tree.NodeRenderer != null && this.Tree.RenderMode == eNodeRenderMode.Custom) renderer = this.Tree.NodeRenderer; //else if (this.Tree.RenderMode == eNodeRenderMode.Professional) // renderer = m_ProfRenderer; PaintColumnHeaders(renderer, columns, g, treeControlHeader); }
public Sheet() { ColumnHeaders = new ColumnHeaderCollection(this); }
/// <summary> /// Tells the row owner about this element. /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); // Find the columns collection and set the ItemsSource. DataGrid grid = ParentDataGrid; if (grid != null) { ItemsSource = new ColumnHeaderCollection(grid.Columns); grid.ColumnHeadersPresenter = this; DataGridHelper.TransferProperty(this, VirtualizingStackPanel.IsVirtualizingProperty); } else { ItemsSource = null; } }
private void PaintGridLines(NodeDisplayContext context, ColumnHeaderCollection columnHeaderCollection, Rectangle bounds) { Color color = this.Tree.GridLinesColor.IsEmpty ? context.NodeRenderer.ColorTable.GridLines : this.Tree.GridLinesColor; Graphics g = context.Graphics; for (int i = 0; i < columnHeaderCollection.Count; i++) { ColumnHeader columnHeader = columnHeaderCollection.ColumnAtDisplayIndex(i); if (!columnHeader.Visible || columnHeader.Bounds.Width <= 0) continue; Rectangle r = columnHeader.Bounds; r.Offset(context.Offset); if (columnHeaderCollection.ParentNode == null) { r.Offset(bounds.Location); if (!columnHeader.CellsBackColor.IsEmpty) { SmoothingMode oldSmoothing = g.SmoothingMode; g.SmoothingMode = SmoothingMode.None; Rectangle rBack = new Rectangle(r.X - 5, context.ClientRectangle.Y, r.Width + 4, context.ClientRectangle.Height); using (SolidBrush brush = new SolidBrush(columnHeader.CellsBackColor)) g.FillRectangle(brush, rBack); g.SmoothingMode = oldSmoothing; } } DisplayHelp.DrawLine(g, r.Right - (columnHeader.IsLastVisible ? 0 : 1), bounds.Y, r.Right - (columnHeader.IsLastVisible ? 0 : 1), bounds.Bottom, color, 1); } }
internal virtual void PaintColumnHeaders(ColumnHeaderCollection columns, Graphics g, bool treeControlHeader) { }
internal void PaintColumnHeaders(TreeRenderer renderer, ColumnHeaderCollection columns, Graphics g, bool treeControlHeader) { ColumnHeaderRendererEventArgs ce = new ColumnHeaderRendererEventArgs(); ce.Graphics = g; ce.Tree = this.Tree; ce.SortIndicatorColor = renderer.ColorTable.ColumnSortIndicatorColor; ElementStyle defaultNormalStyle = GetDefaultColumnStyleNormal(renderer); ElementStyle headerStyle = null; if(treeControlHeader) headerStyle = this.Tree.ColumnsBackgroundStyle == null ? GetDefaultHeaderStyle(renderer) : this.Tree.ColumnsBackgroundStyle; else headerStyle = this.Tree.NodesColumnsBackgroundStyle == null ? GetDefaultNodesHeaderStyle(renderer) : this.Tree.NodesColumnsBackgroundStyle; if (Tree.ColumnStyleNormal != null && Tree.ColumnStyleNormal.Custom) defaultNormalStyle = Tree.ColumnStyleNormal; Point offset = Point.Empty; if (this.Tree.AutoScroll) { offset = this.Tree.GetAutoScrollPositionOffset(); if (treeControlHeader) offset.Y = 0; } Rectangle columnsBounds = columns.Bounds; if (!treeControlHeader) columnsBounds.Offset(offset); ElementStyleDisplayInfo di = new ElementStyleDisplayInfo(headerStyle, g, columnsBounds); ElementStyleDisplay.Paint(di); Color columnSeparator = (headerStyle != null && !headerStyle.BorderColor.IsEmpty) ? headerStyle.BorderColor : Color.Empty; for (int i = 0; i < columns.Count; i++) { ColumnHeader column = columns.ColumnAtDisplayIndex(i); if (!column.Visible) continue; ElementStyle style = null; if (column.StyleNormal != "") style = Tree.Styles[column.StyleNormal].Copy(); else style = defaultNormalStyle.Copy(); if (column.IsMouseDown) { if (column.StyleMouseDown != "") style.ApplyStyle(Tree.Styles[column.StyleMouseDown]); else if (Tree.ColumnStyleMouseDown != null) style.ApplyStyle(Tree.ColumnStyleMouseDown); } else if (column.IsMouseOver) { if (column.StyleMouseOver != "") style.ApplyStyle(Tree.Styles[column.StyleMouseOver]); else if (Tree.ColumnStyleMouseOver != null) style.ApplyStyle(Tree.ColumnStyleMouseOver); } ce.ColumnHeader = column; Rectangle columnBounds = column.Bounds; columnBounds.Offset(offset); ce.Bounds = columnBounds; ce.Style = style; renderer.DrawColumnHeader(ce); if (!columnSeparator.IsEmpty) DisplayHelp.DrawLine(g, columnBounds.Right - (column.IsLastVisible ? 0 : 1), columnBounds.Y, columnBounds.Right - (column.IsLastVisible ? 0 : 1), columnBounds.Bottom - 1, columnSeparator, 1); } }
public ListView() { base.SetStyle(ControlStyles.UserPaint, false); base.SetStyle(ControlStyles.StandardClick, false); base.SetStyle(ControlStyles.UseTextForAccessibility, false); this.odCacheFont = this.Font; this.odCacheFontHandle = base.FontHandle; base.SetBounds(0, 0, 0x79, 0x61); this.listItemCollection = new ListViewItemCollection(new ListViewNativeItemCollection(this)); this.columnHeaderCollection = new ColumnHeaderCollection(this); }