English 中文(简体)
C#
原标题:Composite Winform Control in C#
  • 时间:2010-01-13 06:05:35
  •  标签:
  • c#

复合控制

见http://www.freeimagehosting.net/uploads/a51136603b.png

Howdy,

I am hoping for some help. I wanted to create a 复合控制, shown in the screenshot above. As seen in the screen shot, the Parent Control is Label 1; it contains child controls Label2, Label3, and Label4, and a PictureBox containing a pre-defined image.

我愿将以上内容纳入C#中的一项综合控制,其规格如下:

父母Label1应引发一次浮标活动。 将对Label2、Label3和Label4进行儿童控制,并配给有关MouseMove事件的工具包,而最后的《儿童控制》即《图片》应当有关于MouseMove事件和Click起事件的工具。

同样,必须把Label2、Label3、Label4和KhoBox在父母控制范围内的位置确定为财产,其文本和规模也一样。

我如何把所有这些内容纳入一个称为AilmentLabel的综合控制? 任何建议或信息都受到高度赞赏。 非常感谢。

问题回答

MSDN为如何做到这一点提供了非常彻底的通道。 页: 1 授权C#“的复合控制

就像你想要建立一个用户理事会一样。 它就像任何其他控制一样,但可以增加表面的控制。 之后,你将暴露用户群中的特性,从而将变化传播到适当的控制之下:

public string Label1Text {
    get { return this.Label1.Text; }
    set { this.Label1.Text = value; }
}
...etc...

你们甚至能够以这种方式揭露Click事件,并使用户能够订阅。 然后,你可以把这一新控制拖到你的其他窗口表面。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签