• 大小: 135KB
    文件类型: .rar
    金币: 2
    下载: 3 次
    发布日期: 2021-06-15
  • 语言: C#
  • 标签:

资源简介

支持下拉框多选、全选

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace UserControlDLL
{
    /// 
    /// 带下拉框的用户控件
    /// 

    public partial class ComCheckBoxList : UserControl
    {
        private TextBox tbSelectedValue;
        private ButtonS btnSelect;//下拉箭头
        private LabelS lbGrip;//此LABEL用于设置可以拖动下拉窗体变化

        private CheckedListBox checkListBox;
        private Label lbSelectAll;//全选
        private Label lbSelectNo;//取消

        private Form frmCheckList;

        private Panel pnlBack;
        private Panel pnlCheck;

        private System.Drawing.Point DragOffset; //用于记录窗体大小变化的位置

        //单击列表项状态更改事件
        public delegate void CheckBoxListItemClick(object sender ItemCheckEventArgs e);
        public event CheckBoxListItemClick ItemClick;

        public ComCheckBoxList()
        {
            InitializeComponent();
            this.Name = “comBoxCheckBoxList“;
            this.Layout+=new LayoutEventHandler(ComCheckBoxList_Layout);

            //生成控件
            tbSelectedValue = new TextBox();
            tbSelectedValue.ReadOnly = true;
            tbSelectedValue.Borderstyle = Borderstyle.None;

            //下拉箭头
            this.btnSelect = new ButtonS();
            btnSelect.Flatstyle = Flatstyle.Flat;
            btnSelect.Click+=new EventHandler(btnSelect_Click);

            //全选
            this.lbSelectAll = new Label();
            lbSelectAll.BackColor = Color.Transparent;
            lbSelectAll.Text = “全选“;
            lbSelectAll.Size = new Size(40 20);
            lbSelectAll.ForeColor = Color.Blue;
            lbSelectAll.Cursor = Cursors.Hand ;
            lbSelectAll.TextAlign = ContentAlignment.MiddleCenter;
            lbSelectAll.Click+=new EventHandler(lbSelectAll_Click);

            //取消
            lbSelectNo = new Label();
            lbSelectNo.BackColor = Color.Transparent;
            lbSelectNo.Text = “取消“;
            lbSelectNo.Size = new Size(40 20);
            lbSelectNo.ForeColor = Color.Blue;
            lbSelectNo.Cursor = Cursors.Hand;
            lbSelectNo.TextAlign = ContentAlignment.MiddleCenter;
            lbSelectNo.Click+=new EventHandler(lbSelectNo_Click);

            //生成checkboxlist
            this.checkListBox = new CheckedListBox();
            checkListBox.Borderstyle = Borderstyle.None;
            checkListBox.Location = new Point(00);
            checkListBox.Checkonclick = true;
            checkListBox.ScrollAlwaysVisible = true;
            checkListBox.LostFocus +=new EventHandler(checkListBox_LostFocus);
            checkListBox.ItemCheck+=new ItemCheckEventHandler(checkListBox_ItemCheck);

            //窗体
            frmCheckList = new Form();
            frmCheckList.FormBorderstyle = FormBorderstyle.None;
            frmCheck

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1542  2016-08-15 10:32  WinFormControl-\WinFormControl\UpgradeLog.xml

     文件      17920  2016-08-15 10:33  WinFormControl-\WinFormControl\UserControlDLL\bin\Debug\UserControlDLL.dll

     文件      38400  2016-08-15 10:33  WinFormControl-\WinFormControl\UserControlDLL\bin\Debug\UserControlDLL.pdb

     文件      13926  2012-07-26 11:41  WinFormControl-\WinFormControl\UserControlDLL\ComCheckBoxList.cs

     文件       1128  2012-07-25 14:34  WinFormControl-\WinFormControl\UserControlDLL\ComCheckBoxList.Designer.cs

     文件       4351  2012-07-23 13:18  WinFormControl-\WinFormControl\UserControlDLL\DataGridViewButton.cs

     文件       2175  2012-07-23 12:02  WinFormControl-\WinFormControl\UserControlDLL\DataGridViewButton.Designer.cs

     文件       6190  2012-07-23 12:02  WinFormControl-\WinFormControl\UserControlDLL\DataGridViewButton.resx

     文件        789  2016-08-15 10:33  WinFormControl-\WinFormControl\UserControlDLL\obj\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       6845  2016-08-15 11:44  WinFormControl-\WinFormControl\UserControlDLL\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件       4608  2016-08-15 10:32  WinFormControl-\WinFormControl\UserControlDLL\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll

     文件       1468  2016-08-15 10:33  WinFormControl-\WinFormControl\UserControlDLL\obj\Debug\UserControlDLL.csproj.FileListAbsolute.txt

     文件        901  2012-07-26 11:39  WinFormControl-\WinFormControl\UserControlDLL\obj\Debug\UserControlDLL.csproj.GenerateResource.Cache

     文件        180  2016-08-15 10:33  WinFormControl-\WinFormControl\UserControlDLL\obj\Debug\UserControlDLL.DataGridViewButton.resources

     文件      17920  2016-08-15 10:33  WinFormControl-\WinFormControl\UserControlDLL\obj\Debug\UserControlDLL.dll

     文件      38400  2016-08-15 10:33  WinFormControl-\WinFormControl\UserControlDLL\obj\Debug\UserControlDLL.pdb

     文件        881  2016-08-15 10:33  WinFormControl-\WinFormControl\UserControlDLL\obj\Debug\UserControlDLL.Properties.Resources.resources

     文件       1360  2012-07-23 11:44  WinFormControl-\WinFormControl\UserControlDLL\Properties\AssemblyInfo.cs

     文件       3240  2016-08-15 10:32  WinFormControl-\WinFormControl\UserControlDLL\Properties\Resources.Designer.cs

     文件       6201  2012-07-23 11:48  WinFormControl-\WinFormControl\UserControlDLL\Properties\Resources.resx

     文件        362  2012-07-23 11:48  WinFormControl-\WinFormControl\UserControlDLL\Resources\consult.gif

     文件       5292  2016-08-15 10:32  WinFormControl-\WinFormControl\UserControlDLL\UserControlDLL.csproj

     文件        452  2016-08-15 10:32  WinFormControl-\WinFormControl\UserControlDLL\UserControlDLL.csproj.user

     文件      17920  2016-08-15 10:33  WinFormControl-\WinFormControl\WinFormControl\bin\Debug\UserControlDLL.dll

     文件      38400  2016-08-15 10:33  WinFormControl-\WinFormControl\WinFormControl\bin\Debug\UserControlDLL.pdb

     文件      10240  2016-08-15 11:44  WinFormControl-\WinFormControl\WinFormControl\bin\Debug\WinFormControl.exe

     文件      46592  2016-08-15 11:44  WinFormControl-\WinFormControl\WinFormControl\bin\Debug\WinFormControl.pdb

     文件      21464  2016-08-15 11:44  WinFormControl-\WinFormControl\WinFormControl\bin\Debug\WinFormControl.vshost.exe

     文件        490  2010-03-17 22:39  WinFormControl-\WinFormControl\WinFormControl\bin\Debug\WinFormControl.vshost.exe.manifest

     文件       1997  2016-08-15 11:43  WinFormControl-\WinFormControl\WinFormControl\Form1.cs

............此处省略51个文件信息

评论

共有 条评论

相关资源