публичный класс BotaoEmergencia
Private pressedcolorvermelho As SolidColorBrush = "#d73f3e".ToBrush()
Private pressedfundoamarelo As SolidColorBrush = DirectCast(New BrushConverter().ConvertFrom("#FFF500"), SolidColorBrush)
Private pressedDisabledColor As SolidColorBrush = DirectCast(New BrushConverter().ConvertFrom("#DA251D"), SolidColorBrush)
Private pressedcontornolinhas As SolidColorBrush = DirectCast(New BrushConverter().ConvertFrom("#da251d"), SolidColorBrush)
Public Shared ReadOnly IsPressedProperty As DependencyProperty = DependencyProperty.Register("IsPressed", GetType(Boolean), GetType(BotaoEmergencia), New PropertyMetadata(False, AddressOf OnIsPressedChanged))
Public Property IsPressed() As Boolean
Get
Return DirectCast(GetValue(IsPressedProperty), Boolean)
End Get
Set(value As Boolean)
SetValue(IsPressedProperty, value)
End Set
End Property
Public Shared Sub OnIsPressedChanged(source As DependencyObject, e As DependencyPropertyChangedEventArgs)
Dim botao As BotaoEmergencia = TryCast(source, BotaoEmergencia)
botao.ActualizarDesenho()
End Sub
Private Sub UserControl_IsEnabledChanged(sender As Object, e As DependencyPropertyChangedEventArgs) Handles Me.IsEnabledChanged
ActualizarDesenho()
End Sub
Protected Sub ActualizarDesenho()
If IsEnabled Then
If IsPressed Then
Canvas.SetTop(elpCamadaVermelha1, 9.45)
Canvas.SetLeft(elpCamadaVermelha1, -20)
Canvas.SetTop(elpCamadaVermelha2, -122)
Canvas.SetLeft(elpCamadaVermelha2, -61)
Canvas.SetTop(elpContornoBotao, 16.8)
Canvas.SetLeft(elpContornoBotao, 78)
elpContornoBotao.Width = 52
elpContornoBotao.Height = 52
elpContornoBotao.Stroke = If(IsEnabled, pressedcontornolinhas, pressedcontornolinhas)
elpCamadaVermelha1.Fill = If(IsEnabled, pressedcolorvermelho, pressedcolorvermelho)
elpCamadaVermelha2.Stroke = If(IsEnabled, pressedcontornolinhas, pressedcontornolinhas)
elpCamadaVermelha2.StrokeThickness = 0.8
elpFundoAmarelo.Fill = If(IsEnabled, pressedfundoamarelo, pressedfundoamarelo)
Здравствуйте, ребята, я делаю несколько кнопок для программного обеспечения, которое я работаю, и мне нужно дать немного трехмерного видения, поэтому я хочу использовать градиент.
Это мой код для solidcolorbrush, я хочу сделать Gradientcolorbrush, но я не знаю, как мне сделать это отсюда ...
Можете ли вы, ребята, помочь?