Author Topic: my project is heavy and lots of flickering  (Read 2445 times)

oqapsking

  • Full Member
  • ***
  • Posts: 178
    • View Profile
my project is heavy and lots of flickering
« 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

oqapsking

  • Full Member
  • ***
  • Posts: 178
    • View Profile
Re: my project is heavy and lots of flickering
« Reply #1 on: May 14, 2017, 08:28:02 AM »
error example

oqapsking

  • Full Member
  • ***
  • Posts: 178
    • View Profile
Re: my project is heavy and lots of flickering
« Reply #2 on: May 14, 2017, 08:42:57 AM »
it even takes a lot of time loading the project

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: my project is heavy and lots of flickering
« Reply #3 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?

oqapsking

  • Full Member
  • ***
  • Posts: 178
    • View Profile
Re: my project is heavy and lots of flickering
« Reply #4 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

oqapsking

  • Full Member
  • ***
  • Posts: 178
    • View Profile
Re: my project is heavy and lots of flickering
« Reply #5 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

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: my project is heavy and lots of flickering
« Reply #6 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.


oqapsking

  • Full Member
  • ***
  • Posts: 178
    • View Profile
Re: my project is heavy and lots of flickering
« Reply #7 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

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: my project is heavy and lots of flickering
« Reply #8 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.

oqapsking

  • Full Member
  • ***
  • Posts: 178
    • View Profile
Re: my project is heavy and lots of flickering
« Reply #9 on: May 16, 2017, 05:01:21 AM »
i tried the no  flickering  panel it got worse

Godra

  • Hero Member
  • *****
  • Posts: 1438
    • View Profile
Re: my project is heavy and lots of flickering
« Reply #10 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".

oqapsking

  • Full Member
  • ***
  • Posts: 178
    • View Profile
Re: my project is heavy and lots of flickering
« Reply #11 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

Noe

  • Full Member
  • ***
  • Posts: 205
    • View Profile
Re: my project is heavy and lots of flickering
« Reply #12 on: May 17, 2017, 10:49:02 AM »
If you are starting over, I would recommend to migrate to VB 2013 or 2015.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: my project is heavy and lots of flickering
« Reply #13 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.

Noe

  • Full Member
  • ***
  • Posts: 205
    • View Profile
Re: my project is heavy and lots of flickering
« Reply #14 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.