C#程序非常慢并且挂起mstsc

发布于 2024-10-18 23:38:08 字数 207 浏览 4 评论 0原文

我正在为某家公司构建 ac# 程序。当我在公司的笔记本电脑上测试该程序时,它运行流畅且稳定。但是当我在微软终端客户端上运行该程序时,在一个具有大约 1000 行和 5 或 6 列的列表视图上运行该程序时,它开始减慢速度,直到没有任何响应并且终端客户端无法使用。表单的代码大约有1000行。

我可以做什么来提高性能?我的代码是否效率低下,或者 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

香草可樂 2024-10-25 23:38:08

您可能需要调低 mstsc 体验设置:

运行 MSTSC,然后单击选项>>按钮。
转到体验选项卡。
更改连接速度或自行关闭某些选项(特别是“菜单和窗口动画”)

您可以将这些设置保存为默认设置或为您的特定连接保存 rdp 文件,这样您就不需要每次都调整这些设置时间。

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.

仅一夜美梦 2024-10-25 23:38:08

来自此评论:“我在表单代码中看到了 msrdp 的性能问题,调用了 InvalidateCode,或者 Paint 事件未正确配置的控件。这是您的情况吗?您可以发布一些代码吗? – Steve B “

我发现评论这一小段代码是罪魁祸首,它从来没有打算发布最终版本,而是暂时的,直到设计者的按钮完成为止。为什么我真的不打赌他!现在可以了!

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;
        }*/
    }    

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;
        }*/
    }    
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文