ControlDesigner

https://stackoverflow.com/questions/7762397/how-do-i-click-a-usercontrols-child-in-designer

@Bradley: thanks for pointing me in the right direction

You will need to write a ControlDesigner class, then use it in a [Designer( ... )] attribute on your UserControl.

See the example here: http://msdn.microsoft.com/en-us/library/sycctd1z(v=VS.90).aspx

For the actual click:

http://msdn.microsoft.com/en-us/library/system.windows.forms.design.controldesigner.gethittest(v=VS.90).aspx

The ControlDesigner has a protected bool GetHitTest(Point point) method - you can implement this in your ControlDesigner and return true when you want your control to handle a click, based on the click‘s location on the screen.

相关资料

http://www.cnblogs.com/blueglass/archive/2012/06/01/2530030.html

时间: 2024-10-10 10:51:00

ControlDesigner的相关文章

垂直滚动条代码

代码 using System;using System.Collections.Generic;using System.ComponentModel;using System.Drawing;using System.Data;using System.Text;using System.Windows.Forms;using System.Windows.Forms.Design;using System.Diagnostics;namespace CustomControls { [De

System.Windows.Forms.Control : Component, IOleControl, IOleObject, IOleInPlaceObject, IOleInPlaceActiveObject....

#region 程序集 System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 // C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll #endregion using System.Collections; using System.ComponentModel; using Syst

C#中的自定义控件中的属性、事件及一些相关特性的总结

今天学习了下C#用户控件开发添加自定义属性的事件,主要参考了MSDN,总结并实验了一些用于开发自定义属性和事件的特性(Attribute). 在这里先说一下我的环境: 操作系统:Windows7旗舰版(Service Pack 1) VS版本:Microsoft Visual Studio Ultimate 2012,版本 11.0.50727.1 RTMREL .NET Framework版本:4.5.50938 C#版本:Visual C# 2012 一.准备工作 1.建立一个C#窗体应用程

KRBTabControl

This article explains how to make a custom Windows Tab Control in C#. Download demo project - 82.4 KB Download source - 252 KB Introduction This article discusses how to make a custom tab control for the Windows Forms Application using the .NET Frame

禁止调整自定义控件的尺寸

有时我们在自定义控件时,出于某种原因的考虑(比如:防止在设计时误操作),想禁止调整自定义控件的尺寸(Height 或 Width).最初我是这样实现的,这也是较简单的方法: public class MyButton : System.Windows.Forms.Button { ... ... protected override voidOnResize(EventArgs e) { this.Height = 23; this.Width = 75; } } 但是我对这样的效果不太满意,要

自定义控件的子控件支持设计模式

http://www.codeproject.com/Articles/37830/Designing-Nested-Controls 假如一个复合控件由一个ToolStript和一个TextBox组成,如何使ToolStript获得设计时支持, 在设计时可以像使用普通ToolStript一样添加/删除控件? 直接把ToolStript设为Public是无法达到目的的.必须定义一个用于为组件实现设计时服务的Designer [Designer(typeof(MyDesigner))]public