c# program very slow and hangs mstsc

590 views Asked by At

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?

2

There are 2 answers

0
Daanvl On BEST ANSWER

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;
        }*/
    }    
2
Jon Egerton On

You probably need to tune down the mstsc experience settings:

run MSTSC, then click on the options>> button. Goto the experience tab. Either change the connection speed or turn off some of the options yourself (particularly "menu and window animation")

You can save these settings as your default or save an rdp file for your particular connection so that you don't need to tweak these every time.