24. oktober 2003 - 09:17
Der er
1 kommentar
Hente en reference til FromHbitmap
Hej,
Jeg skal bruge en pointer til et billede som ligger i DIB-format i clipboardet. Det er hentet via avicap32.dll.
Her er koden:
---------------------------
' Copy image to clipboard
SendMessage(hHwnd, WM_CAP_EDIT_COPY, 0, 0)
' place the image in a picture box
PictureBox1.Image = GetImageFromClipboard()
bitmap_ptr = ????.FromHbitmap?????
objDibImage.CopyBitmap(bitmap_ptr)
---------------------------
Håber der er nogen som kan hjælpe..... :)
24. oktober 2003 - 19:43
#1
Kan du bruge et eksempel der henter et billede fra clipboardet...!?
Option Strict On
Option Explicit On
Imports System
Imports System.Windows.Forms
Imports System.Drawing
Public Class WinApp
Inherits System.Windows.Forms.Form
Private m_PB As PictureBox
<STAThread()> _
Shared Sub Main()
Application.Run(New WinApp())
End Sub
Public Sub New()
Me.Text = "This is my form"
m_PB = New PictureBox()
m_PB.Location = New Point(0, 0)
m_PB.Size = Me.Size
m_PB.Image = GetImageFromClipboard()
If Not m_PB.Image Is Nothing Then
Me.ClientSize = New Size(m_PB.Image.Width, m_PB.Image.Height)
m_PB.Size = Me.ClientSize
End If
Me.Controls.Add(m_PB)
End Sub
Public Function GetImageFromClipboard() As Image
If Not Clipboard.GetDataObject() Is Nothing Then
Dim dobj As IDataObject = Clipboard.GetDataObject()
If dobj.GetDataPresent(DataFormats.Bitmap) Then
Dim img_obj As Object = dobj.GetData(DataFormats.Bitmap)
Return CType(img_obj, Bitmap)
End If
End If
End Function
End Class