标签在自己的进程与C#和WinForms [英] Tabs in their own process with C# and WinForms

查看:102
本文介绍了标签在自己的进程与C#和WinForms的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能的复制结果
Windows窗体应用程序像谷歌Chrome的多进程的结果
镀铬/ IE8多进程设计,是否有可能在.NET?结果
Sample了多进程C#应用程序如谷歌Chrome浏览器

双方IE8和谷歌Chrome浏览器拥有的单独为每个打开标签进程。

Both IE8 and Google Chrome browser have separate processes for each tab that is opened.

例如,你启动IE8和开放的雅虎和谷歌在自己的标签,你结束与您的系统上运行3个进程:

For example, you launch IE8 and open Yahoo and Google in their own tabs, you end up with 3 processes running on your system:


  • IE8本身的过程[主进程]

    • 谷歌标签进程

    • 雅虎标签进程

    我玩弄在C#/的WinForms类似的事情的想法。

    I'm toying with the idea of a similar thing in C#/WinForms.

    举一个简单的例子:我有一个主进程,显示窗体和我有一个子进程的按钮。我们怎样才能使从其他进程按钮到我的表格?

    Take a simple example: I have a master process that shows a Form, and I have a Button in a child process. How can we render the Button from the other process onto my Form?

    推荐答案

    这听起来并不像一个好主意。在的WinForms共同控制是大部分不是线程安全的,并给每个控制它自己的进程似乎恶心。

    That doesn't sound like such a good idea. The winforms common controls are for the most part not thread-safe, and giving each control it's own process seems icky.

    如果你想尝试这个,或许能给每个格式的它自己的过程中,甚至只是它自己的线程。或者,如果你有一个选项卡控件,然后只给每个选项卡它自己的线程。

    If you want to try this, perhaps give each form it's own process, or even just it's own thread. Or perhaps if you have a tab control then just give each tab its own thread.

    更新

    的.Net提供了一种叫做,你可以用一个AppDomain。它比一个线程比进程更多,但较少。如果从具有多标签页有一个,你可以创建包含内容的每个标签页的自定义控制,并把它自己的组件中的每个自定义控件。然后,这些组件可以动态加载到自己的应用程序域。从那里,你应该能够创建所需的控件实例。但是,也有有关跨应用程序域说话一定的规则,所以我不知道,你可以只是控件添加到一个标签页窗体上。

    Update
    .Net provides something called an AppDomain that you can use. It's more than a thread, but less than a process. If you have a from with multiple tab pages, you could create a custom control that holds the contents for each tab page and put each custom control in it's own assembly. Then those assemblies can be dynamically loaded into their own AppDomains. From there you should be able to create an instance of the control you want. However, there are certain rules about talking across appdomains, so I don't know that you'd be able to just add that control to a tab page on your form.

    这篇关于标签在自己的进程与C#和WinForms的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆