Closed dynamicboy closed 1 month ago
When I changed the event system, I prevented the text block that shows the title of labels and buttons from receiving mouse clicks, and this is the cause of none responding label when its back color is none. I will roll back this change to fix the issue. Regarding the button back color under mouse, this is because wpf buttons use a hover style. Changing this behavior needs to change the button template: https://stackoverflow.com/questions/17259280/how-do-you-change-background-for-a-button-mouseover-in-wpf
You can apply this by using the Control.SetStyle method. See info about at the book, and try the templates from the above link. There is a sample named custom styles in the sVB samples folder. I opened this back door to encourage developers to learn about Xaml. I have no intention currently to change the button behavior directly in sVB.
From: dynamicboy @.> Sent: Friday, January 5, 2024 10:59:18 AM To: VBAndCs/sVB-Small-Visual-Basic @.> Cc: Subscribed @.***> Subject: [VBAndCs/sVB-Small-Visual-Basic] Colors.None and Colors.Transparent could be weired sometime. (Issue #44)
Version: 2.8.8 Details: Step1: Drag a label and a button onto the form Step2: In order to see their region, give them a visible solid border color, bigger fontsize (16) and bold fontstyle. Step3: In form code editor, input some codes as below:
'Form1.BackColor = Colors.Transparent
'Label1.BackColor = Colors.Transparent 'Button1.BackColor = Colors.Transparent
Label1.BackColor = Colors.None Button1.BackColor = Colors.None
'------------------------------------------------ Sub Form1_OnClick() TW.WriteLine("You just clicked the form") EndSub
'------------------------------------------------ Sub Label1_OnClick() TW.WriteLine("You just clicked the label") EndSub
'------------------------------------------------ Sub Button1_OnClick() TW.WriteLine("You just clicked the button") EndSub
Step3: Run the form Result:
if change the code to:
'Form1.BackColor = Colors.Transparent
Label1.BackColor = Colors.Transparent Button1.BackColor = Colors.Transparent
'Label1.BackColor = Colors.None 'Button1.BackColor = Colors.None
'------------------------------------------------ Sub Form1_OnClick() TW.WriteLine("You just clicked the form") EndSub
'------------------------------------------------ Sub Label1_OnClick() TW.WriteLine("You just clicked the label") EndSub
'------------------------------------------------ Sub Button1_OnClick() TW.WriteLine("You just clicked the button") EndSub
it's OK, according to the Colors.Transparent description(see through, clickable)
Weired thing happpens when I turn the form background transparent: Code:
Form1.BackColor = Colors.Transparent
Label1.BackColor = Colors.Transparent Button1.BackColor = Colors.Transparent
'Label1.BackColor = Colors.None 'Button1.BackColor = Colors.None
'------------------------------------------------ Sub Form1_OnClick() TW.WriteLine("You just clicked the form") EndSub
'------------------------------------------------ Sub Label1_OnClick() TW.WriteLine("You just clicked the label") EndSub
'------------------------------------------------ Sub Button1_OnClick() TW.WriteLine("You just clicked the button") EndSub
Result:
— Reply to this email directly, view it on GitHubhttps://github.com/VBAndCs/sVB-Small-Visual-Basic/issues/44, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALQ5MVW76LLTCXU6JHN4B3LYM66GNAVCNFSM6AAAAABBODV66OVHI2DSMVQWIX3LMV43ASLTON2WKOZSGA3DMOJWHAZDGMA. You are receiving this because you are subscribed to this thread.Message ID: @.***>
Version: 2.8.8 Details: Step1: Drag a label and a button onto the form Step2: In order to see their region, give them a visible solid border color, bigger fontsize (16) and bold fontstyle. Step3: In form code editor, input some codes as below:
Step3: Run the form Result:
if change the code to:
it's OK, according to the Colors.Transparent description(see through, clickable)
Weired thing happpens when I turn the form background transparent: Code:
Result: