哈哈是不是丑死了?

做了一个不停变色的按钮,可以通过勾选checkbox停下来,代码如下:

复合控件果然简单呀,我都能学会~

 using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ComponentComposite
{
[ToolboxBitmap(typeof(Timer))]
public partial class Component1:UserControl
{
private Color _colFColor;
private Color _colBColor;
public Color colFColor { get { return _colFColor; } set { _colFColor = value; checkBox1.ForeColor = _colFColor; } }
public Color colBColor { get { return _colBColor; } set { _colBColor = value; checkBox1.BackColor = _colBColor; } }
public Component1()
{
InitializeComponent();
} public Component1(IContainer container)
{
container.Add(this); InitializeComponent();
} private void timer1_Tick(object sender, EventArgs e)
{ Random rdm=new Random();
int i1=rdm.Next(,);int i2=rdm.Next(,);int i3=rdm.Next(,);
button1.BackColor = System.Drawing.Color.FromArgb(i1, i2, i3);
} private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
timer1.Enabled = (timer1.Enabled)?false:true;
}
}
}

上午跟人家学了一个渐变按钮,

如图,现在试试可不可以组合。嗯可以组合,但是好像不是自动变化颜色的呀

winform 控件开发1——复合控件的更多相关文章

  1. WinForm控件开发总结目录

    WinForm控件开发总结(一)------开篇 WinForm控件开发总结(二)------使用和调试自定义控件 WinForm控件开发总结(三)------认识WinForm控件常用的Attrib ...

  2. 浅谈Winform控件开发(一):使用GDI+美化基础窗口

    写在前面: 本系列随笔将作为我对于winform控件开发的心得总结,方便对一些读者在GDI+.winform等技术方面进行一个入门级的讲解,抛砖引玉. 别问为什么不用WPF,为什么不用QT.问就是懒, ...

  3. C# Winform开发以及控件开发的需要注意的,被人问怕了,都是基础常识

    我是搞控件开发的,经常被人问,所以把一些问题记录了下来!如果有人再问,直接把地址丢给他看. 一. 经常会有人抱怨Winform界面闪烁,下面有几个方法可以尽可能的避免出现闪烁 1.控件的使用尽量以纯色 ...

  4. C# 扩展方法奇思妙用高级篇六:WinForm 控件选择器

    在Web开发中,jQuery提供了功能异常强大的$选择器来帮助我们获取页面上的对象.但在WinForm中,.Net似乎没有这样一个使用起来比较方便的选择器.好在我们有扩展方法,可以很方便的打造一个. ...

  5. WinForm控件使用文章收藏整理完成

    对C# WinForm开发系列收集的控件使用方面进行整理, 加入了一些文章, 不断补充充实, 完善这方面. 基础 - 常用控件 C# WinForm开发系列 - CheckBox/Button/Lab ...

  6. C# WinForm控件、自定义控件整理(大全)

    转:http://www.cnblogs.com/top5/archive/2010/04/29/1724039.html 对C# WinForm开发系列收集的控件使用方面进行整理, 加入了一些文章, ...

  7. Winform控件Tag使用规范

    背景 Tag在WinForm控件中经常被用来存储临时数据,类型为object,但是当程序中多个地方使用到Tag时,容易造成Tag使用的混乱,Tag是如此重要的一个属性,应该要好好考虑下如何有效的使用T ...

  8. .Net WinForm 控件键盘消息处理剖析

    在WinForm控件上我们可以看到很多关于键盘消息处理的方法,比如OnKeyDown, OnKeyPress, ProcessCmdKey, ProcessDialogKey,IsInputKey等等 ...

  9. WinForm 控件键盘消息处理剖析(转)

    一直想整理键盘事件的调用顺序,刚好看见园子里的这篇文章,写的不错,就转载了:http://www.cnblogs.com/tedzhao/archive/2010/09/07/1820557.html ...

随机推荐

  1. php配置相关

    php.ini error_reporting //配置错误的显示方式 display_errors //此项优先级高于error_reporting,如果关闭该项,会返还http状态码,如果开启,则 ...

  2. 面向对象之struct

    struct PointStruct { int pointx = 1; int pointy = 2; public PointStruct(int x, int y) { this.pointx ...

  3. 数据库主键跟外键+修改mysql的密码

    update myspl.user set password=PASSWORD(设置的密码)  where user='root'; 如果修改错误:先执行use mysple;再重复上面的代码. 一. ...

  4. Excel VBA

    =COUNTIF(Y3:Y212,"=11") =SUMIF(Y3:Y212,"=11",AA3:AA212) =SUMPRODUCT((Y3:Y212=&qu ...

  5. php安装xcache (5.4)

    安装环境centOS6.3APACHE:apache-2.4.4PHP:5.4.13 1.安装xchache: 代码如下: # wget http://xcache.lighttpd.net/pub/ ...

  6. C/C++ 中长度为0的数组

    参考文献:http://blog.csdn.net/zhaqiwen/article/details/7904515 近日在看项目中的框架代码时,发现了了一个奇特的语法:长度为0的数组例如 uint8 ...

  7. TP自带的缓存机制

    原文章出处: http://blog.163.com/liwei1987821@126/blog/static/172664928201422133218356/ 动态缓存  Cache缓存类 vie ...

  8. ArcGIS Engine开发之旅01---产品组成、逻辑体系结构

    原文:ArcGIS Engine开发之旅01---产品组成.逻辑体系结构 ArcGIS Engine 由两个产品组成:  面向开发人员的软件开发包(ArcGIS Engine Developer k ...

  9. ArcGIS API for Silverlight加载google地图(后续篇)

    原文:ArcGIS API for Silverlight加载google地图(后续篇) 之前在博客中(http://blog.csdn.net/taomanman/article/details/8 ...

  10. Android笔记:Select at least one project解决办法

    导入项目的时候发现无法导入,最上方提示“Select at least one projec” 百度了一下,原来是和上一个项目名称相同了,直接把重名项目重命名后再导入即可.