暫時無解
DD.Source = Imgbmp '為何此行取消,就會有問題?
DD是一個既有的標籤物件。程式碼若不加上這一行,就會出現[找不到關於此像素格式的資訊]
Sub GenTelphone()
'讀取 BitmapImage
Dim Imgbmp As BitmapImage = New BitmapImage()
Dim ImgBrh As ImageBrush = New ImageBrush()
Imgbmp = New BitmapImage(New Uri("\image\mobile.gif", UriKind.RelativeOrAbsolute))
DD.Source = Imgbmp '為何此行取消,就會有問題?
Dim i As Integer
For i = 1 To 9
Dim Tb As New TextBlock
Dim img As New Image
img.Source = Imgbmp
img.Name = "Img" & i.ToString
Tb.Name = "Tbk" & i.ToString
Tb.TextAlignment = TextAlignment.Center '字型置中
Tb.Inlines.Add(img)
'在第一個段落後 增加 段落字元
Tb.Inlines.InsertAfter(Tb.Inlines.FirstInline, New LineBreak)
Tb.Inlines.Add(New Run("顯示資訊" & i.ToString))
Canvas.SetLeft(Tb, 50 * i)
Canvas.SetTop(Tb, 50 * i)
Canvas.SetZIndex(Tb, 25) '數字愈大,愈上層
Canvas.SetZIndex(Ln, 20)
'Canvas.SetLeft(img, 50 * i)
'Canvas.SetTop(img, 50 * i)
Tb.ToolTip = "我的NAME是 " & vbCrLf & vbCrLf & Tb.Name
MYCS.Children.Add(Tb)
Next
End Sub
沒有留言:
張貼留言