We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

cropping a graphic

janeausten
janeausten asked
on
Medium Priority
492 Views
Last Modified: 2011-09-20
hello...

i'm doing programming in vb 5.0 and i'm looking for a way to code a program that allows the user to select a particular section of a wmf or bmp file and then crop the rest of the graphic outside the select box.  or the user could click an x1 and a y2 position using a mouse and then produce the same result.

can anyone help me?  thanks in advance
Comment
Watch Question

CERTIFIED EXPERT

Commented:
Look into the StretchBlt Function:

Public Const BLACKNESS = &H42           ' (DWORD) dest = BLACK
Public Const DSTINVERT = &H550009       ' (DWORD) dest = (NOT dest)
Public Const MERGECOPY = &HC000CA       ' (DWORD) dest = (source AND pattern)
Public Const MERGEPAINT = &HBB0226      ' (DWORD) dest = (NOT source) OR dest
Public Const NOTSRCCOPY = &H330008      ' (DWORD) dest = (NOT source)
Public Const NOTSRCERASE = &H1100A6     ' (DWORD) dest = (NOT src) AND (NOT dest)
Public Const PATCOPY = &HF00021         ' (DWORD) dest = pattern
Public Const PATINVERT = &H5A0049       ' (DWORD) dest = pattern XOR dest
Public Const PATPAINT = &HFB0A09        ' (DWORD) dest = DPSnoo
Public Const SRCAND = &H8800C6          ' (DWORD) dest = source AND dest
Public Const SRCCOPY = &HCC0020         ' (DWORD) dest = source
Public Const SRCERASE = &H440328        ' (DWORD) dest = source AND (NOT dest )
Public Const SRCINVERT = &H660046       ' (DWORD) dest = source XOR dest
Public Const SRCPAINT = &HEE0086        ' (DWORD) dest = source OR dest
Public Const WHITENESS = &HFF0062       ' (DWORD) dest = WHITE

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
Declare Function StretchBlt Lib "gdi32" (ByVal hdc 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 nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long

Author

Commented:
hi, tward,

i'm not really rejecting your answer, i'm giving you the points, but
i'd like to request for more elaboration on the subject if you can.
do i  need createdc?  it's kinda hard to find materials on this subject (api programming).

thanks for everything.

jane austen

Commented:
janeausten,
still interested in your question. I could answer it.
Regards

Author

Commented:
dear soedingl,

i'll be very much obliged if you would.  didn't hear from
tward again.  i think the ...blt's are the answer, but i'm
clueless as to how i could use them.

thanks
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
hi, soeding...

the delay's no prob; actually i'm working on another project
right now, so i might not be able to evaluate your answer at
once.  anyway i'm sure to use your code, though not right now.
i'll post a comment once it works to tell you to repost it as
an answer.

thanks in advance

jane austen

Author

Commented:
oops, made a mistake.. you have posted it as an answer =)
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.