Search code examples
c#performancemstsc

c# program very slow and hangs mstsc


i'm building a c# program for some company. When I test the program from the company's laptop it runs smooth and stable. but when i run the program on a microsoft terminal client, on a from with a listview that can have around 1000 rows and 5 or 6 columns it starts to slow way down until nothing responds and the terminal client is unusable. the code for the form is about 1000 lines.

What can i do to improve performance? is my code that inefficent or are there some limitations on mstsc that i have to take in considiration?


Solution

  • from this comment:" I've seen performances issues with msrdp when in the code of a form, there are calls to InvalidateCode, or controls with Paint event not properly configurated. is it your case ? can you post some code ? – Steve B"

    I found that commenting this little piece of code, that was never intended to make the final release, but is temporary until the buttons from the designer are done, was the culprit. why i dont really get bet he! it works now!

    private void terug_btn_Paint(object sender, PaintEventArgs e)
        {
           /* if (mf != null)
            {
                System.Drawing.Drawing2D.GraphicsPath myGraphicsPath = new System.Drawing.Drawing2D.GraphicsPath();
                myGraphicsPath.AddLine(30, 0, 130, 0);
                myGraphicsPath.AddLine(130, 0, 130, 30);
                myGraphicsPath.AddLine(130, 30, 30, 30);
                myGraphicsPath.AddLine(30, 30, 0, 15);
                myGraphicsPath.AddLine(0, 15, 30, 0);
                terug_btn.Size = new System.Drawing.Size(135, 35);
                terug_btn.Region = new Region(myGraphicsPath);
                terug_btn.BackColor = Color.LightBlue;
            }*/
        }