/// <summary> /// Draw column in header control /// </summary> /// <param name="graphicsColumn"></param> /// <param name="rectColumn"></param> /// <param name="column"></param> public virtual void DrawColumnHeader( Graphics graphicsColumn, Rectangle rectColumn, GLColumn column ) { DW("DrawColumn"); if ( this.ControlStyle == GLControlStyles.SuperFlat ) { SolidBrush brush = new SolidBrush( this.SuperFlatHeaderColor ); graphicsColumn.FillRectangle( brush, rectColumn ); brush.Dispose(); } else if (( this.ControlStyle == GLControlStyles.XP )&& this.ThemesAvailable ) { // this is really the only thing we care about for themeing right now inside the control System.IntPtr hDC = graphicsColumn.GetHdc();; RECT colrect = new RECT( rectColumn.X, rectColumn.Y, rectColumn.Right, rectColumn.Bottom ); RECT cliprect = new RECT( rectColumn.X, rectColumn.Y, rectColumn.Right, rectColumn.Bottom ); if ( column.State == ColumnStates.csNone ) { //Debug.WriteLine( "Normal" ); ThemeRoutines.DrawThemeBackground( m_hTheme, hDC, 1, 1, ref colrect, ref cliprect ); } else if ( column.State == ColumnStates.csPressed ) { //Debug.WriteLine( "Pressed" ); ThemeRoutines.DrawThemeBackground( m_hTheme, hDC, 1, 3, ref colrect, ref cliprect ); } else if ( column.State == ColumnStates.csHot ) { //Debug.WriteLine( "Hot" ); ThemeRoutines.DrawThemeBackground( m_hTheme, hDC, 1, 2, ref colrect, ref cliprect ); } graphicsColumn.ReleaseHdc(hDC); } else // normal state { if ( column.State != ColumnStates.csPressed ) ControlPaint.DrawButton( graphicsColumn, rectColumn, ButtonState.Normal ); else ControlPaint.DrawButton( graphicsColumn, rectColumn, ButtonState.Pushed ); } // if there is an image, this routine will RETURN with exactly the space left for everything else after the image is drawn (or not drawn due to lack of space) if ( (column.ImageIndex > -1) && (ImageList != null) && (column.ImageIndex < this.ImageList.Images.Count) ) rectColumn = DrawCellGraphic( graphicsColumn, rectColumn, this.ImageList.Images[ column.ImageIndex ], HorizontalAlignment.Left ); DrawCellText( graphicsColumn, rectColumn, column.Text, column.TextAlignment, this.ForeColor, false, HeaderWordWrap ); }
/// <summary> /// Return index of column in collection /// </summary> /// <param name="column"></param> /// <returns></returns> public int IndexOf( GLColumn column ) { return List.IndexOf( column ); }
/// <summary> /// Add Range of columns to collection /// </summary> /// <param name="columns"></param> public void AddRange( GLColumn[] columns) { lock(List.SyncRoot) { for (int i=0; i<columns.Length; i++) Add( columns[i] ); } }
/// <summary> /// Add Column to collection /// </summary> /// <param name="strColumnName"></param> /// <param name="nColumnWidth"></param> /// <param name="align"></param> public GLColumn Add( string strColumnName, int nColumnWidth, HorizontalAlignment align ) { GLColumn newColumn = new GLColumn(); newColumn.Text = strColumnName; newColumn.Name = strColumnName; newColumn.Width = nColumnWidth; newColumn.State = ColumnStates.csNone; newColumn.TextAlignment = ContentAlignment.MiddleLeft; Add( newColumn ); return newColumn; }
/// <summary> /// Add a column to collection /// </summary> /// <param name="newColumn"></param> public void Add( GLColumn newColumn ) { newColumn.Parent = Parent; //item.ChangedEvent += new BSLItem.ChangedEventHandler( BSLItem_Changed ); // listen to event changes inside the item newColumn.ChangedEvent += new ChangedEventHandler( GLColumn_Changed ); while ( GetColumnIndex( newColumn.Name ) != -1 ) newColumn.Name += "x"; // change the name till it is not the same int nIndex = List.Add( newColumn ); if ( ChangedEvent != null ) ChangedEvent( this, new ChangedEventArgs( ChangedTypes.ColumnCollectionChanged, newColumn, null, null ) ); // fire the column clicked event }
/// <summary> /// Changes in the columns, items or subitems /// </summary> /// <param name="ctType"></param> /// <param name="column"></param> /// <param name="item"></param> /// <param name="subItem"></param> public ChangedEventArgs( ChangedTypes ctType, GLColumn column, GLItem item, GLSubItem subItem ) { m_Column = column; m_Item = item; m_SubItem = subItem; m_ctType = ctType; }