In one UserControl I have option buttons that are supposed to change the visibility of rectangles in another user control and I can t find out how to do this. Can anyone give me some code example for this?
A. 如何在二次控制中参考一用户中的物体
原标题:How to reference objects in one UserControl from code in a second control
问题回答
用户控制应当引起一项活动,即第二次控制会被用于改变知名度:
//FirstControl
public event EventHandler SelectionChanged;
private void OnOptionButtonSelectionChange(....)
{
if (SelectionChanged != null)
SelectionChanged(this, EventArgs.Empty);
}
//SecondControl
public void Setup()
{
firstControlInstance.SelectionChanged += new EventHandler(manage_SelectionChanged);
}
private void manage_SelectionChanged(Object sender, EventArgs e)
{
}
或者,如果控制被分解,你可以像以下那样使用调解人:。
相关问题
热门标签
- winforms
- combobox
- fogbugz
- java
- date
- internationalization
- asp.net
- iis
- url-rewriting
- urlrewriter
- c#
- enums
- ocaml
- haxe
- algorithm
- string
- viewstate
- .net
- c++
- c
- symbol-table
- mysql
- database
- postgresql
- licensing
- migration
- vb.net
- vb6
- declaration
- vb6-migration
- python
- psycopg2
- backup
- vmware
- virtualization
- gnu-screen
- authentication
- desktop
- excel
- xll
- cultureinfo
- regioninfo
- oracle
- client
- session
- download
- html
- virtual
- constructor
- scenarios
- perl
- full-text-search
- javascript
- ajax
- testing
- oop
- inheritance
- vim
- encapsulation
- information-hiding