C#窗体自定义控件

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; namespace WindowsFormsApplication1
{
public partial class TestControl : UserControl
{
private string UserName="";
public TestControl()
{
InitializeComponent();
}
public TestControl(string uid)
{
InitializeComponent();
UserName = uid;
} private void TestControl_Load(object sender, EventArgs e)
{
YongHuDA da = new YongHuDA();
YongHu data = da.Select(UserName); pictureBox1.BackgroundImage = Image.FromFile(data.Pic);
pictureBox1.BackgroundImageLayout = ImageLayout.Zoom; label1.Text = data.Nick;
label2.Text = data.Qian; button1.Tag = data.Uid;
} private void pictureBox1_Click(object sender, EventArgs e)
{
//label1.Text;
this.ParentForm.Controls["label1"].Text = label1.Text; } private void button1_Click(object sender, EventArgs e)
{ } }
}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms; namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void Form1_Load(object sender, EventArgs e)
{
YongHuDA da = new YongHuDA();
List<YongHu> list = da.Select(); foreach (YongHu data in list)
{
TestControl ctrl = new TestControl(data.Uid);
flowLayoutPanel1.Controls.Add(ctrl);
}
}
}
}
C#窗体自定义控件的更多相关文章
- C#窗体 自定义控件
1 using System; 2 using System.Collections.Generic; 3 using System.ComponentModel; 4 using System.Dr ...
- WPF自定义控件与样式(13)-自定义窗体Window & 自适应内容大小消息框MessageBox
一.前言 申明:WPF自定义控件与样式是一个系列文章,前后是有些关联的,但大多是按照由简到繁的顺序逐步发布的等,若有不明白的地方可以参考本系列前面的文章,文末附有部分文章链接. 本文主要内容: 自定义 ...
- 【转】WPF自定义控件与样式(13)-自定义窗体Window & 自适应内容大小消息框MessageBox
一.前言 申明:WPF自定义控件与样式是一个系列文章,前后是有些关联的,但大多是按照由简到繁的顺序逐步发布的等. 本文主要内容: 自定义Window窗体样式: 基于自定义窗体实现自定义MessageB ...
- c#自定义控件窗体Click无法点击Lable的处理解决方案
自定义控件做按钮,不继承Button,用Lable来做按钮文字时,点击空白处有效,但是点击lable不起作用的处理方案. 很简单,就是在Lable添加Click事件,事件中添加代码:OnClick(e ...
- (十七)c#Winform自定义控件-基类窗体
前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. 开源地址:https://gitee.com/kwwwvagaa/net_winform_custom_control ...
- (十九)c#Winform自定义控件-停靠窗体
前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. 开源地址:https://gitee.com/kwwwvagaa/net_winform_custom_control ...
- (二十)c#Winform自定义控件-有后退的窗体
前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. 开源地址:https://gitee.com/kwwwvagaa/net_winform_custom_control ...
- (二十二)c#Winform自定义控件-半透明窗体
前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. 开源地址:https://gitee.com/kwwwvagaa/net_winform_custom_control ...
- (二十三)c#Winform自定义控件-等待窗体
前提 入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章. 开源地址:https://gitee.com/kwwwvagaa/net_winform_custom_control ...
随机推荐
- 换手率的公司使用MQTT的框架
向换手率公司学习.该公司貌似也使用 Golang
- scrum3.0
3.0----------------------------------------------------- SCRUM 流程的步骤2: Spring 计划 1. 确保product backlo ...
- Python快速建站系列-Part.Two-结构化和布局
|版权声明:本文为博主原创文章,未经博主允许不得转载. 首先明确我们要建一个什么样的站,作为教程(也算自己使用tornado的一个小总结),自然功能不能太多,但又满足一个普通网站需要的就行了. 目前想 ...
- Coursera台大机器学习课程笔记3 – 机器学习的可能性
提纲: 机器学习为什么可能? 引入计算橙球概率问题 通过用Hoeffding's inequality解决上面的问题,并得出PAC的概念,证明采样数据学习到的h的错误率可以和全局一致是PAC的 将得到 ...
- [ubuntu]给ubuntu server安装xubuntu(xfce)窗口管理器
1.安装基本图形 $ sudo apt-get install x-window-system-core 2.安装窗口管理器 $ sudo apt-get install xubuntu-deskto ...
- AppCan接入微信并且进行文字分享
AppCan接入微信并且进行文字分享 接入指引 实现简单的文字分享功能 接入指引 详情请参见:http://newdocx.appcan.cn/index.html?templateId=412 实现 ...
- 通过FTP命令上传下载
用命令如何把自己电脑上的文件上传到被入侵的电脑上呢.方法有很多.用ftp是个不错的选择.方法如下 echo open 你的ftpip >ftp.txt echo user >>f ...
- Android Studio 常见问题之Rendering Problems
1.有时会出现下面的问题: 可以按如下解决 点击任何一项即可
- [Effective JavaScript 笔记]第65条:不要在计算时阻塞事件队列
第61条解释了异步API怎样帮助我们防止一段程序阻塞应用程序的事件队列.使用下面代码,可以很容易使一个应用程序陷入泥潭. while(true){} 而且它并不需要一个无限循环来写一个缓慢的程序.代码 ...
- datatable-提示
`默认columns配置问题: 记住是columnDefs不是columnsDefs `Cannot read property 'sWidth' of undefined: columns的数量和t ...