Notifications
Clear all
[Closed] dotnet label with gradient
Jun 22, 2015 4:32 pm
How can I create a dotnet label with a horizontal gradient?
try(destroydialog ::rlLabel)catch()
rollout rlLabel "Listview"
(
dotNetControl uiColors "Label" width:130 height:20 pos:[10,10]
fn StyleLabel ctrl: =
(
dnColor = (dotnetclass "System.Drawing.Color")
brush = dotnetobject "System.Drawing.Drawing2D.LinearGradientBrush" ctrl.Bounds dnColor.LightBlue dnColor.DarkBlue \
(dotnetclass "System.Drawing.Drawing2D.LinearGradientMode").Horizontal
--ctrl.Graphics.FillRectangle brush ctrl.Bounds
ctrl.backcolor = (dotnetclass "System.Drawing.Color").Red
)
on rlLabel open do
(
StyleLabel ctrl:uiColors
showmethods uiColors
)
)
createDialog rlLabel 150 40
1 Reply
Jun 22, 2015 4:32 pm
Here’s a simple example
try(destroydialog ::rlLabel)catch()
rollout rlLabel "Listview"
(
dotNetControl uiColors "Label" width:130 height:20 pos:[10,10]
local brush
on rlLabel open do
(
local dnColor = (dotnetclass "System.Drawing.Color")
brush = dotnetobject "System.Drawing.Drawing2D.LinearGradientBrush" uiColors.Bounds dnColor.LightBlue dnColor.DarkBlue \
(dotnetclass "System.Drawing.Drawing2D.LinearGradientMode").Horizontal
)
on uiColors paint s e do
(
if (brush != undefined) do
(
e.graphics.fillRectangle brush uiColors.bounds
)
)
)
createDialog rlLabel 150 40