[Quantproject-developers] QuantProject/b5_Presentation/Reporting/WindowsForm ReportGrid.cs, 1.3, 1
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2009-03-07 04:17:11
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8294/b5_Presentation/Reporting/WindowsForm Modified Files: ReportGrid.cs Log Message: A new RightClickedTransaction event has been added (it is thrown when a transaction is right clicked on the report) Index: ReportGrid.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm/ReportGrid.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ReportGrid.cs 29 Sep 2008 21:15:57 -0000 1.3 --- ReportGrid.cs 7 Mar 2009 04:16:57 -0000 1.4 *************** *** 28,31 **** --- 28,34 ---- namespace QuantProject.Presentation.Reporting.WindowsForm { + public delegate void RightClickedTransactionEventHandler( + ReportGrid sender , int dataGridRowNumber ); + /// <summary> /// DataGrid to be displayed within a report TabPage *************** *** 34,37 **** --- 37,42 ---- public class ReportGrid : DataGrid { + public event RightClickedTransactionEventHandler RightClickedTransaction; + private ReportTable reportTable; private DataGridTableStyle dataGridStyle; *************** *** 42,45 **** --- 47,51 ---- this.DataSource = reportTable.DataTable; this.setFormat(); + this.MouseDown += new MouseEventHandler( this.mouseDownEventHandler ); } *************** *** 66,70 **** // ( DataGridTextBoxColumn )dataGridTableStyle.GridColumnStyles[ // columnIndex ]; ! //// dataGridTableStyle.GridColumnStyles.a // return dataGridTextBoxColumn; // } --- 72,76 ---- // ( DataGridTextBoxColumn )dataGridTableStyle.GridColumnStyles[ // columnIndex ]; ! //// dataGridTableStyle.GridColumnStyles.a // return dataGridTextBoxColumn; // } *************** *** 107,110 **** --- 113,140 ---- } #endregion setFormat + + #region mouseDownEventHandler + + #region handleRightClick + private int getClickedRowIndex( MouseEventArgs mouseEventArgs ) + { + DataGrid.HitTestInfo hitTestInfo = this.HitTest( + mouseEventArgs.X , mouseEventArgs.Y ); + int rowIndex = hitTestInfo.Row; + return rowIndex; + } + private void handleRightClick( object sender , MouseEventArgs mouseEventArgs ) + { + int rowIndex = this.getClickedRowIndex( mouseEventArgs ); + this.RightClickedTransaction( this , rowIndex ); + } + #endregion handleRightClick + + private void mouseDownEventHandler( object sender , MouseEventArgs mouseEventArgs ) + { + if ( mouseEventArgs.Button == MouseButtons.Right ) + this.handleRightClick( sender , mouseEventArgs ); + } + #endregion mouseDownEventHandler } } |