//######################################################################################### //★★★★★★★ http://www.cnpopsoft.com [华普软件] ★★★★★★★ //★★★★★★★ 华普软件 - VB & C#.NET 专业论文与源码荟萃! ★★★★★★★ //######################################################################################### /* * Copyright ?2005, Mathew Hall * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. */ using System; using System.Drawing; using System.Windows.Forms; using XPTable.Models; namespace XPTable.Events { #region Delegates /// /// Represents the method that will handle the PaintCell events of a Table /// public delegate void PaintCellEventHandler(object sender, PaintCellEventArgs e); #endregion #region PaintCellEventArgs /// /// Provides data for the PaintCell event /// public class PaintCellEventArgs : PaintEventArgs { #region Class Data /// /// The Cell to be painted /// private Cell cell; /// /// The Table the Cell belongs to /// private Table table; /// /// The Row index of the Cell /// private int row; /// /// The Column index of the Cell /// private int column; /// /// Specifies whether the Cell is selected /// private bool selected; /// /// Specifies whether the Cell has focus /// private bool focused; /// /// Specifies whether the Cell's Column is sorted /// private bool sorted; /// /// Specifies whether the Cell is editable /// private bool editable; /// /// Specifies whether the Cell is enabled /// private bool enabled; /// /// The rectangle in which to paint the Cell /// private Rectangle cellRect; /// /// Indicates whether the user has done the paining for us /// private bool handled; #endregion #region Constructor /// /// Initializes a new instance of the PaintCellEventArgs class with /// the specified graphics and clipping rectangle /// /// The Graphics used to paint the Cell /// The Rectangle that represents the rectangle /// in which to paint public PaintCellEventArgs(Graphics g, Rectangle cellRect) : this(g, null, null, -1, -1, false, false, false, false, true, cellRect) { } /// /// Initializes a new instance of the PaintCellEventArgs class with /// the specified graphics, table, row index, column index, selected value, /// focused value, mouse value and clipping rectangle /// /// The Graphics used to paint the Cell /// The Cell to be painted /// The Table the Cell belongs to /// The Row index of the Cell /// The Column index of the Cell /// Specifies whether the Cell is selected /// Specifies whether the Cell has focus /// Specifies whether the Cell's Column is sorted /// Specifies whether the Cell is able to be edited /// Specifies whether the Cell is enabled /// The rectangle in which to paint the Cell public PaintCellEventArgs(Graphics g, Cell cell, Table table, int row, int column, bool selected, bool focused, bool sorted, bool editable, bool enabled, Rectangle cellRect) : base(g, cellRect) { this.cell = cell; this.table = table; this.row = row; this.column = column; this.selected = selected; this.focused = focused; this.sorted = sorted; this.editable = editable; this.enabled = enabled; this.cellRect = cellRect; this.handled = false; } #endregion #region Properties /// /// Gets the Cell to be painted /// public Cell Cell { get { return this.cell; } } /// /// /// /// internal void SetCell(Cell cell) { this.cell = cell; } /// /// Gets the Table the Cell belongs to /// public Table Table { get { return this.table; } } /// /// /// /// internal void SetTable(Table table) { this.table = table; } /// /// Gets the Row index of the Cell /// public int Row { get { return this.row; } } /// /// /// /// internal void SetRow(int row) { this.row = row; } /// /// Gets the Column index of the Cell /// public int Column { get { return this.column; } } /// /// /// /// internal void SetColumn(int column) { this.column = column; } /// /// Gets whether the Cell is selected /// public bool Selected { get { return this.selected; } } /// /// /// /// internal void SetSelected(bool selected) { this.selected = selected; } /// /// Gets whether the Cell has focus /// public bool Focused { get { return this.focused; } } /// /// /// /// internal void SetFocused(bool focused) { this.focused = focused; } /// /// Gets whether the Cell's Column is sorted /// public bool Sorted { get { return this.sorted; } } /// /// /// /// internal void SetSorted(bool sorted) { this.sorted = sorted; } /// /// Gets whether the Cell is able to be edited /// public bool Editable { get { return this.editable; } } /// /// /// /// internal void SetEditable(bool editable) { this.editable = editable; } /// /// Gets whether the Cell is enabled /// public bool Enabled { get { return this.enabled; } } /// /// /// /// internal void SetEnabled(bool enabled) { this.enabled = enabled; } /// /// Gets the Cells bounding rectangle /// public Rectangle CellRect { get { return this.cellRect; } } /// /// /// /// internal void SetCellRect(Rectangle cellRect) { this.cellRect = cellRect; } /// /// Gets the position of the Cell /// public CellPos CellPos { get { return new CellPos(this.Row, this.Column); } } /// /// Gets or sets a value indicating whether the BeforePaintCell /// event was handled /// public bool Handled { get { return this.handled; } set { this.handled = value; } } #endregion } #endregion }