Bug 20233 - Control.Region doesn't change the window shape
Summary: Control.Region doesn't change the window shape
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: Windows.Forms ()
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: Community
Assignee: Bugzilla
Depends on:
Reported: 2014-05-31 00:41 UTC by contact
Modified: 2017-09-01 11:55 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

How Control.Region works on Windows (1.41 KB, image/png)
2014-05-31 00:41 UTC, contact
How it works on Linux (2.20 KB, image/png)
2014-05-31 00:42 UTC, contact

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 20233 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description contact 2014-05-31 00:41:27 UTC
Created attachment 6932 [details]
How Control.Region works on Windows

Control.Region adjusts where the control draws itself, but doesn't change the shape of the control itself. e.g.:
Label lb1 = new Label();
lb1.Region = new System.Drawing.Region(new System.Drawing.Rectangle(0, 0, 15, 7));

On Windows / .Net it only displays the part of the label inside the region. The parts of the label clipped by the region are not drawn at all, do not obscure other controls, nor affect said other controls' interaction with the mouse pointer. See the attached example Control.Region Windows.

On Linux it only displays the label's background colour and text inside the region, but the entire border and the parent's background colour are still drawn, and those parts obscure any other controls that it is in front of. See the attached example Control.Region Linux.

I think one fix would be to use the "X Nonrectangular Window Shape Extension Library" (http://www.x.org/releases/current/doc/libXext/shapelib.html) in XplatUIX11.cs.
Comment 1 contact 2014-05-31 00:42:17 UTC
Created attachment 6933 [details]
How it works on Linux