[Closed] dotnet button hilighting
I’m wanting to have a dot net button do something when I click or hover over it. I tried the following:
myButton.flatappearance.MouseDownBackColor = (dotnetClass “systen.drawing.color”).blue,
and also
myButton.flatapearance.CheckedBackColor = red etc,
but they don’t seem to do anything,
DO I need an event handler on it, or can I use
On MyButton Hover do (fn = etc),?
(this doesn’t seem to work either )
if you use the flat button style everything is under the flat style appearance. it’s all about a property setting, and it’s not need any event handling.
Thnx Denis. So what should the property setting be? Sorry to be so thick.
try(form.close()) catch()
(
global form = dotnetobject "Form"
form.Text = "Flat Buttons"
form.ShowInTaskbar = off
form.AutoSize = on
form.AutoSizeMode = form.AutoSizeMode.GrowAndShrink
form.controls.add \
(
local bt = dotnetobject "button"
bt.Text = "Default"
bt.Bounds = dotnetobject "System.Drawing.Rectangle" 2 2 100 24
bt.Backcolor = bt.Backcolor.Orange
bt.FlatStyle = bt.FlatStyle.Flat
bt
)
form.controls.add \
(
local bt = dotnetobject "button"
bt.Text = "Custom"
bt.Bounds = dotnetobject "System.Drawing.Rectangle" 104 2 100 24
bt.Backcolor = bt.Backcolor.Orange
bt.FlatStyle = bt.FlatStyle.Flat
bt.FlatAppearance.MouseDownBackColor = bt.Backcolor.Red
bt.FlatAppearance.MouseOverBackColor = bt.Backcolor.Yellow
bt
)
MaxHandleWrapper = dotnetobject "MaxCustomControls.Win32HandleWrapper" (dotnetobject "System.IntPtr" (windows.getmaxhwnd()))
form.Show MaxHandleWrapper
ok
)
see Button.FlatAppearance properties for more details
Thnx Denis, but I realize now what was happening. I have a button but it has a graphic given by
bt.BackgroundImage = Bitmap.bmp (say);
and I’ve been trying to get the background to change using properties such as flatappearance, hoping it would flash a different background color or something but of course this isn’t going to affect the graphic at all.
Maybe What I need is an on bt MouseClick do () event, where the event triggers maybe a swap out of the graphic or something of that nature or changing background of a seperate label…
I have tried the on bt Mouseclick event do command but it always throws an error of one sort sort, usuall ‘expected while’ or ‘call needs function or class, got :true’
What I need is a sample fragment of code which shows it working.
I guess what I don’t unerstand is when to use the inbuilt on bt click event and when to use the eventhandler command…which is faster, which is the standard in this situation?
Thank you again for your time.