datagridviewimagecolumn size of icon

Support for all customers who have purchased a SAPIEN PowerShell Studio product license. This forum does not offer a response time guarantee.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
IanUoY
Posts: 76
Joined: Wed Jul 31, 2013 2:09 am

datagridviewimagecolumn size of icon

Post by IanUoY » Wed Apr 17, 2019 1:19 am

To help you better we need some information from you.

*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***

Product, version and build: Powershell Studio 2019 5.6.161
32 or 64 bit version of product: 64 bit
Operating system: Windows 10
32 or 64 bit OS: 64bit

*** Please add details and screenshots as needed below. ***

Ok, I have set up a column in my datagridview to display status, so far easy peasy. I've added my icon file to column image (as default) - see ss1.png and this displays fine in my form, see ss2.png

However, if I want to change the icon programmatically if status changed, then icon displays much bigger (have used same icon file as wanted to ensure nothing different with icon files). As you can see from screenshot ss3.png), the icon is much larger.

I've used the following code:

$crossIcon = [system.drawing.icon]::ExtractAssociatedIcon("I:\xxxx\Hopstarter-Rounded-Square-Button-Ok.ico")

foreach ($user in $ecsgextcollusers) { $dgvECSGUsers.Rows.Add($crossIcon, $user.name, $user.description,"Collaborator") }

Any ideas how I ensure same size as default loaded ones?

Regards

Ian

User avatar
IanUoY
Posts: 76
Joined: Wed Jul 31, 2013 2:09 am

Re: datagridviewimagecolumn size of icon

Post by IanUoY » Wed Apr 17, 2019 1:41 am

Oops, forgot screenshots...attached now.
Attachments
ss3.PNG
ss3.PNG (2.97 KiB) Viewed 619 times
ss2.PNG
ss2.PNG (1.51 KiB) Viewed 619 times
ss1.PNG
ss1.PNG (1.86 KiB) Viewed 619 times

User avatar
IanUoY
Posts: 76
Joined: Wed Jul 31, 2013 2:09 am

Re: datagridviewimagecolumn size of icon

Post by IanUoY » Wed Apr 17, 2019 5:33 am

Fixed or at least a workaround.

I changed code to (and used different icon file to test) :
$crossIcon = [system.drawing.image]::FromFile("I:\xxxxx\Hopstarter-Rounded-Square-Button-Delete.ico")

As you can see, this had the desired result.
ss4.PNG
ss4.PNG (1.76 KiB) Viewed 589 times
Cheers

Ian

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

Re: datagridviewimagecolumn size of icon

Post by davidc » Wed Apr 17, 2019 7:42 am

Thank you for the update!
David
SAPIEN Technologies, Inc.