Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.
Can scrollbars be hidden when in Pan Layout mode?
Hi team
I'm using an SRP picture to create a 28x28 px preview swatch, based on where the user clicks within another SRP Picture. This all works perfectly using the ImageOffset property now.
The user also wants to optionally create a swatch from a single pixel and the only way I could see to achieve this was to Zoom in on the relevant pixel. This works pretty well using Layout, Zoom and ScrollPos, except that then the scrollbars also appear, which means I have to resize the preview swatch and it looks a bit messy.
Can the scrollbars be hidden when Layout = Pan, or alternately is there a way I can "fill" the SRP Picture preview control with a pixel from another image, which would be even better?
TIA
I'm using an SRP picture to create a 28x28 px preview swatch, based on where the user clicks within another SRP Picture. This all works perfectly using the ImageOffset property now.
The user also wants to optionally create a swatch from a single pixel and the only way I could see to achieve this was to Zoom in on the relevant pixel. This works pretty well using Layout, Zoom and ScrollPos, except that then the scrollbars also appear, which means I have to resize the preview swatch and it looks a bit messy.
Can the scrollbars be hidden when Layout = Pan, or alternately is there a way I can "fill" the SRP Picture preview control with a pixel from another image, which would be even better?
TIA
Comments
Yep that sounds excellent! Is there a way to determine the rgb colour values for the selected pixel within an image?
Perhaps Kevin knows of a better solution, but Windows Paint has a color picker tool, which provides you with the RGB values for a selected color within an image. You can find a quick how-to here.I see now that procedural method of doing so seems to be what was requested.
I know the documentation for the Zoom property says it only words with the Pan layout, but looking at the code, I don't think it cares at all. Worth a shot.
Thanks for the feedback. The colour value for the pixel isn't for me, it's so I can then preview the 28x28 swatch that will subsequently be created for the end user, within the same form. The zoom workaround is not 100% accurate, but is pretty close - but the "real" colour would be perfect.
I would have been good, but Zoom doesn't seem to do anything when Layout = Clip for me.
I should have also mentioned the SRP Picture control is 3.0.7
I'll make a note to add properties to allow you to disable scrollbars, but it will be several weeks due to my workload before such a feature would be made a available.
No problem - the scrollbars can remain for now, it's just a visual thing. The colour isn't 100% representative in that it seems to blue a bit with surrounding pixels, but it should be good enough - until similarly if i get time I'll add a method to our .NET library to get the rgb from an image + pixel position and use the BackColor property you mentioned.
p.s. with regard to the more common scenario of cutting out a swatch from an image, the imageoffset property worked liked a charm, so thanks for including all this functionality out of the box.
Thanks again for your quick responses. I've implemented this now and the swatches are being created pretty-much as per the preview (via setting the zoom property). If you could add an option to hide the scrollbars sometime that would be great.
An alternate suggestion would be to add a GetPixel(x,y) or similar method which could return the colour of the pixel. This would have allowed me to just set the background as you suggested above, and means the preview would be 100% representative vs the ultimate swatch that gets created.