1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace LYFZ.ComponentLibrary
- {
- /* public class TablePanelContainer : System.Windows.Forms.Panel
- {
- public TablePanelContainer()
- {
- }
- }*/
- /// <summary>
- /// Panel转数据表格视图
- /// </summary>
- public class PanelToDataTableView:System.Windows.Forms.Panel
- {
- System.Windows.Forms.Panel _tableContainer;
- System.Windows.Forms.Panel _PanelTableTitle;
- public PanelToDataTableView(System.Windows.Forms.Panel container)
- {
- this._PanelTableTitle = new Panel();
- this._PanelTableTitle.Width = this.Width;
- this._PanelTableTitle.Height = 32;
- this._PanelTableTitle.Padding = new Padding(0, 0, 0, 0);
- this._PanelTableTitle.Margin = new Padding(0, 0, 0, 0);
- this._PanelTableTitle.Location = new Point(0, 0);
- this._tableContainer = container;
- this._tableContainer.Controls.Add(this._PanelTableTitle);
- this._tableContainer.Controls.Add(this);
- this._tableContainer.Scroll += _tableContainer_Scroll;
- this._tableContainer.Paint += _tableContainer_Paint;
- this._PanelTableTitle.Paint += _PanelTableTitle_Paint;
- this.Padding = new Padding(0, 0, 0, 0);
- this.Margin = new Padding(0, 0, 0, 0);
- this.Location = new Point(0, 0);
- this.Paint += _tableContent_Paint;
- this.MouseMove += _tableContent_MouseMove;
- this.MouseDown += _tableContent_MouseDown;
- this.MouseUp += _tableContent_MouseUp;
- this._PanelTableTitle.MouseMove += _tableContent_MouseMove;
- this._PanelTableTitle.MouseDown += _tableContent_MouseDown;
- this._PanelTableTitle.MouseUp += _tableContent_MouseUp;
- this._tableContainer.PreviewKeyDown += _tableContainer_PreviewKeyDown;
- }
- private void _tableContainer_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
- {
- this.isControl = e.Control;
-
- }
- bool isControl = false;
- protected override void OnKeyUp(KeyEventArgs e)
- {
- this.isControl = e.Control;
- base.OnKeyUp(e);
- }
- protected override void OnKeyDown(KeyEventArgs e)
- {
- this.isControl = e.Control;
- base.OnKeyDown(e);
- }
-
- private void _tableContent_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- Point mousePoint = this.ConvertMousePoint(e.Location);
- DataEventArgs args = this.GetDataEventArgs(mousePoint, e.Button);
- if (args != null)
- {
- args.CurrentThumbtack = this.GetMouseSelectThumbtack(args.CurrentCell, mousePoint);
- if (args.CurrentThumbtack!=null)
- {
- if (this.EventCellThumbtack_DoubleClick != null)
- {
- this.EventCellThumbtack_DoubleClick(this, args);
- }
- }
- else
- {
- if (this.EventCell_DoubleClick != null)
- {
- this.EventCell_DoubleClick(this, args);
- }
- }
- }
- }
- /// <summary>
- /// 获取当前选择图钉
- /// </summary>
- /// <param name="currentCell"></param>
- /// <param name="mousePoint"></param>
- /// <returns></returns>
- ThumbtackData GetMouseSelectThumbtack(PDataColumn currentCell, Point mousePoint)
- {
- if (currentCell.ThumbtackList != null && currentCell.ThumbtackList.Count > 0)
- {
- return currentCell.ThumbtackList.Find(t => t != null && t.ThumbtackRectangle.Contains(mousePoint));
- }
- return null;
- }
- private void _tableContent_MouseClick(object sender, MouseEventArgs e)
- {
- Point mousePoint = this.ConvertMousePoint(e.Location);
- DataEventArgs args = this.GetDataEventArgs(mousePoint,e.Button);
- if (args != null)
- {
- args.CurrentThumbtack = this.GetMouseSelectThumbtack(args.CurrentCell, mousePoint);
- if (args.CurrentThumbtack != null)
- {
- if (this.EventCellThumbtack_Click != null)
- {
- this.EventCellThumbtack_Click(this, args);
- }
- }
- if (this.EventCell_Click != null)
- {
- this.EventCell_Click(this, args);
- }
- }
- }
-
- DataEventArgs GetDataEventArgs(Point mousePoint, MouseButtons button)
- {
- PDataRow mouseDownRow = this.dataRowList.Find(r => r.DataColumnList.Any(c => c.CellRectangle.Contains(mousePoint) && !c.IsIgnoreDraw));
- bool isHeadRow = false;
- if (mouseDownRow == null)
- {
- if (this.headColumnRow.DataColumnList.Any(c => c.CellRectangle.Contains(mousePoint)))
- {
- mouseDownRow = this.headColumnRow;
- isHeadRow = true;
- }
- }
- if (mouseDownRow != null)
- {
- PDataColumn mouseDownCell = mouseDownRow.DataColumnList.Find(c => c.CellRectangle.Contains(mousePoint));
- if (mouseDownCell != null)
- {
- return new DataEventArgs(mouseDownRow, mouseDownCell,mousePoint, button, isHeadRow);
- }
- }
- return null;
- }
- /// <summary>
- /// 鼠标弹起时的位置
- /// </summary>
- Point mouseUpPoint = new Point();
- DateTime MouseUpTime = DateTime.Now;
- Rectangle tempMouseClickRectangle = new Rectangle();
- private void _tableContent_MouseUp(object sender, MouseEventArgs e)
- {
- mouseUpPoint =this.ConvertMousePoint(e.Location);
- this._tableContainer.Focus();
- this.isControl = false;
- PDataColumn mouseDownCell = this.headColumnRow.DataColumnList.Find(c => c.CellRectangle.Contains(mouseDownPoint));
- if (mouseDownCell != null&& this.isSizeWE)
- {
- if (this.isSizeWE)
- {
- mouseDownCell.Width += mouseUpPoint.X - mouseDownPoint.X;
- if (mouseDownCell.Width < 2)
- {
- mouseDownCell.Width = 2;
- }
- this.isSizeWE = false;
- this.RefreshTableView();
- }
- }
- else
- {
- double secondCount = ExecDateDiff(MouseUpTime, DateTime.Now);
- MouseUpTime = DateTime.Now;
- if (secondCount < 300 && tempMouseClickRectangle.Contains(mouseUpPoint)&&e.Button== MouseButtons.Left)
- {
- this._tableContent_MouseDoubleClick(sender, e);
- }
- else
- {
- this._tableContent_MouseClick(sender, e);
- }
- tempMouseClickRectangle = new Rectangle(mouseUpPoint.X - 3, mouseUpPoint.Y - 3, 12, 12);
- }
- }
- /// <summary>
- /// 程序执行时间测试
- /// </summary>
- /// <param name="dateBegin">开始时间</param>
- /// <param name="dateEnd">结束时间</param>
- /// <returns>返回(秒)单位,比如: 0.00239秒</returns>
- public static double ExecDateDiff(DateTime dateBegin, DateTime dateEnd)
- {
- return LYFZ.WinAPI.CustomPublicMethod.ExecDateDiff(dateBegin, dateEnd);
- }
- /// <summary>
- /// 因为鼠标坐标点用的是 int16 位表示(int16 最大值:-32768到32767 之间) 所以需要转换成 int32位
- /// </summary>
- /// <param name="point"></param>
- /// <returns></returns>
- Point ConvertMousePoint(Point point)
- {
- Point tempPoint = point;
- if (tempPoint.Y < 0)
- {
- tempPoint = new Point(tempPoint.X, tempPoint.Y + 32767 * 2);
- }
- return tempPoint;
- }
- [Browsable(false)]
- public PDataRow CurrentSelectRow {
- get {
- return this.dataRowList.Find(r=>r.IsSelected);
- }
- }
- [Browsable(false)]
- public PDataColumn CurrentSelectCell
- {
- get
- {
- return this.dataRowList.Find(r => r.DataColumnList.Any(c => c.IsSelected)).DataColumnList.Find(c=>c.IsSelected);
- }
- }
- /// <summary>
- /// 当前选择行集合
- /// </summary>
- [Browsable(false)]
- public List<PDataRow> SelectRowList
- {
- get {
- return this.dataRowList.FindAll(r=>r.IsSelected);
- }
- }
- /// <summary>
- /// 上次选择行集合
- /// </summary>
- List<PDataRow> oldSelectRowList = new List<PDataRow>();
- /// <summary>
- /// 设置当前行选择状态
- /// </summary>
- /// <param name="currRow"></param>
- void SetSelectRowStatus(PDataRow currRow,bool isMouseDownRow=false)
- {
- if (currRow != null)
- {
-
- Graphics g = this.CreateGraphics();
- List<PDataRow> delSelectRowList = new List<PDataRow>();
- if (!this.isControl)
- {
- foreach (PDataRow row in this.oldSelectRowList)
- {
- if (row != null && mouseDownRow != null && row.RowIndex != currRow.RowIndex && row.RowIndex != mouseDownRow.RowIndex)
- {
- if (
- (mouseDownRow.RowIndex >= currRow.RowIndex && (row.RowIndex > mouseDownRow.RowIndex || row.RowIndex < currRow.RowIndex))
- || (mouseDownRow.RowIndex <= currRow.RowIndex && (row.RowIndex < mouseDownRow.RowIndex || row.RowIndex > currRow.RowIndex))
- )
- {
- row.IsSelected = false;
- foreach (PDataColumn col in row.DataColumnList)
- {
-
- if (col.CrossRowCell != null)
- {
- if (!currRow.DataColumnList.Any(c => c.CrossRowCell != null && c.CrossRowCell.RowIndex == col.CrossRowCell.RowIndex && c.CellIndex == col.CrossRowCell.CellIndex))
- {
- col.CrossRowCell.IsSelected = false;
- this.DrawColumnCell(g, row, col.CrossRowCell);
- }
- }
- }
- this.DrawColumn(g, row.RowRectangle, row, true);
- delSelectRowList.Add(row);
- }
- }
-
- }
- }
-
- if (delSelectRowList.Count > 0)
- {
- delSelectRowList.ForEach(row =>
- {
- this.oldSelectRowList.RemoveAll(r => r.RowIndex == row.RowIndex);
- });
- delSelectRowList.Clear();
- }
- if (this.oldSelectRowList.Any(r => r.RowIndex == currRow.RowIndex))
- {
- if (this.isControl && isMouseDownRow)
- {
- if (currRow.IsSelected)
- {
- currRow.IsSelected = false;
- this.DrawColumn(g, currRow.RowRectangle, currRow, true);
-
- this.oldSelectRowList.RemoveAll(r => r.RowIndex == currRow.RowIndex);
- bool isDeleteCrossRowCell = true;
- currRow.DataColumnList.FindAll(c => c.CrossRowCell != null).ForEach(c=> {
- if (this.oldSelectRowList.Any(r => r.DataColumnList.Any(c2 => c2.CrossRowCell != null && c2.CrossRowCell.RowIndex == c.CrossRowCell.RowIndex)))
- {
- isDeleteCrossRowCell = false;
- }
- });
- if (isDeleteCrossRowCell)
- {
- foreach (PDataColumn col in currRow.DataColumnList)
- {
-
- if (col.CrossRowCell != null)
- {
- col.CrossRowCell.IsSelected = false;
- this.DrawColumnCell(g, currRow, col.CrossRowCell);
- }
- }
- }
- }
- }
- //return;
- }
- else
- {
- currRow.IsSelected = true;
- foreach (PDataColumn col in currRow.DataColumnList)
- {
- if (col.CrossRowCell != null)
- {
- col.CrossRowCell.IsSelected = true;
- this.DrawColumnCell(g, currRow, col.CrossRowCell);
- }
- }
- this.DrawColumn(g, currRow.RowRectangle, currRow, true);
- this.oldSelectRowList.Add(currRow);
- }
- g.Dispose();
- }
- }
- /// <summary>
- /// 上次选择单元格集合
- /// </summary>
- List<PDataColumn> oldSelectCellList = new List<PDataColumn>();
- /// <summary>
- /// 设置当前单元格选择状态
- /// </summary>
- /// <param name="currCell"></param>
- void SetSelectCellStatus(PDataColumn currCell, bool isMouseDownCell = false)
- {
- if (currCell != null)
- {
- Graphics g = this.CreateGraphics();
- List<PDataColumn> delSelectCellList = new List<PDataColumn>();
- if (!this.isControl&& isMouseDownCell)
- {
- foreach (PDataColumn cell in this.oldSelectCellList)
- {
- if (!cell.CellRectangle.Contains(currCell.CellRectangle))
- {
- PDataRow row = this.dataRowList.Find(r => r.RowIndex == cell.RowIndex);
- if (row != null)
- {
- cell.IsSelected = false;
- this.DrawColumnCell(g, row, cell);
- delSelectCellList.Add(cell);
- }
- }
- }
- }
- if (delSelectCellList.Count > 0)
- {
- delSelectCellList.ForEach(cell =>
- {
- this.oldSelectCellList.RemoveAll(c => c.CellRectangle.Contains(cell.CellRectangle));
- });
- delSelectCellList.Clear();
- }
- if (this.oldSelectCellList.Any(c => c.CellRectangle.Contains(currCell.CellRectangle)||(currCell.CrossRowCell!=null&&c.CellRectangle.Contains(currCell.CrossRowCell.CellRectangle))))
- {
- if (this.isControl && isMouseDownCell)
- {
- if (currCell.CrossRowCell != null)
- {
- if (currCell.CrossRowCell.IsSelected)
- {
- currCell.CrossRowCell.IsSelected = false;
- PDataRow row = this.dataRowList.Find(r => r.RowIndex == currCell.CrossRowCell.RowIndex);
- this.DrawColumnCell(g, row, currCell.CrossRowCell);
- this.oldSelectCellList.RemoveAll(c => c.CellRectangle.Contains(currCell.CrossRowCell.CellRectangle));
- }
- }
- else
- {
- if (currCell.IsSelected)
- {
- currCell.IsSelected = false;
- PDataRow row = this.dataRowList.Find(r => r.RowIndex == currCell.RowIndex);
- this.DrawColumnCell(g, row, currCell);
- this.oldSelectCellList.RemoveAll(c => c.CellRectangle.Contains(currCell.CellRectangle));
- }
- }
- }
-
- }
- else
- {
- if (currCell.CrossRowCell != null)
- {
- currCell.CrossRowCell.IsSelected = true;
- PDataRow row = this.dataRowList.Find(r => r.RowIndex == currCell.CrossRowCell.RowIndex);
- this.DrawColumnCell(g, row, currCell.CrossRowCell);
- this.oldSelectCellList.Add(currCell.CrossRowCell);
- }
- else {
- currCell.IsSelected = true;
- PDataRow row = this.dataRowList.Find(r => r.RowIndex == currCell.RowIndex);
- this.DrawColumnCell(g, row, currCell);
- this.oldSelectCellList.Add(currCell);
- }
-
- }
- g.Dispose();
- }
- }
- /// <summary>
- /// 鼠标按下时的位置
- /// </summary>
- Point mouseDownPoint = new Point();
- bool isSizeWE = false;
- PDataRow mouseDownRow = null;
- PDataColumn mouseDownCell = null;
- private void _tableContent_MouseDown(object sender, MouseEventArgs e)
- {
- mouseDownPoint = this.ConvertMousePoint(e.Location);
- this._tableContainer.Focus();
-
- if (this.Cursor == Cursors.SizeWE)
- {
- this.isSizeWE = true;
- }
- if (e.Button == MouseButtons.Left)
- {
- this.mouseDownRow = this.dataRowList.Find(r => r.RowRectangle.Contains(mouseDownPoint));
- if (this.mouseDownRow != null)
- {
- if (this.isFullSelectRow)
- {
- this.SetSelectRowStatus(this.mouseDownRow, true);
- }
- else
- {
- this.mouseDownCell = this.mouseDownRow.DataColumnList.Find(c => c.CellRectangle.Contains(mouseDownPoint));
- if (this.mouseDownCell!=null)
- {
- this.SetSelectCellStatus(this.mouseDownCell, true);
- }
- }
- }
- }
- this.isControl = false;
- }
- Rectangle currentMoveRectangle = new Rectangle(0, 0, 1, 1);
- private void _tableContent_MouseMove(object sender, MouseEventArgs e)
- {
- Point mouseLocation = this.ConvertMousePoint(e.Location);
- PDataColumn cell = this.headColumnRow.DataColumnList.Find(c => c.CellRectangle.Contains(mouseLocation));
- if (cell != null)
- {
- if (mouseLocation.X > cell.CellRectangle.X + cell.CellRectangle.Width - 5)
- {
- this.Cursor = Cursors.SizeWE;
- }
- else
- {
- if (e.Button != MouseButtons.Left)
- {
- this.Cursor = Cursors.Default;
- }
- }
- }
- else
- {
- this.Cursor = Cursors.Default;
- }
- if (!this.currentMoveRectangle.Contains(mouseLocation))
- {
- this.currentMoveRectangle = new Rectangle(mouseLocation.X - 5, mouseLocation.Y - 5, 10, 10);
- DataEventArgs dataEvent = this.GetDataEventArgs(mouseLocation, e.Button);
- if (dataEvent != null)
- {
- dataEvent.CurrentThumbtack = this.GetMouseSelectThumbtack(dataEvent.CurrentCell, mouseLocation);
- if (dataEvent.CurrentThumbtack != null)
- {
- if (this.EventCellThumbtack_MouseEnter != null)
- {
- this.EventCellThumbtack_MouseEnter(this, dataEvent);
- }
- }
- else
- {
- if (this.EventCell_MouseEnter != null)
- {
- this.EventCell_MouseEnter(this, dataEvent);
- }
- }
- }
- }
- if (e.Button == MouseButtons.Left)
- {
- if (this.isMultipleSelection)
- {
- PDataRow mouseMoveRow = this.dataRowList.Find(r => r.RowRectangle.Contains(mouseLocation));
- if (mouseMoveRow != null)
- {
- if (this.isFullSelectRow)
- {
- this.SetSelectRowStatus(mouseMoveRow);
- }
- else {
- PDataColumn tempCell = mouseMoveRow.DataColumnList.Find(c=>c.CellRectangle.Contains(mouseLocation));
- this.SetSelectCellStatus(tempCell);
- }
- }
-
- }
- }
- }
- bool isMultipleSelection = true;
- bool isFullSelectRow = true;
- private PDataRow headColumnRow = new PDataRow(true);
- private List<PDataRow> dataRowList = new List<PDataRow>();
- private void _tableContent_Paint(object sender, PaintEventArgs e)
- {
- // this._tableContent.SuspendLayout();
- this.DrawDataTableView(e.Graphics);
- // this._tableContent.ResumeLayout();
- }
- private void _tableContainer_Paint(object sender, PaintEventArgs e)
- {
- this.Refresh();
- }
- public void RefreshTableView()
- {
- this.Width = this.headColumnRow.DataColumnList.Sum(c => c.Width) + 10;
- this.Height = this.dataRowList.Sum(r => r.Height) + this.headColumnRow.Height + 10;
- this._PanelTableTitle.Width = this.Width;
- this._PanelTableTitle.Height = this.headColumnRow.Height+2;
- foreach (PDataRow row in this.oldSelectRowList)
- {
- row.IsSelected = false;
- }
- this.oldSelectRowList.Clear();
- if (this.Height > 65530)
- {
- MessageBoxCustom.Show("数据内容超过可显示范围,请减少显示数据的行数并做分页处理.");
- }
- //最大高度为 65530
- this.Refresh();
- // this._tableContent.Update();
- //this._tableContent.Refresh();
- }
- Rectangle baseRec = new Rectangle(2, 2, 100, 32);
- private void _PanelTableTitle_Paint(object sender, PaintEventArgs e)
- {
- this._PanelTableTitle.Location = new Point(this._PanelTableTitle.Location.X, 0);
- this.DrawHeadColumn(e.Graphics, baseRec);
-
- }
- private void _tableContainer_Scroll(object sender, ScrollEventArgs e)
- {
-
- }
- void DrawDataTableView(Graphics g)
- {
- this._PanelTableTitle.Location = new Point(this._PanelTableTitle.Location.X, 0);
- //列标题
- Graphics titleG = this._PanelTableTitle.CreateGraphics();
- this.DrawHeadColumn(titleG, baseRec);
- titleG.Dispose();
- this.DrawHeadColumn(g, baseRec);
- //数据内容
- this.DrawDataColumn(g, baseRec);
- }
- /// <summary>
- /// 画表格数据
- /// </summary>
- /// <param name="g"></param>
- /// <param name="rec"></param>
- void DrawDataColumn(Graphics g, Rectangle rec)
- {
- Rectangle rowRec = new Rectangle(rec.X, rec.Y, 0, this.headColumnRow.Height);
- /*this.dataRowList.ForEach(row=>{
- rowRec = new Rectangle(rowRec.X, rowRec.Y + rowRec.Height, 0, row.Height);
- row.RowRectangle = new Rectangle(rowRec.X, rowRec.Y, this.headColumnRow.RowRectangle.Width, this.headColumnRow.Height);
- row.RowIndex = this.dataRowList.IndexOf(row);
- this.DrawColumn(g, rowRec, row);
- });*/
- int VerticalScrollValue = this._tableContainer.VerticalScroll.Value;
- Point tempLocation = new Point(rec.X, rec.Y+ VerticalScrollValue+ this.headColumnRow.Height+5);
- PDataRow locationRow = this.dataRowList.Find(c => c.RowRectangle.Contains(tempLocation));
- int locationRowIndex = 0;
- if (locationRow != null&& this.dataRowList.Count>0)
- {
- locationRowIndex = this.dataRowList.IndexOf(locationRow);
- }
-
- for (int i = 0; i < this.dataRowList.Count; i++)
- {
- PDataRow row = this.dataRowList[i];
- rowRec = new Rectangle(rowRec.X, rowRec.Y + rowRec.Height, 0, row.Height);
- row.RowRectangle = new Rectangle(rowRec.X, rowRec.Y, this.headColumnRow.RowRectangle.Width, rowRec.Height);
- row.RowIndex = i;
- this.DrawColumn(g, rowRec, row, VerticalScrollValue, locationRowIndex);
- }
- }
- /// <summary>
- /// 画行
- /// </summary>
- /// <param name="g"></param>
- /// <param name="rec"></param>
- /// <param name="row"></param>
- /// <param name="verticalScrollValue"></param>
- /// <param name="locationRowIndex"></param>
- void DrawColumn(Graphics g, Rectangle rec, PDataRow row,int verticalScrollValue, int locationRowIndex)
- {
- bool isDraw = true;
- #region 为了提高性能,判断当前行是否需要绘画单元格,不在显示区域内的单元格不绘制
- if (locationRowIndex > 1)
- {
- locationRowIndex = locationRowIndex - 1;
- }
- else {
- locationRowIndex = 0;
- }
- if (row.RowIndex < locationRowIndex)
- {
- PDataColumn tempCell = row.DataColumnList.Find(c=>c.CrossRowCell!=null);
- if (tempCell != null)
- {
- if (tempCell.RowIndex+tempCell.CrossRow < locationRowIndex)
- {
- isDraw = false;
- }
- }
- else
- {
- isDraw = false;
- }
- }
- if (row.RowRectangle.Y+row.Height > this._tableContainer.Height + this._tableContainer.Height / 2 + verticalScrollValue)
- {
- isDraw = false;
- }
- #endregion;
- this.DrawColumn(g,rec,row,isDraw);
- }
- /// <summary>
- /// 画行
- /// </summary>
- /// <param name="g"></param>
- /// <param name="rec"></param>
- /// <param name="row"></param>
- /// <param name="isDraw"></param>
- void DrawColumn(Graphics g, Rectangle rec, PDataRow row, bool isDraw)
- {
- Rectangle cellRec = new Rectangle(rec.X, rec.Y, 0, row.Height);
- for (int i = 0; i < this.headColumnRow.DataColumnList.Count; i++)
- {
- PDataColumn headCell = this.headColumnRow.DataColumnList[i];
- PDataColumn cell = null;
- if (i < row.DataColumnList.Count)
- {
- cell = row.DataColumnList[i];
- }
- else
- {
- cell = new PDataColumn();
- }
- cell.Width = headCell.Width;
- cell.Height = row.Height;
- cell.CellIndex = i;
- cell.RowIndex = row.RowIndex;
- cellRec = new Rectangle(cellRec.X + cellRec.Width, cellRec.Y, cell.Width, cell.Height);
- cell.CellRectangle = cellRec;
- #region 跨行 跨列处理
- if (cell.CrossRow > 1)
- {
- cell.Height = this.GetCrossRowHeight(row, cell);
- cell.CellRectangle = new Rectangle(cellRec.X, cellRec.Y, cellRec.Width, cell.Height);
- }
- if (cell.CrossColumn > 1)
- {
- cell.Width = this.GetCrossColumnWidth(row, cell);
- cell.CellRectangle = new Rectangle(cell.CellRectangle.X, cell.CellRectangle.Y, cell.Width, cell.CellRectangle.Height);
- }
- if (cell.CrossRow > 1 && cell.CrossColumn > 1)
- {
- this.SetIgnoreDrawColumn(row, cell);
- }
- bool isIgnoreDraw = cell.IsIgnoreDraw;
- #endregion
- if ((!isIgnoreDraw && isDraw)|| cell.CrossRow>1)
- {
- this.DrawColumnCell(g, row, cell);
- }
- }
- }
- public void RefreshCell(PDataRow row, PDataColumn cell)
- {
- Graphics g = this.CreateGraphics();
- this.DrawColumnCell(g,row,cell);
- g.Dispose();
- }
- /// <summary>
- /// 画单元格
- /// </summary>
- /// <param name="g"></param>
- /// <param name="row"></param>
- /// <param name="cell"></param>
- void DrawColumnCell(Graphics g, PDataRow row, PDataColumn cell)
- {
- Pen borderPen = new Pen(Brushes.White, 2);
- int tempBorderWidth = this.headColumnRow.IsRowBorderStyle ? this.headColumnRow.BorderWidth : cell.BorderWidth;
- borderPen = new Pen(new SolidBrush(row.IsRowBorderStyle ? row.BorderColor : cell.BorderColor), tempBorderWidth);
- Brush brush = new SolidBrush(row.IsRowBackColor ? row.BackgroundColor : cell.BackgroundColor);
- // if (cell.CrossRow <= 1)
- {
- if ((this.IsFullSelectRow && row.IsSelected) || cell.IsSelected)
- {
- brush = new SolidBrush(row.IsRowBackColor ? row.SelectBackgroundColor : cell.SelectBackgroundColor);
- }
- }
- g.DrawRectangle(borderPen, cell.CellRectangle);
- RectangleF fillRec = new RectangleF(cell.CellRectangle.X + tempBorderWidth / 2.0f, cell.CellRectangle.Y + tempBorderWidth / 2.0f, cell.CellRectangle.Width - tempBorderWidth, cell.CellRectangle.Height - tempBorderWidth);
- g.FillRectangle(brush, fillRec);
- RectangleF layoutRectangle = fillRec;
- StringFormat format = new StringFormat();
- format.Alignment = cell.TextAlignment;
- format.LineAlignment = cell.TextLineAlignment;
- if (cell.Width > 2)
- {
- bool isDrawText = true;
- if (this.EventCell_DrawColumn != null)
- {
- DrawCellEventArgs eData = new DrawCellEventArgs(row, cell);
- eData.TextColor = row.IsRowTextFont ? row.TextColor : cell.TextColor;
- eData.TextFont = row.IsRowTextFont ? row.TextFont : cell.TextFont;
- eData.Brush = new SolidBrush(eData.TextColor);
- eData.LayoutRectangle = layoutRectangle;
- eData.Format = format;
- eData.G = g;
- eData.BorderWidth = tempBorderWidth;
- eData.BorderColor = row.IsRowBorderStyle ? row.BorderColor : cell.BorderColor;
-
- isDrawText = this.EventCell_DrawColumn(this, eData);
- }
- if (isDrawText)
- {
- g.DrawString(String.Format("{0}", cell.Text), row.IsRowTextFont ? row.TextFont : cell.TextFont, new SolidBrush(row.IsRowTextFont ? row.TextColor : cell.TextColor), layoutRectangle, format);
- }
- if (cell.ThumbtackList != null && cell.ThumbtackList.Count > 0)
- {
- this.DrawCellThumbtack(g, cell);
- }
- }
-
- }
- /// <summary>
- /// 画图钉
- /// </summary>
- /// <param name="g"></param>
- /// <param name="cell"></param>
- void DrawCellThumbtack(Graphics g, PDataColumn cell)
- {
- int i = 0;
- foreach (ThumbtackData itme in cell.ThumbtackList)
- {
- if (itme != null && !itme.IsNullThumbtackText)
- {
- //画图钉
- Rectangle destRect = new Rectangle(cell.CellRectangle.X + cell.CellRectangle.Width - (28+i*26), cell.CellRectangle.Y+3, 24, 24);
- itme.ThumbtackRectangle = destRect;
- Rectangle srcRect;
- if (destRect.X > cell.CellRectangle.X)
- {
- switch (itme.ThumbtackType)
- {
- case 1:
- srcRect = new Rectangle(0, 0, LYFZ.ComponentLibrary.Properties.Resources.TuDing4_0.Width, LYFZ.ComponentLibrary.Properties.Resources.TuDing4_0.Height);
- g.DrawImage(LYFZ.ComponentLibrary.Properties.Resources.TuDing4_0, destRect, srcRect, GraphicsUnit.Pixel);
- break;
- default:
- srcRect = new Rectangle(0, 0, LYFZ.ComponentLibrary.Properties.Resources.TuDing1.Width, LYFZ.ComponentLibrary.Properties.Resources.TuDing1.Height);
- g.DrawImage(LYFZ.ComponentLibrary.Properties.Resources.TuDing1, destRect, srcRect, GraphicsUnit.Pixel);
- break;
- }
- }
- i++;
- }
- }
- }
- /// <summary>
- /// 设置跨行跨列时 要忽略的单元格
- /// </summary>
- /// <param name="row"></param>
- /// <param name="cell"></param>
- void SetIgnoreDrawColumn(PDataRow row, PDataColumn cell)
- {
- for (int i = 1; i < cell.CrossRow; i++)
- {
- int tempIndex = row.RowIndex + i;
- if (tempIndex < this.dataRowList.Count)
- {
- PDataRow tempRow = this.dataRowList[tempIndex];
- for (int j = 1; j < cell.CrossColumn; j++)
- {
- int tempCellIndex = cell.CellIndex + j;
- if (tempCellIndex < this.headColumnRow.DataColumnList.Count)
- {
- PDataColumn tempCell = tempRow.DataColumnList[tempCellIndex];
- tempCell.IsIgnoreDraw = true;
- }
- }
- }
- }
- }
- /// <summary>
- /// 获取 跨列后的宽度
- /// </summary>
- /// <param name="row"></param>
- /// <param name="cell"></param>
- /// <returns></returns>
- int GetCrossColumnWidth(PDataRow row, PDataColumn cell)
- {
- int tWidth = cell.Width;
- for (int i = 1; i < cell.CrossColumn; i++)
- {
- int tempIndex = cell.CellIndex + i;
- if (tempIndex < this.headColumnRow.DataColumnList.Count)
- {
- PDataColumn tempCell = row.DataColumnList[tempIndex];
- tWidth += this.headColumnRow.DataColumnList[tempIndex].Width;
- tempCell.IsIgnoreDraw = true;
- }
- }
- return tWidth;
- }
- /// <summary>
- /// 获取 跨行后的高度
- /// </summary>
- /// <param name="row"></param>
- /// <param name="cell"></param>
- /// <returns></returns>
- int GetCrossRowHeight(PDataRow row,PDataColumn cell)
- {
- int tHeight = row.Height;
- cell.CrossRowCell = cell;
- for (int i = 1; i < cell.CrossRow; i++)
- {
- int tempIndex = row.RowIndex + i;
- if (tempIndex < this.dataRowList.Count)
- {
- PDataRow tempRow = this.dataRowList[tempIndex];
- tHeight += tempRow.Height;
- PDataColumn tempCell = tempRow.DataColumnList[cell.CellIndex];
- tempCell.IsIgnoreDraw = true;
- tempCell.CrossRowCell = cell;
- }
- }
- return tHeight;
- }
- /// <summary>
- /// 画列标题
- /// </summary>
- /// <param name="g"></param>
- void DrawHeadColumn(Graphics g, Rectangle rec)
- {
- Pen borderPen = new Pen(Brushes.White, 2);
- Rectangle cellRec = new Rectangle(rec.X, rec.Y, 0, 0);
- float rowWidth = 0;
- for (int i = 0; i < this.headColumnRow.DataColumnList.Count; i++)
- {
- PDataColumn cell = this.headColumnRow.DataColumnList[i];
- cell.Height = this.headColumnRow.Height;
- cell.CellIndex = i;
- cell.RowIndex = 0;
- int tempBorderWidth = this.headColumnRow.IsRowBorderStyle ? this.headColumnRow.BorderWidth : cell.BorderWidth;
- borderPen = new Pen(new SolidBrush(this.headColumnRow.IsRowBorderStyle ? this.headColumnRow.BorderColor : cell.BorderColor), tempBorderWidth);
- cellRec = new Rectangle(cellRec.X + cellRec.Width, cellRec.Y, cell.Width, cell.Height);
- cell.CellRectangle = cellRec;
- g.DrawRectangle(borderPen, cellRec);
- Brush brush = new SolidBrush(this.headColumnRow.IsRowBackColor ? this.headColumnRow.BackgroundColor : cell.BackgroundColor);
- RectangleF fillRec = new RectangleF(cellRec.X + tempBorderWidth / 2.0f, cellRec.Y + tempBorderWidth / 2.0f, cellRec.Width - tempBorderWidth, cellRec.Height - tempBorderWidth);
- g.FillRectangle(brush, fillRec);
- RectangleF layoutRectangle = fillRec;
- StringFormat format = new StringFormat();
- format.Alignment = cell.TextAlignment;
- format.LineAlignment = cell.TextLineAlignment;
- if (cell.Width > 2)
- {
- bool isDrawText = true;
- if (this.EventCell_DrawHeadColumn != null)
- {
- DrawCellEventArgs eData = new DrawCellEventArgs(this.headColumnRow, cell);
- eData.TextColor = this.headColumnRow.IsRowTextFont ? this.headColumnRow.TextColor : cell.TextColor;
- eData.TextFont = this.headColumnRow.IsRowTextFont ? this.headColumnRow.TextFont : cell.TextFont;
- eData.BorderWidth = tempBorderWidth;
- eData.BorderColor = this.headColumnRow.IsRowBorderStyle ? this.headColumnRow.BorderColor : cell.BorderColor;
- eData.Brush = new SolidBrush(eData.TextColor);
- eData.LayoutRectangle = layoutRectangle;
- eData.Format = format;
- eData.G = g;
- isDrawText = this.EventCell_DrawHeadColumn(this, eData);
- }
- if (isDrawText)
- {
- g.DrawString(String.Format("{0}", cell.Text), this.headColumnRow.IsRowTextFont ? this.headColumnRow.TextFont : cell.TextFont, new SolidBrush(this.headColumnRow.IsRowTextFont ? this.headColumnRow.TextColor : cell.TextColor), layoutRectangle, format);
- }
- if (cell.ThumbtackList != null && cell.ThumbtackList.Count > 0)
- {
- this.DrawCellThumbtack(g, cell);
- }
- }
- rowWidth = fillRec.X + fillRec.Width;
- }
- this.headColumnRow.RowRectangle = new Rectangle(rec.X, rec.Y, Convert.ToInt32(rowWidth), this.headColumnRow.Height);
- }
- public event DataEventArgsHandler EventCellThumbtack_MouseEnter;
- public event DataEventArgsHandler EventCellThumbtack_Click;
- public event DataEventArgsHandler EventCellThumbtack_DoubleClick;
- public event DataEventArgsHandler EventCell_MouseEnter;
- public event DataEventArgsHandler EventCell_Click;
- public event DataEventArgsHandler EventCell_DoubleClick;
- public event DrawCellEventArgsHandler EventCell_DrawHeadColumn;
- public event DrawCellEventArgsHandler EventCell_DrawColumn;
- // 申明委托
- public delegate void DataEventArgsHandler(Panel viewPanel, DataEventArgs e);
- public delegate bool DrawCellEventArgsHandler(Panel viewPanel, DrawCellEventArgs e);
- /// <summary>
- /// 列表题行
- /// </summary>
- [Browsable(false)]
- public PDataRow HeadColumnRow { get => headColumnRow; set => headColumnRow = value; }
- /// <summary>
- /// 行集合
- /// </summary>
- [Browsable(false)]
- public List<PDataRow> DataRowList { get => dataRowList; set => dataRowList = value; }
- /// <summary>
- /// 选择行时 是否可以多选
- /// </summary>
- public bool IsMultipleSelection { get => isMultipleSelection; set => isMultipleSelection = value; }
- /// <summary>
- /// 选择时是按整行选择还是按单元格选择
- /// </summary>
- public bool IsFullSelectRow { get => isFullSelectRow; set => isFullSelectRow = value; }
- }
- public class DataEventArgs : EventArgs
- {
- public DataEventArgs() {
- }
- public DataEventArgs(PDataRow row, PDataColumn cell,Point mousePoint, MouseButtons button,bool isHeadRow=false)
- {
- this.button = button;
- this._crrrentRow = row;
- this._currentCell = cell;
- this.MousePoint = mousePoint;
- this._isHeadRow = isHeadRow;
- }
- bool _isHeadRow = false;
- private MouseButtons button = MouseButtons.Left;
- ThumbtackData _currentThumbtack;
- PDataColumn _currentCell;
- PDataRow _crrrentRow;
- Point _MousePoint = new Point();
- public PDataColumn CurrentCell { get => _currentCell; set => _currentCell = value; }
- public PDataRow CrrrentRow { get => _crrrentRow; set => _crrrentRow = value; }
- public Point MousePoint { get => _MousePoint; set => _MousePoint = value; }
- /// <summary>
- /// 当前图钉
- /// </summary>
- public ThumbtackData CurrentThumbtack { get => _currentThumbtack; set => _currentThumbtack = value; }
- public MouseButtons Button { get => button; set => button = value; }
- /// <summary>
- /// 是否为头部标题行
- /// </summary>
- public bool IsHeadRow { get => _isHeadRow; set => _isHeadRow = value; }
- }
- /// <summary>
- /// 绘画单元格
- /// </summary>
- public class DrawCellEventArgs : EventArgs
- {
- public DrawCellEventArgs()
- {
- }
- public DrawCellEventArgs(PDataRow row, PDataColumn cell)
- {
- this._crrrentRow = row;
- this._currentCell = cell;
- }
- Color borderColor = Color.FromArgb(215, 228, 242);
- int borderWidth = 1;
- Color textColor = Color.Black;
- Font textFont = new Font("微软雅黑", 10, FontStyle.Regular);
- SolidBrush brush;
- Graphics g;
- RectangleF layoutRectangle = new RectangleF();
- StringFormat format = new StringFormat();
- PDataColumn _currentCell;
- PDataRow _crrrentRow;
-
- public PDataColumn CurrentCell { get => _currentCell; set => _currentCell = value; }
- public PDataRow CrrrentRow { get => _crrrentRow; set => _crrrentRow = value; }
- public SolidBrush Brush { get => brush; set => brush = value; }
- public Graphics G { get => g; set => g = value; }
- public RectangleF LayoutRectangle { get => layoutRectangle; set => layoutRectangle = value; }
- public StringFormat Format { get => format; set => format = value; }
- public Color BorderColor { get => borderColor; set => borderColor = value; }
- public int BorderWidth { get => borderWidth; set => borderWidth = value; }
- public Color TextColor { get => textColor; set => textColor = value; }
- public Font TextFont { get => textFont; set => textFont = value; }
- }
- /// <summary>
- /// 行数据
- /// </summary>
- [Serializable]
- public class PDataRow
- {
- public PDataRow(bool isHeadColumnRow=false)
- {
- if (isHeadColumnRow)
- {
- this.isRowBackColor = true;
- this.isRowTextFont = true;
- this.isRowBorderStyle = true;
- }
- }
- int height = 32;
- int rowIndex = 0;
-
- bool isSelected = false;
- bool isRowBackColor = false;
- bool isRowTextFont = false;
- bool isRowBorderStyle = false;
-
- Color selectBackgroundColor = Color.FromArgb(234, 234, 234);//Color.FromArgb(90, 120, 255);
- Color backgroundColor = Color.FromArgb(90, 158, 203);
- Color borderColor = Color.FromArgb(215, 228, 242);
- int borderWidth = 1;
- Color textColor = Color.White;
- Font textFont = new Font("微软雅黑", 10, FontStyle.Bold);
- Rectangle rowRectangle = new Rectangle();
- object tag;
- private List<PDataColumn> dataColumnList = new List<PDataColumn>();
- /// <summary>
- /// 数据单元格集合
- /// </summary>
- public List<PDataColumn> DataColumnList { get => dataColumnList; set => dataColumnList = value; }
- public int Height { get => height; set => height = value; }
- public int RowIndex { get => rowIndex; set => rowIndex = value; }
- public bool IsSelected { get => isSelected; set => isSelected = value; }
- public bool IsRowBackColor { get => isRowBackColor; set => isRowBackColor = value; }
- public bool IsRowTextFont { get => isRowTextFont; set => isRowTextFont = value; }
- public Color SelectBackgroundColor { get => selectBackgroundColor; set => selectBackgroundColor = value; }
- public Color BackgroundColor { get => backgroundColor; set => backgroundColor = value; }
- public Color TextColor { get => textColor; set => textColor = value; }
- public Font TextFont { get => textFont; set => textFont = value; }
- public Rectangle RowRectangle { get => rowRectangle; set => rowRectangle = value; }
- public object Tag { get => tag; set => tag = value; }
- public Color BorderColor { get => borderColor; set => borderColor = value; }
- public int BorderWidth { get => borderWidth; set => borderWidth = value; }
- public bool IsRowBorderStyle { get => isRowBorderStyle; set => isRowBorderStyle = value; }
- }
- /// <summary>
- /// 数据单元格
- /// </summary>
- [Serializable]
- public class PDataColumn
- {
- public PDataColumn()
- {
- }
- string name = "";
- string text = "";
- int width = 100;
- int height = 32;
- int cellIndex = 0;
- int rowIndex = 0;
- int crossRow = 1;
- int crossColumn = 1;
- bool isIgnoreDraw = false;
- bool isSelected = false;
- Color selectBackgroundColor = Color.FromArgb(234, 234, 234);
- Color backgroundColor = Color.FromArgb(255, 255, 255);
- Color borderColor = Color.FromArgb(215, 228, 242);
-
- Color textColor = Color.Black;
-
- Font textFont = new Font("微软雅黑", 10, FontStyle.Regular);
- Rectangle cellRectangle = new Rectangle();
- StringAlignment textAlignment = StringAlignment.Center;
- StringAlignment textLineAlignment = StringAlignment.Center;
- int borderWidth = 1;
- PDataColumn crossRowCell;
- object tag;
- DateTime dateTimeTag;
- List<ThumbtackData> _ThumbtackList = new List<ThumbtackData>();
- public string Name { get => name; set => name = value; }
- public string Text { get => text; set => text = value; }
- public int Width { get => width; set => width = value; }
- public int Height { get => height; set => height = value; }
- public object Tag { get => tag; set => tag = value; }
- public Color BackgroundColor { get => backgroundColor; set => backgroundColor = value; }
- public Color BorderColor { get => borderColor; set => borderColor = value; }
- public Color TextColor { get => textColor; set => textColor = value; }
- public Font TextFont { get => textFont; set => textFont = value; }
- public int BorderWidth { get => borderWidth; set => borderWidth = value; }
- public bool IsSelected { get => isSelected; set => isSelected = value; }
- public Color SelectBackgroundColor { get => selectBackgroundColor; set => selectBackgroundColor = value; }
- /// <summary>
- /// 文字水平对齐方式
- /// </summary>
- public StringAlignment TextAlignment { get => textAlignment; set => textAlignment = value; }
- /// <summary>
- /// 文字垂直对齐方式
- /// </summary>
- public StringAlignment TextLineAlignment { get => textLineAlignment; set => textLineAlignment = value; }
- /// <summary>
- /// 单元格区域
- /// </summary>
- public Rectangle CellRectangle { get => cellRectangle; set => cellRectangle = value; }
- public int CellIndex { get => cellIndex; set => cellIndex = value; }
- public int RowIndex { get => rowIndex; set => rowIndex = value; }
- /// <summary>
- /// 跨行 数
- /// </summary>
- public int CrossRow { get => crossRow; set => crossRow = value; }
- /// <summary>
- /// 跨列 数
- /// </summary>
- public int CrossColumn { get => crossColumn; set => crossColumn = value; }
- /// <summary>
- /// 是否被忽略,不显示 一般用于跨行 跨列时
- /// </summary>
- public bool IsIgnoreDraw { get => isIgnoreDraw; set => isIgnoreDraw = value; }
- /// <summary>
- /// 跨行单元格
- /// </summary>
- public PDataColumn CrossRowCell { get => crossRowCell; set => crossRowCell = value; }
- /// <summary>
- /// 图钉集合
- /// </summary>
- public List<ThumbtackData> ThumbtackList { get => _ThumbtackList; set => _ThumbtackList = value; }
- /// <summary>
- /// 时间附加参数
- /// </summary>
- public DateTime DateTimeTag { get => dateTimeTag; set => dateTimeTag = value; }
- }
- /// <summary>
- /// 图钉数据
- /// </summary>
- [Serializable]
- public class ThumbtackData
- {
- public ThumbtackData()
- {
- }
- Rectangle _ThumbtackRectangle = new Rectangle();
- string _ThumbtackText = "";
- int _ThumbtackType = 0;
- object _Tag = null;
- public Rectangle ThumbtackRectangle { get => _ThumbtackRectangle; set => _ThumbtackRectangle = value; }
- public string ThumbtackText { get => _ThumbtackText; set => _ThumbtackText = value; }
- public object Tag { get => _Tag; set => _Tag = value; }
- /// <summary>
- /// 图钉类型 0 为普通图钉 1 为公休图钉 2 为摄控本日历图钉
- /// </summary>
- public int ThumbtackType { get => _ThumbtackType; set => _ThumbtackType = value; }
- /// <summary>
- /// 图钉内容是否为空
- /// </summary>
- public bool IsNullThumbtackText
- {
- get { return String.IsNullOrWhiteSpace(this._ThumbtackText); }
- }
- }
- }
|