コード例 #1
0
		private void DrawColumnHeaders(Graphics gr)
		{
			PerformanceAnalyzer.Start("DrawColumnHeaders");
			ReorderColumnState reorder = Input as ReorderColumnState;
			int x = 0;
			TreeColumn.DrawBackground(gr, new Rectangle(0, 0, ClientRectangle.Width + 2, ColumnHeaderHeight - 1), false, false);
			gr.TranslateTransform(-OffsetX, 0);
			foreach (TreeColumn c in Columns)
			{
				if (c.IsVisible)
				{
					if (x >= OffsetX && x - OffsetX < this.Bounds.Width)// skip invisible columns
					{
						Rectangle rect = new Rectangle(x, 0, c.Width, ColumnHeaderHeight - 1);
						gr.SetClip(rect);
						bool pressed = ((Input is ClickColumnState || reorder != null) && ((Input as ColumnState).Column == c));
						c.Draw(gr, rect, Font, pressed, _hotColumn == c);
						gr.ResetClip();

						if (reorder != null && reorder.DropColumn == c)
							TreeColumn.DrawDropMark(gr, rect);
					}
					x += c.Width;
				}
			}

			if (reorder != null)
			{
				if (reorder.DropColumn == null)
					TreeColumn.DrawDropMark(gr, new Rectangle(x, 0, 0, ColumnHeaderHeight));
				gr.DrawImage(reorder.GhostImage, new Point(reorder.Location.X +  + reorder.DragOffset, reorder.Location.Y));
			}
			PerformanceAnalyzer.Finish("DrawColumnHeaders");
		}
コード例 #2
0
        private void DrawColumnHeaders(Graphics gr)
        {
            ReorderColumnState reorder = this.Input as ReorderColumnState;

            int x = 0;

            TreeColumn.DrawBackground(gr, new Rectangle(0, 0, ClientRectangle.Width + 2, this.ColumnHeaderHeight - 1), false, false);

            gr.TranslateTransform(-OffsetX, 0);

            foreach (TreeColumn c in this.Columns)
            {
                if (!c.IsVisible)
                {
                    continue;
                }

                if (x + c.Width >= this.OffsetX && x - this.OffsetX < this.Bounds.Width)            // skip invisible columns (fixed by wj32)
                {
                    Rectangle rect = new Rectangle(x, 0, c.Width, this.ColumnHeaderHeight - 1);

                    gr.SetClip(rect);

                    bool pressed = ((this.Input is ClickColumnState || reorder != null) && ((this.Input as ColumnState).Column == c));

                    c.Draw(gr, rect, this.Font, pressed, this._hotColumn == c);

                    gr.ResetClip();

                    if (reorder != null && reorder.DropColumn == c)
                    {
                        TreeColumn.DrawDropMark(gr, rect);
                    }
                }
                x += c.Width;
            }

            if (reorder != null)
            {
                if (reorder.DropColumn == null)
                {
                    TreeColumn.DrawDropMark(gr, new Rectangle(x, 0, 0, this.ColumnHeaderHeight));
                }

                gr.DrawImage(reorder.GhostImage, new Point(reorder.Location.X +  +reorder.DragOffset, reorder.Location.Y));
            }
        }
コード例 #3
0
        private void DrawColumnHeaders(Graphics gr)
        {
            ReorderColumnState reorder = Input as ReorderColumnState;

            int x = 0;

            TreeColumn.DrawBackground(gr, new Rectangle(0, 0, ClientRectangle.Width + 10, ColumnHeaderHeight), false, false);
            gr.TranslateTransform(-OffsetX, 0);

            foreach (TreeColumn c in Columns)
            {
                if (c.IsVisible)
                {
                    Rectangle rect    = new Rectangle(x, 0, c.Width, ColumnHeaderHeight);
                    bool      pressed = HeaderStyle == ColumnHeaderStyle.Clickable && ((Input is ClickColumnState || reorder != null) && ((Input as ColumnState).Column == c));
                    bool      hot     = HeaderStyle == ColumnHeaderStyle.Clickable && _hotColumn == c;
                    c.Draw(gr, rect, Font, pressed, hot);

                    if (reorder != null && reorder.DropColumn == c)
                    {
                        TreeColumn.DrawDropMark(gr, rect);
                    }

                    x += c.Width;
                }
            }

            if (reorder != null)
            {
                if (reorder.DropColumn == null)
                {
                    TreeColumn.DrawDropMark(gr, new Rectangle(x, 0, 0, ColumnHeaderHeight));
                }
                gr.DrawImage(reorder.GhostImage, reorder.Location);
            }
        }