Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > VBA / Office Integration > Excel > clip an picture in a userform


Reply
 
Thread Tools Display Modes
  #1  
Old 02-16-2010, 07:18 AM
testerfree testerfree is offline
Newcomer
 
Join Date: Feb 2010
Posts: 1
Default clip an picture in a userform


I have a userform: myuserform

Here I have a image-Area

myUserForm.Image1.picture = loadImage("d:\mypic.bmp")

now I want to cut out (clip) out of this image
a rectanlge: Let's say: top-X=100 top-Y=50, Width=200, Height 150
and store it in another image2-Area in this form

I've seen a lot about BitBlt, but I have not been able to make it run:

Private Declare Function BitBlt Lib "gdi32.dll" ( _
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

Public Sub docrop(X, Y, w, h)
Dim Retval As Long
With myUserForm.Image2
BitBlt .Picture.hdc, X, Y, w, h, myUserForm.Image2.Picture.hdc, 0, 0, SRCCOPY
End With
End Sub

result in an object not defined. So I' not addressing correctly. But How do I?
Any other idea to clip (and save it afterwards as BMP-File)?

Martin
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->