Click here to Skip to main content
15,916,030 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi there,

I want to use 3 pictures (3 trapeze pic one) toward each other that fix to each other (pic two) in c#. I solved the transparency problem (with panel I learned from this site ;P ) but clicking area is not correct. When I click on above picture(transparent area of it) it shows action of above picture not the one under it that I can see! How can I solve it? :sigh: :sigh:
If I can solve it easier with wpf project, thats good too :thumbsup:
pic one:
http://i.picasion.com/pic36/de3eb96dd9cf35d5a8df0b00269888b3.gif

pic two:
http://i.picasion.com/pic36/05f6bd6c2d044624f5fea786e79cbace.gif
Posted
Updated 23-Dec-10 6:43am
v2
Comments
Sergey Alexandrovich Kryukov 23-Dec-10 13:18pm    
Is it System.Windows.Forms or WPF? (this problem is solved for both)

1 solution

This is not about transparency. Whole control can be done non-rectangular.
Use control's property System.Drawing.Region Region.

Region is a drawing object which can be constructed out of GraphicPath.

C#
myControl.Region = new Region(myNonRectangularPath);
//from this moment, your control is re-shaped
//of cource, the region should be within Bounds,
//if not, you will get intersection of those


Of course, control's clickable area will be its region.

Also, regions can be combined using set theory operations: Union, Intersect, etc. to produce shapes of arbitrary complexity (all from native GDI).

This way people make any controls non-rectangular including forms/windows (look at those audio players).

WPF provides similar features.
 
Share this answer
 
v3
Comments
Sergey Alexandrovich Kryukov 23-Dec-10 23:43pm    
What's wrong?! It works perfectly.
Espen Harlinn 26-Feb-11 11:08am    
Good reply - a 5
Sergey Alexandrovich Kryukov 26-Feb-11 19:24pm    
Than you, Espen.
This Answer was badly down-voted; even though the feature is very important and works well.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900