0

I have created my own graphics component based on TcustomControl.

The control first draws a border area were textual information is drawn, it then sets a rectangular clipregion some percentage in from the full width and height of the control where graphics are then drawn.

The clip region is defined so that the drawn graphics do not encroach onto the border area and corrupt the text information.

At the end of the paint process, the clip region is deleted using

selectcliprgn(handle,0);
DeleteObject(HClip);

This all works hunky-dory, the problem is, that when I assign a context menu to the control (selected when the right mouse button is pressed), the menu only appears when the cursor is inside the region that was clipped. When I right click on the border area, the components parent controls context is menu is shown instead.

Any ideas why the clip region affects which context menu is displayed and how to stop it happening ?

Andy k
  • 1,056
  • 1
  • 11
  • 22
  • 3
    Clipping regions are not related with mouse messages, some other code should be causing this. BTW, you can delete a region as soon as you've selected it into a device context, the DC uses a copy. – Sertac Akyuz Nov 30 '12 at 14:09
  • Yeah, your right. It looked like it was related to the clip region but in the end I found the answer and it was a coding issue. Thanks anyway, your answer caused me to start looking in the right place. – Andy k Dec 01 '12 at 19:55

0 Answers0