A.Force A.Force - 4 months ago 51
C# Question

Control click event hit box

Is there a way to change the "hit box" of a click event in c#, caused by clicking a button or another control?

I am using custom GUI controls to control a device. These controls work as small circles both indicating current status (green or black) and as buttons that the user can click.

The problem is, i am using a touch screen on the device, and it is not so easy to click the small circles. 50% of the time you miss it and the controls click event is not raised.

I want to change this without changing the visual size of the circles, as my GUI is already limited on space. So i want an invisible clickable hit box that is just slightly larger than the control itself. Is it possible?


Thanks for the tips all! What i ended up doing was similar to both Abdul and Active92's answers.

I created a picturebox for each button, made it bigger than the button itself and placed it "behind" the button. (Right click and send to back). Since i dont add any images the pictureboxes are invisible.

In each picturebox click event handler i just fire a click event of the original control.