處理方式為:先將圖片資料讀入剪貼簿中,然後再將它貼上 RichTextBox 控制項中。

With RichTextBox1
    .Text = "你好!" & Environment.NewLine
    Dim myImage As Image = Image.FromFile(Application.StartupPath + "\myImg.jpg")
    Dim ido As IDataObject = New DataObject
    ido.SetData(myImage)
    '將圖片資料放到系統剪貼簿上(True 表示應用程式結束後,資料繼續保留在剪貼簿上)
    Clipboard.SetDataObject(ido, True)
    .SelectionStart = .Text.Length
    .Paste()
    .AppendText(Environment.NewLine & "再見囉~")
End With
arrow
arrow
    全站熱搜

    tsuozoe 發表在 痞客邦 留言(0) 人氣()