datagridviewimagecolumn size of icon

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION 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.
This topic is 4 years and 11 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
IanUoY
Posts: 91
Last visit: Wed Sep 20, 2023 2:44 am

datagridviewimagecolumn size of icon

Post by IanUoY »

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: 91
Last visit: Wed Sep 20, 2023 2:44 am

Re: datagridviewimagecolumn size of icon

Post by IanUoY »

Oops, forgot screenshots...attached now.
Attachments
ss3.PNG
ss3.PNG (2.97 KiB) Viewed 2005 times
ss2.PNG
ss2.PNG (1.51 KiB) Viewed 2005 times
ss1.PNG
ss1.PNG (1.86 KiB) Viewed 2005 times
User avatar
IanUoY
Posts: 91
Last visit: Wed Sep 20, 2023 2:44 am

Re: datagridviewimagecolumn size of icon

Post by IanUoY »

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 1975 times
Cheers

Ian
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: datagridviewimagecolumn size of icon

Post by davidc »

Thank you for the update!
David
SAPIEN Technologies, Inc.
This topic is 4 years and 11 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.