AdvancedHMI Software

General Category => Support Questions => Topic started by: oqapsking on May 14, 2017, 08:27:10 AM

Title: my project is heavy and lots of flickering
Post by: oqapsking on May 14, 2017, 08:27:10 AM
hello

in my project what i built is multi page project

i the first page it monitors 6 plc`s

the way i built my software is to look and work like dvr software

so in the main page

i have 6 panels each panel have the same components and background the only difference is the com

my project is 1920;1080 size


each panel is live and when i click on it it opens another form that have the same components but with bigger size

now to the problems:


1-  each time i make changes i get some errors and missing files i close the program (VB net 2012) and then re open it
the project is back to normal.(see the photos in the attachment)

2- the  flickering i solved half of it
the main page which has 6 panels keeps flickering
the another page got fixed when i used this code

Code: [Select]

Protected Overrides ReadOnly Property CreateParams() As CreateParams
        Get
            Dim cp As CreateParams = MyBase.CreateParams
            cp.ExStyle = cp.ExStyle Or &H2000000
            Return cp
        End Get
    End Property 'CreateParams


i hope someone can help me

by the way my pc is

core i5 3.10GHz

10 Gbyte ram

with 250 ssd

and gt630 vga card


i read something about using computer hardware  instead of net framework but i didn't find any how to do it


with thanks
Title: Re: my project is heavy and lots of flickering
Post by: oqapsking on May 14, 2017, 08:28:02 AM
error example
Title: Re: my project is heavy and lots of flickering
Post by: oqapsking on May 14, 2017, 08:42:57 AM
it even takes a lot of time loading the project
Title: Re: my project is heavy and lots of flickering
Post by: Archie on May 14, 2017, 08:54:23 AM
An out of memory typically occurs when you have code that is recursively doing something. It looks like you are loading something from a file. It may be repeat ably loading those contents and running out of memory.

Are you putting pictures in the background of your panels?
Title: Re: my project is heavy and lots of flickering
Post by: oqapsking on May 14, 2017, 09:06:07 AM
yes i do the photos size was 1920:1080 and i now changed it to lower size as the panels
Title: Re: my project is heavy and lots of flickering
Post by: oqapsking on May 14, 2017, 09:12:05 AM
after i changed the photos size
the project became more smoother
but the weird thing is that when i change the graphicselect1 in imageselectbybit control i have to change it one by one if i change it when i select them all the gif does not play
Title: Re: my project is heavy and lots of flickering
Post by: Archie on May 14, 2017, 09:44:31 AM
If you are using a Panel with a BackgroundImage, then you may have to create a "non-flickering" panel:

Code: [Select]
Public Class PanelNoFlicker
    Inherits Panel

Public Sub New()
        MyBase.New

        Me.SetStyle(System.Windows.Forms.ControlStyles.OptimizedDoubleBuffer Or
                    System.Windows.Forms.ControlStyles.AllPaintingInWmPaint Or
                    System.Windows.Forms.ControlStyles.UserPaint Or
                    System.Windows.Forms.ControlStyles.SupportsTransparentBackColor, True)
    End Sub
End Class


Here is something interesting..... If you look at the source code for the ImageList:

http://www.dotnetframework.org/default.aspx/DotNET/DotNET/8@0/untmp/whidbey/REDBITS/ndp/fx/src/WinForms/Managed/System/WinForms/ImageList@cs/4/ImageList@cs

There is a note in the code:
Code: [Select]
// ImageList appears to consume an exponential amount of memory
// based on image size x bpp.  Restrict this to a reasonable maximum
// to keep people's systems from crashing.

Title: Re: my project is heavy and lots of flickering
Post by: oqapsking on May 14, 2017, 10:37:28 AM
thanks for your help archie

the second problem is solved

but i still have to re open my project and rebuild it after changing any thing

some times after changing a label text

i get the memory error

any ideas

and the imagelist code that you referred to is in sharp which means i don`t understand it or how to use it as am a noop in vb net
Title: Re: my project is heavy and lots of flickering
Post by: Archie on May 14, 2017, 10:46:06 AM
The link to the code I sent is just for reference and not to be used. It lets you see the notes and how Microsoft does their code.
Title: Re: my project is heavy and lots of flickering
Post by: oqapsking on May 16, 2017, 05:01:21 AM
i tried the no  flickering  panel it got worse
Title: Re: my project is heavy and lots of flickering
Post by: Godra on May 16, 2017, 05:49:20 PM
If something doesn't work for you then just go back to what does work.

In my opinion, you should definitely consider re-designing your project to make it "lighter".
Title: Re: my project is heavy and lots of flickering
Post by: oqapsking on May 17, 2017, 02:14:40 AM
i did and i reduced the photos sizes
and no flickering

 but i still get the memory  out exception

so i opened new project i am gonna do each one in a different project then after i finish them i will copy them all to one project
Title: Re: my project is heavy and lots of flickering
Post by: Noe on May 17, 2017, 10:49:02 AM
If you are starting over, I would recommend to migrate to VB 2013 or 2015.
Title: Re: my project is heavy and lots of flickering
Post by: Archie on May 17, 2017, 05:02:30 PM
If you are starting over, I would recommend to migrate to VB 2013 or 2015.
I have been recommending VS 2017 now because 2015 has that issue that sometimes the drivers will not always show up in the toolbox.
Title: Re: my project is heavy and lots of flickering
Post by: Noe on May 17, 2017, 05:29:39 PM
Been using 2013 mostly, so have not faced that issue so far. Thanks for the tip Archie.
Title: Re: my project is heavy and lots of flickering
Post by: oqapsking on May 18, 2017, 03:10:40 AM
ok i will download 2017

and what is better  win10 or win7? with thanks
Title: Re: my project is heavy and lots of flickering
Post by: oqapsking on May 18, 2017, 03:16:59 AM
is Microsoft.Visual.Studio.2017..Community good for ahmi?
Title: Re: my project is heavy and lots of flickering
Post by: Noe on May 18, 2017, 01:16:43 PM
ok i will download 2017

and what is better  win10 or win7? with thanks

I do not think there is a difference for your purposes.
Title: Re: my project is heavy and lots of flickering
Post by: oqapsking on May 20, 2017, 08:09:43 AM
as it seams it solves the out of memory error