views:

235

answers:

1

Hey, I'm trying to draw custom ColumnHeaders in a FastObjectListView control.

So far the code works, but the ColumnHeaders free space ( so the part that does not contain any column headers atm ) still draws as default.

    private void olvMain_DrawColumnHeader(object sender, DrawListViewColumnHeaderEventArgs e)
    {
        e.Graphics.FillRectangle(Brushes.Black,
            e.Bounds.X, e.Bounds.Y,
            e.Bounds.Width, e.Bounds.Height);

        e.Graphics.DrawRectangle(Pens.Lime,
            e.Bounds.X - 1, e.Bounds.Y - 1,
            e.Bounds.Width - 1, e.Bounds.Height - 1);

        e.DrawText();

        e.DrawDefault = false;
    }

I added:

e.DrawDefault = false;

because without that the columnheaders default style got drawn on top of my custom style, but as the columnheaderbar's free space doesn't contain any columnheaders it's still drawn by it's default style.

Here's a pic to clarify what I mean by Columnheader's free space: Image Link

Thanks in advance.

A: 

The area that is not painted black is outside of the headers client area -- thus not paintable by the control.

There is no easy way to change the color of that area. Have a look at this question and its answer to see some possible solutions.

Grammarian