views:

173

answers:

1
protected override void OnPaint(PaintEventArgs e)
{
    e.Graphics.DrawImage(render, 400, 400);
}

This is the OnPaint of the Form1 class. The form has a listbox. The problem is with the render only showing partially when doing a resize on the form. Is the listbox somehow clipping it out? The listbox and the bitmap don't overlap.

I've tried the following:

  1. Call base.OnPaint(e); before and after DrawImage();.
  2. Set the form to doublebuffer, userpaint, paint everything in WM conf, etc.
  3. Try Refresh() and Update() of the listbox with every combination I came up with, before and after DrawImage()
+1  A: 

Yes, the ListBox has its own window handle and Paint event. You cannot paint on top of the LB. Nor would you want to, normally, it will obscure whatever information is shown in the LB. Explain why you're trying to do this.

Hans Passant