Notifications
Clear all

[Closed] Non rectangular buttons in dotNet

Hi guys,

I have finally reached a point after learning and creating Ui’s in dotNet for the past year and a bit where I want/need to have a button that is not rectangular. I have been trying to find resources or examples of such a thing but it appears it does not exist or no one has tried to do it in max.dotNet yet.

I would appreciate any suggestions, links or ideas.
So far all I have found is:

http://msdn.microsoft.com/en-us/library/ms229655.aspx

which quite honestly confuses the sh!t out of me…

Cheers in advance.

Shea.

4 Replies
 lo1

The key to real non-rectangular controls (as opposed to rectangular controls with transparency masks) is the Region class.

Here is a code snippet to get you started:

dnFm = dotNetObject "Form"
dnFm.Width = dnFm.Height = 150

lab = dotNetObject "Label"
lab.Text = "I'm a Circle"
lab.TextAlign = lab.TextAlign.MiddleCenter
lab.BackColor = lab.BackColor.Red
lab.bounds = dotNetObject "System.Drawing.Rectangle" 20 10 100 100

gfxPath = dotNetObject "System.Drawing.Drawing2D.GraphicsPath"
gfxPath.addEllipse 0 0 100 100
lab.region = dotNetObject "System.Drawing.Region" gfxPath

dnFm.Controls.Add lab

fn labClicked s e = print "Label Clicked"
dotNet.AddEventHandler lab "Click" labClicked --proves only circle is live area

dnFm.Show()

You are a hero lo,

I looked into the region class many months back but gave up as I was still fairly new to dotNet.

I will give this a play around and post my results.

Thanks again!

 MZ1

I think WPF has something especially for this.

I’d say WPF is the way to go, thx to routed events and the <Polygon > you can have a lot of fun