Menu

#16 Painting does not occur for a column when horizontal scroll

open
nobody
None
5
2008-03-20
2008-03-20
Anonymous
No

Painting does not occur for a column when horizontal scrolling causes the beginning of the column to be occluded.

TreeViewAdv, UseColumns, 2 columns of initial width 100 but TreeViewAdv width is only 150.

When I scroll over to see the full 2nd column, the 1st column completely stops drawing. It should still draw the half that is showing.

alexhuang atly gorilla dotly com dotly tw

Discussion

  • Nobody/Anonymous

    Logged In: NO

    The problem occurs with at least NodeTextBox and NodePlusMinus. I have not tested other types of NodeControls.

     
  • Nobody/Anonymous

    Logged In: NO

    This is my fix I implemented in TreeViewAdv.Draw in the DrawNode(TreeNodeAdv node, DrawContext context) method. (line 188.)

    Replace :
    if (item.Bounds.X >= OffsetX && item.Bounds.X - OffsetX < this.Bounds.Width)
    With :
    if(item.Bounds.Right >= OffsetX)

    - Mark Bollman.

     
  • Nobody/Anonymous

    Logged In: NO

    TreeViewAdv.Draw.cs

    if (x + c.Width >= OffsetX && x <= OffsetX + this.Bounds.Width)// skip invisible columns
    ...
    if (item.Bounds.Right >= OffsetX && item.Bounds.Left <= OffsetX + this.Bounds.Width)// skip invisible nodes

    That would be more correct (imho :) )

     
  • Nobody/Anonymous

    In TreeViewAdvDraw.cs:

    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 + c.Width >= 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;
    }
    }
    and:

    public void DrawNode(TreeNodeAdv node, DrawContext context)
    {
    foreach (NodeControlInfo item in GetNodeControls(node))
    {
    if (item.Bounds.X + item.Bounds.Width >= OffsetX && item.Bounds.X - OffsetX < this.Bounds.Width)// skip invisible nodes
    {
    context.Bounds = item.Bounds;
    context.Graphics.SetClip(context.Bounds);
    item.Control.Draw(node, context);
    context.Graphics.ResetClip();
    }
    }
    }

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.