views:

402

answers:

0

Platform: Windows Mobile 6 Classic / .NET CF 3.5

Problem: Custom Controls, that display alphablended images do not behave well with images on Parent control. Also, hidding and show such controls induces flicker when parent has many images to redraw.

More Details: A custom button Control that displays an image with transparencies. I use Alphablend function to achieve this with limited success. The parent is also a custom control and has a dimension of 320x240. This parent control also displays a background image. Both parent and child controls, are shown at same time. However, the custom button control can be hidden and shown.

The problem with showing and hiding child button is it's artifact it flickers. In an attempt to reduce flicker the standard code is implemented in both child and parent custom controls;


  protected virtual void OnPaintBackground(PaintEventArgs e) {
      /* override prevents fliciker */ 
  }
The effect of which are minimal at best. I need a way that Button control can erase itself without invoking repaint of parent. The BitBlt function, see URL: msdn.microsoft.com/en-us/library/aa930997.aspx, could work but experimentation showed that since Custom Button inherits from System.Windows.Forms.Controls the parent and child draw regions are treated as separate entities. Thus, draw region of Button will clobbers, not blended into, draw region of parent.

My Question: How to blend images in the draw regions of one or more child controin, that must respond indendently to mouse events, with images in draw region of parent control?


See example images and sample screenshot at: Images

related questions