/// <summary> /// constructor /// </summary> /// <param name="ADataGrid"></param> /// <param name="ADataColumn"></param> /// <param name="ACaption"></param> /// <param name="ADataCell"></param> public TSgrdTextColumn(SourceGrid.DataGrid ADataGrid, System.Data.DataColumn ADataColumn, string ACaption, SourceGrid.Cells.ICellVirtual ADataCell) : this(ADataGrid, ADataColumn, ACaption, ADataCell, -1, true) { }
/// <summary> /// constructor /// </summary> /// <param name="ADataGrid"></param> /// <param name="ADataColumn"></param> /// <param name="ACaption"></param> /// <param name="ADataCell"></param> /// <param name="AColumnWidth"></param> /// <param name="ASortableHeader"></param> public TSgrdTextColumn(SourceGrid.DataGrid ADataGrid, System.Data.DataColumn ADataColumn, string ACaption, SourceGrid.Cells.ICellVirtual ADataCell, Int16 AColumnWidth, Boolean ASortableHeader) : base(ADataGrid) { HeaderCell = new SourceGrid.Cells.ColumnHeader(ACaption); if (!ASortableHeader) { ((SourceGrid.Cells.ColumnHeader)HeaderCell).AutomaticSortEnabled = false; } HeaderCell.View = ((TSgrdDataGrid)ADataGrid).ColumnHeaderView; if (ADataColumn != null) { PropertyName = ADataColumn.ColumnName; } DataCell = ADataCell; if (AColumnWidth != -1) { Width = AColumnWidth; AutoSizeMode = SourceGrid.AutoSizeMode.MinimumSize; } FGrid = ADataGrid; }
/// <summary> /// constructor /// </summary> /// <param name="ADataGrid"></param> /// <param name="ADataColumn"></param> /// <param name="ACaption"></param> /// <param name="ADataCell"></param> /// <param name="ASortableHeader"></param> public TSgrdTextColumn(SourceGrid.DataGrid ADataGrid, System.Data.DataColumn ADataColumn, string ACaption, SourceGrid.Cells.ICellVirtual ADataCell, Boolean ASortableHeader) : this(ADataGrid, ADataColumn, ACaption, ADataCell, -1, ASortableHeader) { }
/// <summary> /// constructor /// </summary> /// <param name="ADataGrid"></param> /// <param name="ACaption"></param> /// <param name="AGetImage"></param> public TSgrdImageColumn(SourceGrid.DataGrid ADataGrid, string ACaption, DelegateGetImageForRow AGetImage) : base(ADataGrid, null, ACaption, null, -1, false) { HeaderCell = new SourceGrid.Cells.ColumnHeader(ACaption); ((SourceGrid.Cells.ColumnHeader)HeaderCell).AutomaticSortEnabled = false; HeaderCell.View = ((TSgrdDataGrid)FGrid).ColumnHeaderView; PropertyName = null; DataCell = null; FGrid = ADataGrid; this.AutoSizeMode = SourceGrid.AutoSizeMode.MinimumSize; FGetImage = AGetImage; }
public System.Drawing.Image GetImage(SourceGrid.CellContext cellContext) { SourceGrid.DataGrid dg = (SourceGrid.DataGrid)cellContext.Grid; int dsRow = dg.Rows.IndexToDataSourceIndex(cellContext.Position.Row); PropertyDescriptor property = dg.DataSource.GetItemProperty(imageProperty, StringComparison.InvariantCultureIgnoreCase); byte[] buffer = (byte[])dg.DataSource.GetItemValue(dsRow, property); using (System.IO.MemoryStream stream = new System.IO.MemoryStream(buffer)) { return(System.Drawing.Image.FromStream(stream)); } }
/// <summary> /// Implementation of the required IImage method /// </summary> /// <param name="cellContext">The cell for which an image is desired</param> /// <returns>The image, or null for no image</returns> public System.Drawing.Image GetImage(CellContext cellContext) { SourceGrid.DataGrid grid = (SourceGrid.DataGrid)cellContext.Grid; DataRowView row = (DataRowView)grid.Rows.IndexToDataSourceRow(cellContext.Position.Row); if (FCallerForm.EvaluateBoundImage(FCallerContext, row)) { // The caller wants the image to be displayed return(FDisplayImage); } // No image displayed return(null); }
public string GetToolTipText(SourceGrid.CellContext cellContext) { SourceGrid.DataGrid grid = (SourceGrid.DataGrid)cellContext.Grid; DataRowView row = (DataRowView)grid.Rows.IndexToDataSourceRow(cellContext.Position.Row); if (row != null) { if (bool.Equals(row["Selected"], true)) { return("Row " + cellContext.Position.Row.ToString() + " is selected"); } else { return("Row " + cellContext.Position.Row.ToString() + " is NOT selected"); } } else { return(string.Empty); } }
/// <summary> /// Implementation of the required IToolTipText method /// </summary> /// <param name="cellContext">The cell for which an tool tip is desired</param> /// <returns>The text, which may be an empty string</returns> public string GetToolTipText(SourceGrid.CellContext cellContext) { SourceGrid.DataGrid grid = (SourceGrid.DataGrid)cellContext.Grid; DataRowView row = (DataRowView)grid.Rows.IndexToDataSourceRow(cellContext.Position.Row); if (row != null) { if (FCallerForm.EvaluateBoundImage(FCallerContext, row)) { // There is an image in this row/column if (FImageEnum == BoundGridImage.DisplayImageEnum.Inactive) { if (FCallerContext == BoundGridImage.AnnotationContextEnum.CostCentreCode) { return(Catalog.GetString("This Cost Centre code is no longer active")); } else if (FCallerContext == BoundGridImage.AnnotationContextEnum.AccountCode) { return(Catalog.GetString("This Bank Account code is no longer active")); } else if (FCallerContext == BoundGridImage.AnnotationContextEnum.AnalysisTypeCode) { return(Catalog.GetString("This Analysis Attribute type is no longer active")); } else if (FCallerContext == BoundGridImage.AnnotationContextEnum.AnalysisAttributeValue) { return(Catalog.GetString("This Analysis Attribute value is no longer active")); } else if (FCallerContext == BoundGridImage.AnnotationContextEnum.RetiredUser) { return(Catalog.GetString("This user has been retired")); } } } } return(string.Empty); }
/// <summary> /// Constructor. Create a DataGridColumn class. /// </summary> /// <param name="grid"></param> public DataGridColumn(DataGrid grid) : base(grid) { mHeaderCell = new Cells.DataGrid.ColumnHeader(string.Empty); mDataCell = new Cells.DataGrid.Cell(); }
/// <summary> /// Create a DataGridColumn with special cells used for RowHeader, usually used when FixedColumns is 1 for the first column. /// </summary> /// <param name="grid"></param> /// <returns></returns> public static DataGridColumn CreateRowHeader(DataGrid grid) { return new DataGridColumn(grid, new Cells.DataGrid.Header(), new Cells.DataGrid.RowHeader(), null); }
public DataGridColumns(DataGrid grid) : base(grid) { }
/// <summary> /// Constructor. Create a DataGridColumn class. /// </summary> public DataGridColumn(DataGrid grid, Cells.ICellVirtual headerCell, Cells.ICellVirtual dataCell, string propertyName) : base(grid) { mPropertyName = propertyName; mHeaderCell = headerCell; mDataCell = dataCell; }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.dataGrid = new SourceGrid.DataGrid(); this.label1 = new System.Windows.Forms.Label(); this.lblSelectedRow = new System.Windows.Forms.Label(); this.btFind = new System.Windows.Forms.Button(); this.txtFindName = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.SuspendLayout(); // // dataGrid // this.dataGrid.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.dataGrid.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.dataGrid.DefaultWidth = 20; this.dataGrid.DeleteQuestionMessage = "Are you sure to delete all the selected rows?"; this.dataGrid.FixedRows = 1; this.dataGrid.Location = new System.Drawing.Point(4, 30); this.dataGrid.Name = "dataGrid"; this.dataGrid.SelectionMode = SourceGrid.GridSelectionMode.Row; this.dataGrid.Size = new System.Drawing.Size(492, 205); this.dataGrid.TabIndex = 15; this.dataGrid.TabStop = true; this.dataGrid.ToolTipText = ""; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(1, 9); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(77, 13); this.label1.TabIndex = 16; this.label1.Text = "Selected Row:"; // // lblSelectedRow // this.lblSelectedRow.AutoSize = true; this.lblSelectedRow.Location = new System.Drawing.Point(85, 8); this.lblSelectedRow.Name = "lblSelectedRow"; this.lblSelectedRow.Size = new System.Drawing.Size(10, 13); this.lblSelectedRow.TabIndex = 17; this.lblSelectedRow.Text = "-"; // // btFind // this.btFind.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btFind.Location = new System.Drawing.Point(421, 1); this.btFind.Name = "btFind"; this.btFind.Size = new System.Drawing.Size(75, 23); this.btFind.TabIndex = 18; this.btFind.Text = "Find"; this.btFind.UseVisualStyleBackColor = true; this.btFind.Click += new System.EventHandler(this.btFind_Click); // // txtFindName // this.txtFindName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.txtFindName.Location = new System.Drawing.Point(315, 3); this.txtFindName.Name = "txtFindName"; this.txtFindName.Size = new System.Drawing.Size(100, 20); this.txtFindName.TabIndex = 19; // // label2 // this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(238, 6); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(68, 13); this.label2.TabIndex = 20; this.label2.Text = "Find country:"; // // frmSample41 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(500, 242); this.Controls.Add(this.label2); this.Controls.Add(this.txtFindName); this.Controls.Add(this.btFind); this.Controls.Add(this.lblSelectedRow); this.Controls.Add(this.label1); this.Controls.Add(this.dataGrid); this.Name = "frmSample41"; this.Text = "Advanced DataGrid binding (XML DataSet)"; this.Load += new System.EventHandler(this.frmSample41_Load); this.ResumeLayout(false); this.PerformLayout(); }
/// <summary> /// This method is required for Windows Forms designer support. /// Do not change the method contents inside the source code editor. The Forms designer might /// not be able to load this method if it was changed manually. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager( typeof(TFrmGLBatch)); this.lblAccountText = new System.Windows.Forms.Label(); this.lblAccountValue = new System.Windows.Forms.Label(); this.lblDateEnd = new System.Windows.Forms.Label(); this.lblDateEndValue = new System.Windows.Forms.Label(); this.lblRevCur = new System.Windows.Forms.Label(); this.lblRevCurValue = new System.Windows.Forms.Label(); grdDetails = new SourceGrid.DataGrid(); this.btnRevaluate = new System.Windows.Forms.Button(); this.btnCancel = new System.Windows.Forms.Button(); this.SuspendLayout(); int leftColStart = 32; int leftColWidth = 240; int colSpace = 15; int rowY = 5; int rowHeight = 25; int rightColWidth = 350; // int buttonTop = 210; int buttonLeft = 140; // // lblAccountText // this.lblAccountText.Location = new System.Drawing.Point(leftColStart, rowY); this.lblAccountText.Name = "lblAccountText"; this.lblAccountText.Size = new System.Drawing.Size(leftColWidth, 21); lblAccountText.TextAlign = ContentAlignment.MiddleRight; // // lblAccountValue // this.lblAccountValue.Location = new System.Drawing.Point( leftColStart + leftColWidth + colSpace, rowY); this.lblAccountValue.Name = "lblAccountValue"; this.lblAccountValue.Size = new System.Drawing.Size(144, 21); lblAccountValue.TextAlign = ContentAlignment.MiddleLeft; rowY = rowY + rowHeight; // // lblDateEnd // this.lblDateEnd.Location = new System.Drawing.Point(leftColStart, rowY); this.lblDateEnd.Name = "lblDateEnd"; this.lblDateEnd.Size = new System.Drawing.Size(leftColWidth, 21); lblDateEnd.TextAlign = ContentAlignment.MiddleRight; // // lblDateEndValue // this.lblDateEndValue.Location = new System.Drawing.Point( leftColStart + leftColWidth + colSpace, rowY); this.lblDateEndValue.Name = "lblDateEndValue"; this.lblDateEndValue.Size = new System.Drawing.Size(rightColWidth, 21); lblDateEndValue.TextAlign = ContentAlignment.MiddleLeft; rowY = rowY + rowHeight; // // lblRevCur // this.lblRevCur.Location = new System.Drawing.Point(leftColStart, rowY); this.lblRevCur.Name = "lblRevCur"; this.lblRevCur.Size = new System.Drawing.Size(leftColWidth, 21); lblRevCur.TextAlign = ContentAlignment.MiddleRight; // // lblRevCurValue // this.lblRevCurValue.Location = new System.Drawing.Point( leftColStart + leftColWidth + colSpace, rowY); this.lblRevCurValue.Name = "lblRevCurValue"; this.lblRevCurValue.Size = new System.Drawing.Size(rightColWidth, 21); lblRevCurValue.TextAlign = ContentAlignment.MiddleLeft; rowY = rowY + rowHeight; this.grdDetails.Location = new System.Drawing.Point(leftColStart, rowY); this.grdDetails.Size = new System.Drawing.Size(550, 200); grdDetails.BorderStyle = BorderStyle.FixedSingle; //grdDetails.FixedRows = 3; //grdDetails.a rowY = rowY + 230; // // btnRevaluate // this.btnRevaluate.Location = new System.Drawing.Point(buttonLeft, rowY); this.btnRevaluate.Name = "btnRevaluate"; this.btnRevaluate.Size = new System.Drawing.Size(144, 23); this.btnRevaluate.TabIndex = 2; this.btnRevaluate.Text = "Revaluate"; this.btnRevaluate.UseVisualStyleBackColor = true; // // btnCancel // this.btnCancel.Location = new System.Drawing.Point(200 + buttonLeft, rowY); this.btnCancel.Name = "btnCancel"; this.btnCancel.Size = new System.Drawing.Size(137, 23); this.btnCancel.TabIndex = 3; this.btnCancel.Text = "Cancel"; this.btnCancel.UseVisualStyleBackColor = true; // // GLRevaluation // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Font = new System.Drawing.Font("Verdana", 8.25f); this.ClientSize = new System.Drawing.Size(600, rowY + 50); this.CancelButton = btnCancel; this.Controls.Add(this.btnCancel); this.Controls.Add(this.btnRevaluate); this.Controls.Add(this.lblAccountText); this.Controls.Add(this.lblAccountValue); this.Controls.Add(this.lblDateEnd); this.Controls.Add(this.lblDateEndValue); this.Controls.Add(this.lblRevCur); this.Controls.Add(this.lblRevCurValue); this.Controls.Add(this.grdDetails); this.Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon"); this.Name = "GLRevaluation"; this.Text = "Revaluation ..."; this.ResumeLayout(false); }
public DataGridRows(DataGrid grid) : base(grid) { mHeaderHeight = grid.DefaultHeight; }
/// <summary> /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager( typeof(TFrmGLBatch)); lblAccountText = new Label(); lblAccountValue = new Label(); lblDateEnd = new Label(); lblDateEndValue = new Label(); lblRevCur = new Label(); lblRevCurValue = new Label(); lblCostCentre = new Label(); cmbCostCentres = new TCmbAutoPopulated(); grdDetails = new SourceGrid.DataGrid(); btnRevaluate = new Button(); btnCancel = new Button(); SuspendLayout(); int leftColStart = 32; int leftColWidth = 180; int colSpace = 15; int rowY = 5; int rowHeight = 25; int rightColWidth = 280; // int buttonTop = 210; int buttonLeft = 120; // // lblAccountText // lblAccountText.Location = new System.Drawing.Point(leftColStart, rowY); lblAccountText.Name = "lblAccountText"; lblAccountText.Size = new System.Drawing.Size(leftColWidth, 21); lblAccountText.TextAlign = ContentAlignment.MiddleRight; // // lblAccountValue // lblAccountValue.Location = new System.Drawing.Point(leftColStart + leftColWidth + colSpace, rowY); lblAccountValue.Name = "lblAccountValue"; lblAccountValue.Size = new System.Drawing.Size(144, 21); lblAccountValue.TextAlign = ContentAlignment.MiddleLeft; rowY = rowY + rowHeight; // // lblDateEnd // lblDateEnd.Location = new System.Drawing.Point(leftColStart, rowY); lblDateEnd.Name = "lblDateEnd"; lblDateEnd.Size = new System.Drawing.Size(leftColWidth, 21); lblDateEnd.TextAlign = ContentAlignment.MiddleRight; // // lblDateEndValue // lblDateEndValue.Location = new System.Drawing.Point(leftColStart + leftColWidth + colSpace, rowY); lblDateEndValue.Name = "lblDateEndValue"; lblDateEndValue.Size = new System.Drawing.Size(rightColWidth, 21); lblDateEndValue.TextAlign = ContentAlignment.MiddleLeft; rowY = rowY + rowHeight; // // lblRevCur // lblRevCur.Location = new System.Drawing.Point(leftColStart, rowY); lblRevCur.Name = "lblRevCur"; lblRevCur.Size = new System.Drawing.Size(leftColWidth, 21); lblRevCur.TextAlign = ContentAlignment.MiddleRight; // // lblRevCurValue // lblRevCurValue.Location = new System.Drawing.Point(leftColStart + leftColWidth + colSpace, rowY); lblRevCurValue.Name = "lblRevCurValue"; lblRevCurValue.Size = new System.Drawing.Size(rightColWidth, 21); lblRevCurValue.TextAlign = ContentAlignment.MiddleLeft; rowY = rowY + rowHeight; // // Cost Centre // lblCostCentre.Location = new System.Drawing.Point(leftColStart, rowY); lblCostCentre.Name = "lblCostCentre"; lblCostCentre.Size = new System.Drawing.Size(leftColWidth, 21); lblCostCentre.TextAlign = ContentAlignment.MiddleRight; cmbCostCentres.Location = new System.Drawing.Point(leftColStart + leftColWidth + colSpace, rowY); cmbCostCentres.Name = "clbCostCentres"; cmbCostCentres.Size = new System.Drawing.Size(rightColWidth, 22); cmbCostCentres.ListTable = TCmbAutoPopulated.TListTableEnum.UserDefinedList; rowY = rowY + rowHeight + 20; grdDetails.Location = new System.Drawing.Point(leftColStart, rowY); grdDetails.Size = new System.Drawing.Size(430, 200); grdDetails.BorderStyle = BorderStyle.FixedSingle; grdDetails.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; grdDetails.AutoStretchColumnsToFitWidth = true; rowY = rowY + 230; // // btnRevaluate // btnRevaluate.Location = new System.Drawing.Point(buttonLeft, rowY); btnRevaluate.Name = "btnRevaluate"; btnRevaluate.Size = new System.Drawing.Size(95, 23); btnRevaluate.TabIndex = 2; btnRevaluate.Text = "Revalue"; btnRevaluate.UseVisualStyleBackColor = true; // // btnCancel // btnCancel.Location = new System.Drawing.Point(150 + buttonLeft, rowY); btnCancel.Name = "btnCancel"; btnCancel.Size = new System.Drawing.Size(95, 23); btnCancel.TabIndex = 3; btnCancel.Text = "Cancel"; btnCancel.UseVisualStyleBackColor = true; // // GLRevaluation // AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); AutoScaleMode = AutoScaleMode.Font; Font = new System.Drawing.Font("Verdana", 8.25f); ClientSize = new System.Drawing.Size(500, rowY + 50); CancelButton = btnCancel; Controls.AddRange(new Control[] { btnCancel, btnRevaluate, lblAccountText, lblAccountValue, lblDateEnd, lblDateEndValue, lblRevCur, lblRevCurValue, lblCostCentre, cmbCostCentres, this.grdDetails }); Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon"); Name = "GLRevaluation"; Text = "Revaluation ..."; ResumeLayout(false); }