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 ...
随机推荐
- RDIFramework.NET V2.9版本 WinFom部分新增与修正的功能
RDIFramework.NET V2.9版本 WinFom部分新增与修正的功能 转眼间RDIFramework.NET框架走了快6个年头了,随着一个版本一个版本的升级改造,现在已经越来越完美了.使 ...
- OleContainer控件介绍
OLEContainer 控件的主要属性 1) AllowInPlace property AllowInPlace:Boolean; 这个属性用于决定启动O ...
- Linux中的软硬链接
说到Linux中的软硬链接,就必须谈一下Linux的文件系统的组成的重要部分iNode和block. 首先是iNode,先用一张图了解一下iNode在Linux文件系统中的地位: Linux中的文件的 ...
- Quartz.NET
http://www.360doc.com/userhome.aspx?userid=11741424&cid=2#
- c# 中get和post的方法
用GET发送数据则用REQUEST.QUERYSTRING[''ID'']接收 一.request.aspx 二.request.aspx.cs 三运行效果: 以下是数据发送的途径http://loc ...
- C++ 学习笔记(3) —— 內联函数
内联函数的用处: 用空间换取时间,在调用时不用每次都写调用的汇编. 什么时候内联: 比较小的函数:只有两三行 在循环里循环调用的函数 什么时候不内联: 比较大的函数,2.30行的 递归的函数
- swift中editingStyleForRowAtIndexPath的写法
效果图: 首先要实现这句tableView.setEditing(true, animated: true)才能弹出左侧的小圆圈 然而在oc中tableview删除的写法百度一下很常见但是swift中 ...
- 微信JS SDK PHP Demo
一.JSSDK类定义 <?php class JSSDK { private $appId; private $appSecret; public function __construct($a ...
- JAVA基础知识之JDBC——RowSet
RowSet概念 在C#中,提供了一个DataSet,可以把数据库的数据放在内存中进行离线操作(读写),操作完成之后再同步到数据库中去,Java中则提供了类似的功能RowSet. RowSet接口继承 ...
- python学习之for语句
1.range数字范围 for i in range(5): print (i) 结果显示: 0 1 2 3 4 2.列表显示 ']: print ("current num:", ...