资源简介
Custom Controls C# WinForm 自定义ComboBox 显示颜色下拉框,在WinForm界面设计方面,采用自定义的ComboBox控件实现下拉框可选择颜色列表。可显示颜色小方块,源代码可在VS2008下编译通过。
代码片段和文件信息
//---------------------------------------------------------------------
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY
//KIND EITHER EXPRESSED OR IMPLIED INCLUDING BUT NOT LIMITED TO THE
//IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
//PARTICULAR PURPOSE.
//---------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms.Visualstyles;
using System.Collections;
using System.Reflection;
namespace DataGridViewAutoFilter
{
///
/// Provides a drop-down filter list in a DataGridViewColumnHeaderCell.
///
public class DataGridViewAutoFilterColumnHeaderCell : DataGridViewColumnHeaderCell
{
///
/// The ListBox used for all drop-down lists.
///
private static FilterListBox dropDownListBox = new FilterListBox();
///
/// A list of filters available for the owning column stored as
/// formatted and unformatted string values.
///
private System.Collections.Specialized.OrderedDictionary filters =
new System.Collections.Specialized.OrderedDictionary();
///
/// The drop-down list filter value currently in effect for the owning column.
///
private String selectedFilterValue = String.Empty;
///
/// The complete filter string currently in effect for the owning column.
///
private String currentColumnFilter = String.Empty;
///
/// Indicates whether the DataGridView is currently filtered by the owning column.
///
private Boolean filtered;
///
/// Initializes a new instance of the DataGridViewColumnHeaderCell
/// class and sets its property values to the property values of the
/// specified DataGridViewColumnHeaderCell.
///
/// The DataGridViewColumnHeaderCell to copy property values from.
public DataGridViewAutoFilterColumnHeaderCell(DataGridViewColumnHeaderCell oldHeaderCell)
{
this.ContextMenuStrip = oldHeaderCell.ContextMenuStrip;
this.ErrorText = oldHeaderCell.ErrorText;
this.Tag = oldHeaderCell.Tag;
this.ToolTipText = oldHeaderCell.ToolTipText;
this.Value = oldHeaderCell.Value;
this.ValueType = oldHeaderCell.ValueType;
// Use Hasstyle to avoid creating a new style object
// when the style property has not previously been
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
----------- --------- ---------- ----- ----
1297225 84
- 上一篇:c#注册表监控
- 下一篇:微信企业付款到银行卡、RSA加密处理
评论
共有 条评论