| | |
How to copy a section of an image to the clipboard
Thread Solved |
Yes... but it will require a noxious amount of API calls with GDI. I suppose a great start would be researching GetDC() api call, and then working on learning BitBlt. You could probably get the device context of your picturebox, then use bitblt to get only a certain area of the picture and copy it to a new picturebox (you may want StretchBlt instead of bitblt) and from there, you can use the standard clipboard methods (clipboard.setdata()), or you can get crazy, and use the Clipboard API Calls.
Hi,
You can also use PaintPicture () to get the portion of image
Code
You can also use PaintPicture () to get the portion of image
Code
VB Syntax (Toggle Plain Text)
Option Explicit Dim iX As Integer, iY As Integer, iHeight As Integer, iWidth As Integer Private Sub cmdCopy_Click() 'Set Destination Picture box width and Height picDest.Width = iWidth picDest.Height = iHeight 'Copy the Portion of picture from Source to Destination picDest.PaintPicture picSource.Picture, _ 0, 0, iWidth, iHeight, _ iX, iY, iWidth, iHeight 'Set drawn image to picture picDest.Picture = picDest.Image 'Copy to Clipboard Clipboard.SetData picDest.Picture End Sub Private Sub Form_Load() 'Picture Dimension iX = 1000 ' in twips iY = 1000 iHeight = 2000 iWidth = 2000 picDest.AutoRedraw = True End Sub
KSG
![]() |
Similar Threads
- Firefox Compatibility help with script (JavaScript / DHTML / AJAX)
- Can't remove Mirar from laptop (Viruses, Spyware and other Nasties)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Seeking for this for so Long
- Next Thread: excel as a database
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






