Image quality in userform

Formula11

Active Member
Joined
Mar 1, 2005
Messages
492
Office Version
  1. 365
Platform
  1. Windows
I have a spreadsheet from where I need to refer to about 20 diagrams.
Was going to load each diagram onto a userform, because I need to read cells and diagram at the same time.

The issue with images in forms is that the quality is not great, and difficult to read text in image.

Was looking at the file types when loading an image and there is *.wmf and *.emf available. There are vector image types and quality is the same at any resolution level. The file size goes from 76kb (jpg) to 2650kb (emf). The quality is not improved at all though when emf is loaded to form.

Is there anyway to improve quality so as to read text in image?
 
hello jaafar Tribak
i see your code for the image in userform
since 64-bit copymemory has a latency problem because the lenb is asynchronous you must always vary the lenB
because successive calls end up shunting the memory
and sometimes crash excel
It's a nice sketch in any case, well done

so well done for the scroll not in (recurse function loop in addressof) :i'm never see that (y)
 
Upvote 0
it's slow because the scroll is not in addressof
it's work in looping(do/loop)
in addressof it is not taken from the memory process stack of the Excel instance executing the code
 
Upvote 0
Jaffar, thanks again for attempting to include Zoom and Pan for image in a userform (post #20).

Starting again, I did try it and it does work, but haven't tested with other additions such as resizing form (maybe this feature will be removed).
The speed is OK for small images. If there is an issue with crashing Excel as patricktoulon1 suggested in post #21, that would be the only worry, otherwise the speed is OK.

Did not think it would be possible get to this point actually.
 
Upvote 0
it's slow because the scroll is not in addressof
it's work in looping(do/loop)
in addressof it is not taken from the memory process stack of the Excel instance executing the code
Certainly, a continuously running loop tends to have a greater impact on performance compared to a callback-based approach but the callbacks require subclassing the userform or installing a mouse hook which can both render the vba project unstable ... In contrast, using a loop is stable and won't crash excel.

i see your code for the image in userform
since 64-bit copymemory has a latency problem because the lenb is asynchronous you must always vary the lenB
I was initially introduced to this issue by Cristian Buse through his outstanding VBA-MemoryTools. However, I believe the primary cause of the slowdown is not the running loop or the 64-bit CopyMemory calls, but rather the scaling operation performed by the WIA. As the image size increases, the time required to process the scaling grows, which ultimately results in slower performance.
 
Upvote 0
Starting again, I did try it and it does work, but haven't tested with other additions such as resizing form (maybe this feature will be removed).
The speed is OK for small images. If there is an issue with crashing Excel as patricktoulon1 suggested in post #21, that would be the only worry, otherwise the speed is OK.
Based on my various tests so far, the code appears to be stable in its current form. As previously mentioned, in the absence of a callback procedure, the risk of instability or crashing when using api calls remains comparable to that of standard VBA code.
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top