2010年6月4日 星期五

WPF 刪除物件

'找出選取物件
If Canvas_Draw.FindName("Rec" + RecRec(0).ToString()) IsNot Nothing Then
Canvas_Draw.Children.RemoveAt(RecRec(0))
AllNo = AllNo - 1
End If
If Canvas_Draw.FindName("Rec" + RecRec(1).ToString()) IsNot Nothing Then
Canvas_Draw.Children.RemoveAt(RecRec(1) - 1)
AllNo = AllNo - 1
End If


'刪除選取的元件
Dim Rs As MessageBoxResult
Rs = MessageBox.Show("確定要刪除" + SelNm + "嗎?", "刪除元件", MessageBoxButton.OKCancel)
If Rs.ToString() = "OK" Then
Canvas_Draw.Children.RemoveAt(SelNo)
End If
Bdel = False

沒有留言:

張貼留言

追蹤者