Page 2 of 2 FirstFirst 12
Results 41 to 45 of 45

Thread: [vb6] Enhancing VB's StdPicture Object to Support GDI+

  1. #41
    Lively Member
    Join Date
    Oct 2016
    Posts
    108

    Re: [vb6] Enhancing VB's StdPicture Object to Support GDI+

    This Class sounds very interesting. i have been using WIA for the bit of graphics i needed.

    i didn't go through the whole thread, so i have just a couple of questions.

    1. can i read and write the picture to a database.

    2. Is it possible to load a picture (from file, resource or database) and then paint it to a DC by just using the hDC (the Device context is in memory).

  2. #42
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: [vb6] Enhancing VB's StdPicture Object to Support GDI+

    Quote Originally Posted by Semke View Post
    1. can i read and write the picture to a database.

    2. Is it possible to load a picture (from file, resource or database) and then paint it to a DC by just using the hDC (the Device context is in memory).
    For both (1 and 2) I think the cGDIPlusCache-Class in this CodeBank-Thread is entirely sufficient:
    https://www.vbforums.com/showthread....-cls-revisited

    It can load from resources, and all kind of files/byte-arrays (under a given "Userdefined-ImageKey") -
    and then later (alpha-)render by using that imagekey onto any target-hDC (including high-quality-scaling).

    It can also convert+save e.g. a Resource loaded from an *.ico ... to a *.png-file or *.png-bytearray (for DB-Blob-storage) if that's needed.

    HTH

    Olaf

  3. #43
    Lively Member
    Join Date
    Oct 2016
    Posts
    108

    Re: [vb6] Enhancing VB's StdPicture Object to Support GDI+

    Quote Originally Posted by Schmidt View Post
    For both (1 and 2) I think the cGDIPlusCache-Class in this CodeBank-Thread is entirely sufficient:
    https://www.vbforums.com/showthread....-cls-revisited

    It can load from resources, and all kind of files/byte-arrays (under a given "Userdefined-ImageKey") -
    and then later (alpha-)render by using that imagekey onto any target-hDC (including high-quality-scaling).

    It can also convert+save e.g. a Resource loaded from an *.ico ... to a *.png-file or *.png-bytearray (for DB-Blob-storage) if that's needed.

    HTH

    Olaf
    thanks.

    this works perfect for me.

    I am still struggling in saving the picture, at a reduced size

  4. #44
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,120

    Re: [vb6] Enhancing VB's StdPicture Object to Support GDI+

    I'm not aware of any graphics library where there is an atomic operation save-at-reduced-size contrary to load-at-reduced-size particularly for JPEG images (can be decoded much faster).

    Your best bet would be to separate resize/resample operation from file-save operation into a two-step solution. I can see there is CreateScaledImg method.

    cheers,
    </wqw>

  5. #45
    Junior Member
    Join Date
    Jul 2017
    Posts
    16

    Re: [vb6] Enhancing VB's StdPicture Object to Support GDI+

    Hi LaVolpe,
    First thanks for your amazing project and also because you always share your knowledge with others.
    In the past, This project worked for me without any problems. But now, with run the project, I encounter the following error:

    Code:
    Run-time error '16':
    Expression too complex
    The error occured in the zzSafeOffset32 routine, in the flowing line:

    Code:
    If Abs(AdjAmount) >= UINT_MaxPlus1 Then
    If I stop the project and run it again after the error occurs, the above error will no longer be displayed, but the project will not work properly. But if I close the project and run it again, I will get the same error again.
    If I delete the ABS function in the error line (
    Code:
    If AdjAmount >= UINT_MaxPlus1 Then
    ), the project will work without any problems.

    Do you have any idea why this error occurred? please help me.

    This error occurs in the uploaded project without any changes.
    I'm using Windows 10 Version 1909 Build 18363.836

    Thanks again.

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width