控件和form1之间的通信1 [英] Communication between controls and form1

查看:61
本文介绍了控件和form1之间的通信1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在c#windows应用程序中制作一个非常简单的游戏。

我希望能够在控件和form1之间进行通信。前后。控件,我想成为小菜单,具有可影响主要form1内容的个性化设置。或者,从form1来影响控件的内容。

-

例如:我想,这些控件就像来自网站的页面。 form1就像主菜单的主页面。从那个form1主菜单,我打开那些页面(控件),在它们内部进行一些更改,并在form1内部更新。如果我在form1中更改某些内容,当我打开一个控件时,它将包含更改。

-

怎么做?您能想到的最佳方法是什么?或者官方方法是什么?我想要一个简单而优雅的解决方案。所以,要优雅。

谢谢。



我尝试了什么:



i在超过15年的c#中尝试了很多东西。

I want to make a very simplistic game in c# windows application.
I want to be able to communicate between controls and form1. Back and forward. The controls, i want to be little menus, with personalized settings that CAN affect the main form1 content. Or, from form1 to affect the content from a control.
-
for example: I imagine, those controls are like pages from a website. The form1 is like the main page with the main menu. From that form1 main menu, i open those pages(controls), make some changes inside them, and inside form1 stuff is updated. And if I change something in form1, when I open a control, it will contain the change.
-
How to do it? What is the best approach that you can think? Or what is the official approach ? I want a simple and elegant solution. So, be elegant.
Thank you.

What I have tried:

i tried a lot of stuff in more than 15 years of c#.

推荐答案

看到这些:

在两个表格之间传递信息,第1部分:父母对孩子 [ ^ ]

在两种表格之间传递信息,第2部分:孩子到父母 [ ^ ]

他们谈论表单,但它与控件和表单/控件通信完全相同。 (表单是一个控件,但是一个专门的表单 - 它是从它派生的。)
See these:
Transferring information between two forms, Part 1: Parent to Child[^]
Transferring information between two forms, Part 2: Child to Parent[^]
They talk about forms, but it's exactly the same for controls, and form / control communications. (A Form is a Control, but a specialised one - it's derived from it.)


这篇关于控件和form1之间的通信1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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