Notifications
Clear all

[Closed] borderless dotnet button

Anyone know how to make a dotnet button borderless…also, is there a way to make it transparent without hiding it…thnx

7 Replies
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

does your button with no board need more functionality than a label has?
also you can use a flat style button with ZERO border size (flat style appearance)
what do mean by “transparent”? are you talking about the transparent backcolor?

 lo1

Quick and dirty but you get the point…

dnfm = dotnetobject "form"
dnfm.backColor = dnfm.backColor.red
dnbtn = dotnetobject "button"
dnbtn.flatstyle = dnbtn.flatstyle.flat
dnbtn.flatappearance.borderSize = 0

dnbtn.flatappearance.CheckedBackColor = dnbtn.backColor.Transparent
dnbtn.flatappearance.MouseDownBackColor = dnbtn.backColor.Transparent
dnbtn.flatappearance.MouseOverBackColor = dnbtn.backColor.Transparent

dotnet.addEventHandler dnbtn "MouseDown" (fn mdown = print "mousedown")

dnfm.controls.add dnbtn

dnfm.show()

thnx Io, denis. I guess a label would serve but I want the user to click on part of the background graphic of a form and set off an event, so hence the transparent button with an event handler but I guess if i used a label and used the graphic as background image it might work as well…however the transparent borderless button seems much less work

 lo1

You don’t need any control for this, just set a handler on the form itself.

But I want to confine event handler to an area of the graphic…am I missing something obvious again?

 lo1

Yes, just check within the event handler if the mouse is within the desired rectangle or not.

oh right of course thnx Io. I think I know that mouse location code…anyway I’ll dig it up, I think ive used it in my material browser set up somewhere…