ghayour
چهارشنبه 09 اسفند 1391, 19:25 عصر
با سلام خدمت دوستان
چطور باید خطای این کد رو برطرف کنم؟(مربوط میشه به ساعت آنالوگ در آموزش blend توسط آقای فرزاد)
Imports System
Imports System.Collections.Generic
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Animation
Imports System.Windows.Media.Imaging
Imports System.Windows.Navigation
Imports System.Windows.Shapes
Partial Public Class Clock_Analog_
Public Sub New()
MyBase.New()
Me.InitializeComponent()
Dim tmr As System.Windows.Threading.DispatcherTimer = New System.Windows.Threading.DispatcherTimer
tmr.Interval = New TimeSpan(0, 0, 0, 1)
AddHandler tmr.Tick, AddressOf Timer_Tick
tmr.IsEnabled = True
' Insert code required on object creation below this point.
End Sub
Sub Timer_Tick(sender As Object, e As EventArgs)
Dim HourRotateValue As Double = DateAndTime.Now.Hour
Dim MinuteRotateValue As Double = DateAndTime.Now.Minute
Dim SecondRotateValue As Double = DateAndTime.Now.Second
HourRotateValue = (HourRotateValue - 4 + MinuteRotateValue / 60) * 30
MinuteRotateValue = (MinuteRotateValue + SecondRotateValue / 60) * 6
SecondRotateValue = SecondRotateValue * 6
Hr = HourRotateValue
Min = MinuteRotateValue
Sec = SecondRotateValue
End Sub
End Class
از این سه خط خطا میگیره:
Hr = HourRotateValue
Min = MinuteRotateValue
Sec = SecondRotateValue
میگه:
Value of type 'Double' cannot be converted to 'System.Windows.Media.Transform'.
چطور باید خطای این کد رو برطرف کنم؟(مربوط میشه به ساعت آنالوگ در آموزش blend توسط آقای فرزاد)
Imports System
Imports System.Collections.Generic
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Animation
Imports System.Windows.Media.Imaging
Imports System.Windows.Navigation
Imports System.Windows.Shapes
Partial Public Class Clock_Analog_
Public Sub New()
MyBase.New()
Me.InitializeComponent()
Dim tmr As System.Windows.Threading.DispatcherTimer = New System.Windows.Threading.DispatcherTimer
tmr.Interval = New TimeSpan(0, 0, 0, 1)
AddHandler tmr.Tick, AddressOf Timer_Tick
tmr.IsEnabled = True
' Insert code required on object creation below this point.
End Sub
Sub Timer_Tick(sender As Object, e As EventArgs)
Dim HourRotateValue As Double = DateAndTime.Now.Hour
Dim MinuteRotateValue As Double = DateAndTime.Now.Minute
Dim SecondRotateValue As Double = DateAndTime.Now.Second
HourRotateValue = (HourRotateValue - 4 + MinuteRotateValue / 60) * 30
MinuteRotateValue = (MinuteRotateValue + SecondRotateValue / 60) * 6
SecondRotateValue = SecondRotateValue * 6
Hr = HourRotateValue
Min = MinuteRotateValue
Sec = SecondRotateValue
End Sub
End Class
از این سه خط خطا میگیره:
Hr = HourRotateValue
Min = MinuteRotateValue
Sec = SecondRotateValue
میگه:
Value of type 'Double' cannot be converted to 'System.Windows.Media.Transform'.