' 讀取 BitmapImage
Dim Imgbmp As BitmapImage = New BitmapImage()
Dim ImgBrh As ImageBrush = New ImageBrush()
Imgbmp = New BitmapImage(New Uri("\image\mobile.gif", UriKind.RelativeOrAbsolute))
Dim i As Integer
For i = 1 To 5
Dim tb As New TextBlock
Dim img As New Image
img.Source = Imgbmp
img.Name = "IMG_" & i.ToString
tb.Name = "tb_" & i.ToString
'加入textblock元件內
tb.Inlines.Add(img)
tb.Inlines.Add(New Run("想要顯示的識別名稱"))
Canvas.SetLeft(tb, 50 * i)
Canvas.SetTop(tb, 50 * i)
tb.ToolTip = "我的NAME是 " & vbCrLf & vbCrLf & tb.Name
AddHandler tb.MouseMove, AddressOf Elp_MouseMove
AddHandler tb.MouseLeftButtonDown, AddressOf Elp_MouseDown
AddHandler tb.MouseLeftButtonUp, AddressOf Elp_MouseUP
MYCS.Children.Add(tb)
Next
沒有留言:
張貼留言