// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-22-2019
//
// ***********************************************************************
//
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
//
//
// Blog: https://www.cnblogs.com/bfyx
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
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 HZH_Controls.Controls
{
///
/// Class UCListViewItem.
/// Implements the
/// Implements the
///
///
///
[ToolboxItem(false)]
public partial class UCListViewItem : UCControlBase, IListViewItem
{
///
/// The m data source
///
private object m_dataSource;
///
/// 数据源
///
/// The data source.
public object DataSource
{
get
{
return m_dataSource;
}
set
{
m_dataSource = value;
lblTitle.Text = value.ToString();
}
}
///
/// 选中项事件
///
public event EventHandler SelectedItemEvent;
///
/// Initializes a new instance of the class.
///
public UCListViewItem()
{
InitializeComponent();
lblTitle.MouseDown += lblTitle_MouseDown;
}
///
/// Handles the MouseDown event of the lblTitle control.
///
/// The source of the event.
/// The instance containing the event data.
void lblTitle_MouseDown(object sender, MouseEventArgs e)
{
if (SelectedItemEvent != null)
{
SelectedItemEvent(this, e);
}
}
///
/// Sets the selected.
///
/// if set to true [BLN selected].
public void SetSelected(bool blnSelected)
{
if (blnSelected)
this.FillColor = Color.FromArgb(255, 247, 245);
else
this.FillColor = Color.White;
this.Refresh();
}
}
}