Image isn't refreshing at the correct time

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

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 6 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.
Locked
User avatar
CitrixITM
Posts: 124
Last visit: Wed Jul 27, 2022 2:19 pm

Image isn't refreshing at the correct time

Post by CitrixITM »

Product, version and build: 5.4.138.0
(*** Please do not write "latest" as a version, specify a version number ***)
32 or 64 bit version of product: 64
Operating system: 2K12R2
32 or 64 bit OS: 64
PowerShell Version: 4.0

DO NOT POST SUBSCRIPTIONS, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM

Hello,

I have a form where I have the below code in the LOAD section. When I launch the GUI, the picture comes up, but not right away (much further down in the code).
If I put a PAUSE in the code (not in the LOAD) then the picture shows up right at the pause. If I remove the pause, the picture removes. Seems to be some refresh issue? I tried to update and refresh both the form and the $picturebox1, but it doesn't seem to make the picture show up right away.

$Up = "c:\Pictures\GreenUp.png"
$picturebox1.ImageLocation = $Up

Thank you,
DevinL
Posts: 1098
Last visit: Tue Jun 06, 2017 9:15 am

Re: Image isn't refreshing at the correct time

Post by DevinL »

[TOPIC MOVED TO POWERSHELL GUIS FORUM BY MODERATOR]
DevinL
SAPIEN Technologies, Inc.
DevinL
Posts: 1098
Last visit: Tue Jun 06, 2017 9:15 am

Re: Image isn't refreshing at the correct time

Post by DevinL »

This seems like more of a general GUI question as opposed to a PowerShell Studio specific problem since the controls provided are the regular Windows controls.

If it turns out this is a product issue, I'll move the thread back to the PowerShell Studio forum.
DevinL
SAPIEN Technologies, Inc.
User avatar
CitrixITM
Posts: 124
Last visit: Wed Jul 27, 2022 2:19 pm

Re: Image isn't refreshing at the correct time

Post by CitrixITM »

Thanks DevinL. I found a fix, although not sure if it is the right one.

I went to the properties of the image in the Designer and changed the WaitOnLoad to True.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Image isn't refreshing at the correct time

Post by jvierra »

Why not assign the image in the properties?
There is really no reason for this behavior.

Create a simple form with only the picture and try again to see what is happening.
DevinL
Posts: 1098
Last visit: Tue Jun 06, 2017 9:15 am

Re: Image isn't refreshing at the correct time

Post by DevinL »

CitrixITM wrote:Thanks DevinL. I found a fix, although not sure if it is the right one.

I went to the properties of the image in the Designer and changed the WaitOnLoad to True.
Glad to hear the issue has been resolved!

As usual, if you have any further issues, please don't hesitate to post again. :D
DevinL
SAPIEN Technologies, Inc.
This topic is 6 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.
Locked