Hot News:

Unser Angebot:

  Foren auf CAD.de
  VBasic / vb.net / vbs / wsh
   Inhalt einer PICTUREBOX ins Clipboard

Antwort erstellen  Neues Thema erstellen
CAD.de Login | Logout | Profil | Profil bearbeiten | Registrieren | Voreinstellungen | Hilfe | Suchen

Anzeige:

Darstellung des Themas zum Ausdrucken. Bitte dann die Druckfunktion des Browsers verwenden. | Suche nach Beiträgen nächster neuer Beitrag | nächster älterer Beitrag
  
Online-Kurs: Grundlagen des 3D-Druck-Designs für Industrieingenieure , ein Kurs
Autor Thema:  Inhalt einer PICTUREBOX ins Clipboard (1194 mal gelesen)
Frank_Schalla
Ehrenmitglied
CAD_SYSTEMBETREUER


Sehen Sie sich das Profil von Frank_Schalla an!   Senden Sie eine Private Message an Frank_Schalla  Schreiben Sie einen Gästebucheintrag für Frank_Schalla

Beiträge: 1732
Registriert: 06.04.2002

DELL M6800
Cad Admin
Methodikentwickler 3D

erstellt am: 05. Mrz. 2004 09:26    Editieren oder löschen Sie diesen Beitrag!  <-- editieren / zitieren -->   Antwort mit Zitat in Fett Antwort mit kursivem Zitat    Unities abgeben: 1 Unity (wenig hilfreich, aber dennoch)2 Unities3 Unities4 Unities5 Unities6 Unities7 Unities8 Unities9 Unities10 Unities

Guten Morgen
anbei mein Problem.
Ich möchte den Inhalt einer PictureBox (Inventor Methode
ClientView - also kein Text oder Bitmap) in die Zwischenablage kopieren.
Bei Text usw klappt dies.
Habe folgende beiden Methoden benutzt.
Clipboard.SetData Screen.ActiveControl.Picture

Alternativ
CopyEntirePicture picTest
Bringt nur ein leeres Feld ins Clipboard.

Anbei das Modul welches hinter CopyEntirePicture liegt.
*********************************************************
' General functions:
Private Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
End Type

' GDI functions:
Private Declare Function BitBlt Lib "gdi32" _
  (ByVal hDestDC As Long, _
    ByVal x As Long, ByVal y As Long, _
    ByVal nWidth As Long, ByVal nHeight As Long, _
    ByVal hSrcDC As Long, _
    ByVal xSrc As Long, ByVal ySrc As Long, _
    ByVal dwRop As Long) As Long
Private Const SRCCOPY = &HCC0020 ' (DWORD) dest = source
' Creates a memory DC
Declare Function CreateCompatibleDC Lib "gdi32" _
  (ByVal hDC As Long) As Long
' Creates a bitmap in memory:
Declare Function CreateCompatibleBitmap Lib "gdi32" _
  (ByVal hDC As Long, _
  ByVal nWidth As Long, ByVal nHeight As Long) As Long
' Places a GDI Object into DC, returning the previous one:
Declare Function SelectObject Lib "gdi32" _
  (ByVal hDC As Long, ByVal hObject As Long) As Long
' Deletes a GDI Object:
Declare Function DeleteObject Lib "gdi32" _
  (ByVal hObject As Long) As Long

' Clipboard functions:
Private Declare Function OpenClipboard Lib "USER32" _
  (ByVal hWnd As Long) As Long
Private Declare Function CloseClipboard Lib "USER32" () As Long
Private Declare Function SetClipboardData Lib "USER32" _
  (ByVal wFormat As Long, ByVal hMem As Long) As Long
Private Declare Function EmptyClipboard Lib "USER32" () As Long
Private Const CF_BITMAP = 2

Public Function CopyEntirePicture(ByRef objFrom As Object) As Boolean
Dim lhDC As Long
Dim lhBMP As Long
Dim lhBMPOld As Long
Dim lWidthPixels As Long
Dim lHeightPixels As Long

    ' Create a DC compatible with the object we're copying
    ' from:
    lhDC = CreateCompatibleDC(objFrom.hDC)
    If (lhDC <> 0) Then
        ' Create a bitmap compatible with the object we're
        ' copying from:
        lWidthPixels = objFrom.ScaleX( _
                          objFrom.ScaleWidth, _
                          objFrom.ScaleMode, _
                          vbPixels)
        lHeightPixels = objFrom.ScaleY( _
                          objFrom.ScaleHeight, _
                          objFrom.ScaleMode, _
                          vbPixels)
        lhBMP = CreateCompatibleBitmap(objFrom.hDC, _
                  lWidthPixels, lHeightPixels)
        If (lhBMP <> 0) Then
            ' Select the bitmap into the DC we have created,
            ' and store the old bitmap that was there:
            lhBMPOld = SelectObject(lhDC, lhBMP)
           
            ' Copy the contents of objFrom to the bitmap:
            BitBlt lhDC, 0, 0, lWidthPixels, lHeightPixels, _
                objFrom.hDC, 0, 0, SRCCOPY
           
            ' Remove the bitmap from the DC:
            SelectObject lhDC, lhBMPOld
                       
            ' Now set the clipboard to the bitmap:
            OpenClipboard 0
            EmptyClipboard
            SetClipboardData CF_BITMAP, lhBMP
            CloseClipboard

            ' We don't delete the Bitmap here - it is now owned
            ' by the clipboard and Windows will delete it for us
            ' when the clipboard changes or the program exits.
        End If
       
        ' Clear up the device context we created:
        DeleteObject lhDC
    End If
End Function
******************************************************************
Ich weiss das dieses wieder mal ein VB Problem ist, aber ich hoffe mal : daywa1k3r PaulSchuepbach und Konsorten
sind schon wach.

------------------
Es gab mal Zeiten, da haben wir und gefreut im 2D Ansichten gemalt  zu haben.

Lasst uns dies nicht vergessen wenn wir Ansichten erstellt bekommen 

Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP

Anzeige.:

Anzeige: (Infos zum Werbeplatz >>)

Darstellung des Themas zum Ausdrucken. Bitte dann die Druckfunktion des Browsers verwenden. | Suche nach Beiträgen

nächster neuerer Beitrag | nächster älterer Beitrag
Antwort erstellen


Diesen Beitrag mit Lesezeichen versehen ... | Nach anderen Beiträgen suchen | CAD.de-Newsletter

Administrative Optionen: Beitrag schliessen | Archivieren/Bewegen | Beitrag melden!

Fragen und Anregungen: Kritik-Forum | Neues aus der Community: Community-Forum

(c)2025 CAD.de | Impressum | Datenschutz