protected override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle clipBounds, System.Drawing.Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) { try { int progressVal = (int)value; float percentage = ((float)progressVal / 100.0f); // Need to convert to float before division; otherwise C# returns int which is 0 for anything but 100%. Brush backColorBrush = new SolidBrush(cellStyle.BackColor); Brush foreColorBrush = new SolidBrush(cellStyle.ForeColor); // Draws the cell grid base.Paint(g, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, (paintParts & ~DataGridViewPaintParts.ContentForeground)); if (percentage > 0.0) { // Draw the progress bar and the text g.FillRectangle(new SolidBrush(Color.FromArgb(203, 235, 108)), cellBounds.X + 2, cellBounds.Y + 2, Convert.ToInt32((percentage * cellBounds.Width - 4)), cellBounds.Height - 4); g.DrawString(progressVal.ToString() + "%", cellStyle.Font, foreColorBrush, cellBounds.X + (cellBounds.Width / 2) - 5, cellBounds.Y + 2); } else { g.DrawString("Ожидание...", cellStyle.Font, foreColorBrush, cellBounds.X + (cellBounds.Width / 2) - 25, cellBounds.Y + 2); } } catch (Exception e) { } }
protected override void Paint(Graphics g, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) { int progressVal = 0; if (value != null) progressVal = (int)value; float percentage = (progressVal / 100.0f); // Need to convert to float before division; otherwise C# returns int which is 0 for anything but 100%. Brush backColorBrush = new SolidBrush(cellStyle.BackColor); Brush foreColorBrush = new SolidBrush(cellStyle.ForeColor); // Draws the cell grid base.Paint(g, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, (paintParts & ~DataGridViewPaintParts.ContentForeground)); if (percentage > 0.0) { // Draw the progress bar and the text g.FillRectangle(new SolidBrush(Color.FromArgb(163, 189, 242)), cellBounds.X + 2, cellBounds.Y + 2, Convert.ToInt32((percentage * cellBounds.Width - 4)), cellBounds.Height - 4); g.DrawString(progressVal + "%", cellStyle.Font, foreColorBrush, cellBounds.X + 6, cellBounds.Y + 2); } else { // draw the text if (DataGridView.CurrentRow.Index == rowIndex) g.DrawString(progressVal + "%", cellStyle.Font, new SolidBrush(cellStyle.SelectionForeColor), cellBounds.X + 6, cellBounds.Y + 2); else g.DrawString(progressVal + "%", cellStyle.Font, foreColorBrush, cellBounds.X + 6, cellBounds.Y + 2); } }
public DataGridViewCellParsingEventArgs (int rowIndex, int columnIndex, object value, Type desiredType, DataGridViewCellStyle inheritedCellStyle) : base (value, desiredType) { this.columnIndex = columnIndex; this.rowIndex = rowIndex; this.inheritedCellStyle = inheritedCellStyle; }
// Method required to make the Progress Cell consistent with the default Image Cell. // The default Image Cell assumes an Image as a value, although the value of the Progress Cell is an int. protected override object GetFormattedValue(object value, int rowIndex, ref DataGridViewCellStyle cellStyle, TypeConverter valueTypeConverter, TypeConverter formattedValueTypeConverter, DataGridViewDataErrorContexts context) { return emptyImage; }
public override void InitializeEditingControl(int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle) { // Set the value of the editing control to the current cell value. base.InitializeEditingControl(rowIndex, initialFormattedValue, dataGridViewCellStyle); CalendarEditingControl ctl = DataGridView.EditingControl as CalendarEditingControl; ctl.Value = (DateTime)this.Value; }
/// <summary> /// Customized implementation of the GetFormattedValue function in order to include the decimal and thousand separator /// characters in the formatted representation of the cell value. /// </summary> protected override object GetFormattedValue(object value, int rowIndex, ref DataGridViewCellStyle cellStyle, TypeConverter valueTypeConverter, TypeConverter formattedValueTypeConverter, DataGridViewDataErrorContexts context) { // By default, the base implementation converts the Decimal 1234.5 into the string "1234.5" object formattedValue = base.GetFormattedValue(value, rowIndex, ref cellStyle, valueTypeConverter, formattedValueTypeConverter, context); string formattedNumber = formattedValue as string; if (!string.IsNullOrEmpty(formattedNumber) && value != null) { Decimal unformattedDecimal = System.Convert.ToDecimal(value); Decimal formattedDecimal = System.Convert.ToDecimal(formattedNumber); if (unformattedDecimal == formattedDecimal) { // The base implementation of GetFormattedValue (which triggers the CellFormatting event) did nothing else than // the typical 1234.5 to "1234.5" conversion. But depending on the values of ThousandsSeparator and DecimalPlaces, // this may not be the actual string displayed. The real formatted value may be "1,234.500" return formattedDecimal.ToString((this.ThousandsSeparator ? "N" : "F") + this.DecimalPlaces.ToString()); } } return formattedValue; }
/// <summary> /// Custom paints the cell. The base implementation of the DataGridViewTextBoxCell type is called first, /// dropping the icon error and content foreground parts. Those two parts are painted by this custom implementation. /// In this sample, the non-edited NumericUpDown control is painted by using a call to Control.DrawToBitmap. This is /// an easy solution for painting controls but it's not necessarily the most performant. An alternative would be to paint /// the NumericUpDown control piece by piece (text and up/down buttons). /// </summary> protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) { if (this.DataGridView == null) { return; } //if (paintingNumericUpDown.IsDisposed) //{ // paintingNumericUpDown =new NumericUpDown(); //} // First paint the borders and background of the cell. base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts & ~(DataGridViewPaintParts.ErrorIcon | DataGridViewPaintParts.ContentForeground)); Point ptCurrentCell = this.DataGridView.CurrentCellAddress; bool cellCurrent = ptCurrentCell.X == this.ColumnIndex && ptCurrentCell.Y == rowIndex; bool cellEdited = cellCurrent && this.DataGridView.EditingControl != null; // If the cell is in editing mode, there is nothing else to paint if (!cellEdited) { if (PartPainted(paintParts, DataGridViewPaintParts.ContentForeground)) { // Paint a NumericUpDown control // Take the borders into account Rectangle borderWidths = BorderWidths(advancedBorderStyle); Rectangle valBounds = cellBounds; valBounds.Offset(borderWidths.X, borderWidths.Y); valBounds.Width -= borderWidths.Right; valBounds.Height -= borderWidths.Bottom; // Also take the padding into account if (cellStyle.Padding != Padding.Empty) { if (this.DataGridView.RightToLeft == RightToLeft.Yes) { valBounds.Offset(cellStyle.Padding.Right, cellStyle.Padding.Top); } else { valBounds.Offset(cellStyle.Padding.Left, cellStyle.Padding.Top); } valBounds.Width -= cellStyle.Padding.Horizontal; valBounds.Height -= cellStyle.Padding.Vertical; } // Determine the NumericUpDown control location valBounds = GetAdjustedEditingControlBounds(valBounds, cellStyle); bool cellSelected = (cellState & DataGridViewElementStates.Selected) != 0; if (renderingBitmap.Width < valBounds.Width || renderingBitmap.Height < valBounds.Height) { // The static bitmap is too small, a bigger one needs to be allocated. renderingBitmap.Dispose(); renderingBitmap = new Bitmap(valBounds.Width, valBounds.Height); } // Make sure the NumericUpDown control is parented to a visible control if (paintingNumericUpDown.Parent == null || !paintingNumericUpDown.Parent.Visible) { paintingNumericUpDown.Parent = this.DataGridView; } // Set all the relevant properties paintingNumericUpDown.TextAlign = DataGridViewNumericUpDownCell.TranslateAlignment(cellStyle.Alignment); paintingNumericUpDown.DecimalPlaces = this.DecimalPlaces; paintingNumericUpDown.ThousandsSeparator = this.ThousandsSeparator; paintingNumericUpDown.Font = cellStyle.Font; paintingNumericUpDown.Width = valBounds.Width; paintingNumericUpDown.Height = valBounds.Height; paintingNumericUpDown.RightToLeft = this.DataGridView.RightToLeft; paintingNumericUpDown.Location = new Point(0, -paintingNumericUpDown.Height - 100); paintingNumericUpDown.Text = formattedValue as string; Color backColor; if (PartPainted(paintParts, DataGridViewPaintParts.SelectionBackground) && cellSelected) { backColor = cellStyle.SelectionBackColor; } else { backColor = cellStyle.BackColor; } if (PartPainted(paintParts, DataGridViewPaintParts.Background)) { if (backColor.A < 255) { // The NumericUpDown control does not support transparent back colors backColor = Color.FromArgb(255, backColor); } paintingNumericUpDown.BackColor = backColor; } // Finally paint the NumericUpDown control Rectangle srcRect = new Rectangle(0, 0, valBounds.Width, valBounds.Height); if (srcRect.Width > 0 && srcRect.Height > 0) { paintingNumericUpDown.DrawToBitmap(renderingBitmap, srcRect); graphics.DrawImage(renderingBitmap, new Rectangle(valBounds.Location, valBounds.Size), srcRect, GraphicsUnit.Pixel); } } if (PartPainted(paintParts, DataGridViewPaintParts.ErrorIcon)) { // Paint the potential error icon on top of the NumericUpDown control base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, DataGridViewPaintParts.ErrorIcon); } } }
public virtual void InitializeEditingControl(int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle) {}
// Constructors public DataGridViewEditingControlShowingEventArgs(Control control, DataGridViewCellStyle cellStyle) {}
public DataGridViewCellStyle(DataGridViewCellStyle dataGridViewCellStyle) {}
private void frmSelectWeapon_Load(object sender, EventArgs e) { DataGridViewCellStyle dataGridViewNuyenCellStyle = new DataGridViewCellStyle { Alignment = DataGridViewContentAlignment.TopRight, Format = _objCharacter.Options.NuyenFormat + '¥', NullValue = null }; dgvc_Cost.DefaultCellStyle = dataGridViewNuyenCellStyle; if (_objCharacter.Created) { chkHideOverAvailLimit.Visible = false; chkHideOverAvailLimit.Checked = false; } else { chkHideOverAvailLimit.Text = string.Format(GlobalOptions.CultureInfo, chkHideOverAvailLimit.Text, _objCharacter.Options.MaximumAvailability); chkHideOverAvailLimit.Checked = GlobalOptions.HideItemsOverAvailLimit; } // Populate the Weapon Category list. // Populate the Category list. string strFilterPrefix = "/chummer/weapons/weapon[(" + _objCharacter.Options.BookXPath() + ") and category = \""; using (XmlNodeList xmlCategoryList = _objXmlDocument.SelectNodes("/chummer/categories/category")) { if (xmlCategoryList != null) { foreach (XmlNode objXmlCategory in xmlCategoryList) { string strInnerText = objXmlCategory.InnerText; if ((_hashLimitToCategories.Count == 0 || _hashLimitToCategories.Contains(strInnerText)) && BuildWeaponList(_objXmlDocument.SelectNodes(strFilterPrefix + strInnerText + "\"]"), true)) { _lstCategory.Add(new ListItem(strInnerText, objXmlCategory.Attributes?["translate"]?.InnerText ?? strInnerText)); } } } } _lstCategory.Sort(CompareListItems.CompareNames); if (_lstCategory.Count > 0) { _lstCategory.Insert(0, new ListItem("Show All", LanguageManager.GetString("String_ShowAll"))); } cboCategory.BeginUpdate(); cboCategory.ValueMember = nameof(ListItem.Value); cboCategory.DisplayMember = nameof(ListItem.Name); cboCategory.DataSource = _lstCategory; chkBlackMarketDiscount.Visible = _objCharacter.BlackMarketDiscount; // Select the first Category in the list. if (string.IsNullOrEmpty(s_StrSelectCategory)) { cboCategory.SelectedIndex = 0; } else { cboCategory.SelectedValue = s_StrSelectCategory; } if (cboCategory.SelectedIndex == -1) { cboCategory.SelectedIndex = 0; } cboCategory.EndUpdate(); _blnLoading = false; RefreshList(); }
private void frmSelectArmor_Load(object sender, EventArgs e) { if (_objCharacter.Created) { chkHideOverAvailLimit.Visible = false; chkHideOverAvailLimit.Checked = false; lblMarkupLabel.Visible = true; nudMarkup.Visible = true; lblMarkupPercentLabel.Visible = true; } else { chkHideOverAvailLimit.Text = string.Format(GlobalOptions.CultureInfo, chkHideOverAvailLimit.Text, _objCharacter.MaximumAvailability.ToString(GlobalOptions.CultureInfo)); chkHideOverAvailLimit.Checked = _objCharacter.Options.HideItemsOverAvailLimit; lblMarkupLabel.Visible = false; nudMarkup.Visible = false; lblMarkupPercentLabel.Visible = false; } DataGridViewCellStyle dataGridViewNuyenCellStyle = new DataGridViewCellStyle { Alignment = DataGridViewContentAlignment.TopRight, Format = _objCharacter.Options.NuyenFormat + '¥', NullValue = null }; Cost.DefaultCellStyle = dataGridViewNuyenCellStyle; // Populate the Armor Category list. XmlNodeList objXmlCategoryList = _objXmlDocument.SelectNodes("/chummer/categories/category"); if (objXmlCategoryList != null) { foreach (XmlNode objXmlCategory in objXmlCategoryList) { string strInnerText = objXmlCategory.InnerText; _lstCategory.Add(new ListItem(strInnerText, objXmlCategory.Attributes?["translate"]?.InnerText ?? strInnerText)); } } _lstCategory.Sort(CompareListItems.CompareNames); if (_lstCategory.Count > 0) { _lstCategory.Insert(0, new ListItem("Show All", LanguageManager.GetString("String_ShowAll"))); } cboCategory.BeginUpdate(); cboCategory.ValueMember = nameof(ListItem.Value); cboCategory.DisplayMember = nameof(ListItem.Name); cboCategory.DataSource = _lstCategory; chkBlackMarketDiscount.Visible = _objCharacter.BlackMarketDiscount; // Select the first Category in the list. if (!string.IsNullOrEmpty(s_StrSelectCategory)) { cboCategory.SelectedValue = s_StrSelectCategory; } if (cboCategory.SelectedIndex == -1) { cboCategory.SelectedIndex = 0; } cboCategory.EndUpdate(); _blnLoading = false; RefreshList(); }
protected override void Paint(Graphics g, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) { ReadOnly = true; // Draw the cell border base.Paint(g, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, DataGridViewPaintParts.Border); try { // Draw the ProgressBar to an in-memory bitmap Bitmap bmp = new Bitmap(cellBounds.Width, cellBounds.Height); Rectangle bmpBounds = new Rectangle(0, 0, cellBounds.Width, cellBounds.Height); _progressBar.Size = cellBounds.Size; _progressBar.DrawToBitmap(bmp, bmpBounds); // Draw the bitmap on the cell g.DrawImage(bmp, cellBounds); // Replace special value placeholders var editedMessage = _text.Replace(MessageSpecialValue.CurrentValue, Value.ToString()) .Replace(MessageSpecialValue.Maximum, Maximum.ToString()) .Replace(MessageSpecialValue.Minimum, Minimum.ToString()); // Write text over bar base.Paint(g, clipBounds, cellBounds, rowIndex, cellState, value, editedMessage, errorText, cellStyle, advancedBorderStyle, DataGridViewPaintParts.ContentForeground); } catch (ArgumentOutOfRangeException) { // Row probably couldn't be accessed } }
public RevisionDataGridView() { _backgroundThread = new Thread(BackgroundThreadEntry) { IsBackground = true, Name = "RevisionDataGridView.backgroundThread" }; _backgroundThread.Start(); NormalFont = AppSettings.Font; _monospaceFont = AppSettings.MonospaceFont; InitializeComponent(); DoubleBuffered = true; _alternatingRowBackgroundBrush = new SolidBrush(KnownColor.Window.MakeBackgroundDarkerBy(0.025)); // 0.018 UpdateRowHeight(); SetStyle(ControlStyles.OptimizedDoubleBuffer, true); ColumnWidthChanged += (s, e) => { if (e.Column.Tag is ColumnProvider provider) { provider.OnColumnWidthChanged(e); } }; Scroll += delegate { UpdateVisibleRowRange(); }; Resize += delegate { UpdateVisibleRowRange(); }; CellPainting += OnCellPainting; CellFormatting += (_, e) => { if (Columns[e.ColumnIndex].Tag is ColumnProvider provider) { var revision = GetRevision(e.RowIndex); if (revision != null) { provider.OnCellFormatting(e, revision); } } }; RowPrePaint += OnRowPrePaint; _revisionGraph.Updated += () => { // We have to post this since the thread owns a lock on GraphData that we'll // need in order to re-draw the graph. this.InvokeAsync(() => { Debug.Assert(_rowHeight != 0, "_rowHeight != 0"); // Refresh column providers foreach (var columnProvider in _columnProviders) { columnProvider.Refresh(_rowHeight, _visibleRowRange); } Invalidate(); }) .FileAndForget(); }; VirtualMode = true; Clear(); return; void OnRowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e) { if (e.PaintParts.HasFlag(DataGridViewPaintParts.Background) && e.RowBounds.Width > 0 && e.RowBounds.Height > 0) { // Draw row background var backBrush = GetBackground(e.State, e.RowIndex, null); e.Graphics.FillRectangle(backBrush, e.RowBounds); } } void InitializeComponent() { ((ISupportInitialize)this).BeginInit(); SuspendLayout(); AllowUserToAddRows = false; AllowUserToDeleteRows = false; BackgroundColor = SystemColors.Window; CellBorderStyle = DataGridViewCellBorderStyle.None; ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; DefaultCellStyle = new DataGridViewCellStyle { Alignment = DataGridViewContentAlignment.MiddleLeft, BackColor = SystemColors.Window, ForeColor = SystemColors.ControlText, SelectionBackColor = SystemColors.Highlight, SelectionForeColor = SystemColors.HighlightText, WrapMode = DataGridViewTriState.False }; Dock = DockStyle.Fill; GridColor = SystemColors.Window; ReadOnly = true; RowHeadersVisible = false; SelectionMode = DataGridViewSelectionMode.FullRowSelect; StandardTab = true; ((ISupportInitialize)this).EndInit(); ResumeLayout(false); } }
public Rectangle PublicGetErrorIconBounds(Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex) { return(GetErrorIconBounds(graphics, cellStyle, rowIndex)); }
protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) { var parent = this.OwningColumn as CustomDataGridViewIcnColumn; if (parent == null) { base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts); return; } var drawingContext = new CellDrawingContext { BackColor = cellStyle.BackColor, ForeColor = cellStyle.ForeColor, Graphics = graphics, CellBounds = cellBounds, PreviousTextSize = new SizeF(0, 0), TextSize = new SizeF(0, 0), TextStart = new PointF(cellBounds.X, ((cellBounds.Height - cellBounds.Height) / 2.0f)) }; if ((cellState & DataGridViewElementStates.Selected) == DataGridViewElementStates.Selected) { drawingContext.BackColor = cellStyle.SelectionBackColor; drawingContext.ForeColor = cellStyle.SelectionForeColor; } using (Brush backColorBrush = new SolidBrush(drawingContext.BackColor)) { graphics.FillRectangle(backColorBrush, cellBounds); } base.PaintBorder(graphics, clipBounds, cellBounds, cellStyle, advancedBorderStyle); Font font = cellStyle.Font; var boldFont = new Font(font, FontStyle.Bold); string cellText = formattedValue == null ? string.Empty : formattedValue.ToString(); var icn = new Icn(cellText); if (!icn.Initialized) { return; } DrawText(drawingContext, font, icn.FormattedShopNumber + " " + icn.FormattedLastDigitOfYear + " "); DrawText(drawingContext, boldFont, icn.FormattedDocumentNumber); DrawText(drawingContext, font, " " + icn.FormattedDocumentType + " "); DrawText(drawingContext, boldFont, icn.FormattedItemNumber); DrawText(drawingContext, font, " " + icn.FormattedSubItemNumber); drawingContext.OverallWidth += 8; // add a little padding if (drawingContext.OverallWidth > parent.Width) { parent.Width = drawingContext.OverallWidth; } }
private void in_grid_logic() { wnDm wDm = new wnDm(); DataTable dt = null; StringBuilder sb = new StringBuilder(); sb.AppendLine("and Z.BUY_DATE >= '" + start_date.Text.ToString() + "' and Z.BUY_DATE <= '" + end_date.Text.ToString() + "' and Z.CUST_CD = '" + txt_srch2.Text.ToString() + "' "); dt = wDm.fn_Buy_Ledger_List( txt_srch2.Text.ToString() , start_date.Text.ToString() , end_date.Text.ToString() ); inputRmGrid.Rows.Clear(); if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { //string t_amt = string.Format("{0:#.##}", 100.2); inputRmGrid.Rows.Add(); inputRmGrid.Rows[i].Cells["SALES_DATE"].Value = dt.Rows[i]["일자명칭"].ToString(); if (dt.Rows[i]["일자명칭"].ToString().ToString().Equals("--- 일계 ---") || dt.Rows[i]["일자명칭"].ToString().ToString().Equals("=== 월계 ===")) { DataGridViewCellStyle style = new DataGridViewCellStyle(); style.BackColor = Color.Khaki; style.SelectionBackColor = Color.DarkKhaki; if (dt.Rows[i]["일자명칭"].ToString().ToString().Equals("=== 월계 ===")) { style.ForeColor = Color.Blue; } for (int j = 0; j < inputRmGrid.ColumnCount; j++) { inputRmGrid.Rows[i].Cells[j].Style = style; } } if (dt.Rows[i]["BUY_CD"].ToString().Equals("999999") || dt.Rows[i]["BUY_CD"].ToString().Equals("0")) { inputRmGrid.Rows[i].Cells["SALES_CD"].Value = ""; } else { inputRmGrid.Rows[i].Cells["SALES_CD"].Value = dt.Rows[i]["BUY_CD"].ToString(); } inputRmGrid.Rows[i].Cells["NO"].Value = (dt.Rows[i]["bun"].ToString().Equals("ㅎ") ? "" : dt.Rows[i]["bun"].ToString()); if (dt.Rows[i]["VAT_CD"].ToString().Equals("2")) { inputRmGrid.Rows[i].Cells["INPUT_GUBUN"].Value = "(" + dt.Rows[i]["INPUT_GUBUN"].ToString() + ")"; } else { inputRmGrid.Rows[i].Cells["INPUT_GUBUN"].Value = dt.Rows[i]["INPUT_GUBUN"].ToString(); } inputRmGrid.Rows[i].Cells["PRODUCT_NM"].Value = dt.Rows[i]["PRODUCT_NM"].ToString(); inputRmGrid.Rows[i].Cells["SPEC"].Value = dt.Rows[i]["SPEC"].ToString(); inputRmGrid.Rows[i].Cells["LOT_NO"].Value = dt.Rows[i]["LOT_NO"].ToString(); inputRmGrid.Rows[i].Cells["LOT_SUB"].Value = dt.Rows[i]["LOT_SUB"].ToString(); inputRmGrid.Rows[i].Cells["TOTAL_AMT"].Value = (decimal.Parse(dt.Rows[i]["TOTAL_AMT"].ToString())).ToString("#,0.######"); inputRmGrid.Rows[i].Cells["TOTAL_PRICE"].Value = (decimal.Parse(dt.Rows[i]["TOTAL_PRICE"].ToString())).ToString("#,0.######"); inputRmGrid.Rows[i].Cells["TOTAL_SUPPLY_MONEY"].Value = (decimal.Parse(dt.Rows[i]["TOTAL_SUPPLY_MONEY"].ToString())).ToString("#,0.######"); inputRmGrid.Rows[i].Cells["TOTAL_TAX_MONEY"].Value = (decimal.Parse(dt.Rows[i]["TOTAL_TAX_MONEY"].ToString())).ToString("#,0.######"); inputRmGrid.Rows[i].Cells["TOTAL_MONEY"].Value = (decimal.Parse(dt.Rows[i]["TOTAL_MONEY"].ToString())).ToString("#,0.######"); inputRmGrid.Rows[i].Cells["SOO_MONEY"].Value = (decimal.Parse(dt.Rows[i]["GIVE_MONEY"].ToString())).ToString("#,0.######"); inputRmGrid.Rows[i].Cells["DC_MONEY"].Value = (decimal.Parse(dt.Rows[i]["DC_MONEY"].ToString())).ToString("#,0.######"); inputRmGrid.Rows[i].Cells["TOTAL_SOO_MONEY"].Value = (decimal.Parse(dt.Rows[i]["TOTAL_GIVE_MONEY"].ToString())).ToString("#,0.######"); inputRmGrid.Rows[i].Cells["BALANCE"].Value = (decimal.Parse(dt.Rows[i]["BALANCE"].ToString())).ToString("#,0.######"); if (inputRmGrid.Rows[i].Cells["TOTAL_AMT"].Value == null || inputRmGrid.Rows[i].Cells["TOTAL_AMT"].Value.ToString().Equals("0")) { inputRmGrid.Rows[i].Cells["TOTAL_AMT"].Value = ""; } if (inputRmGrid.Rows[i].Cells["TOTAL_PRICE"].Value == null || inputRmGrid.Rows[i].Cells["TOTAL_PRICE"].Value.ToString().Equals("0")) { inputRmGrid.Rows[i].Cells["TOTAL_PRICE"].Value = ""; } if (inputRmGrid.Rows[i].Cells["TOTAL_SUPPLY_MONEY"].Value == null || inputRmGrid.Rows[i].Cells["TOTAL_SUPPLY_MONEY"].Value.ToString().Equals("0")) { inputRmGrid.Rows[i].Cells["TOTAL_SUPPLY_MONEY"].Value = ""; } if (inputRmGrid.Rows[i].Cells["TOTAL_TAX_MONEY"].Value == null || inputRmGrid.Rows[i].Cells["TOTAL_TAX_MONEY"].Value.ToString().Equals("0")) { inputRmGrid.Rows[i].Cells["TOTAL_TAX_MONEY"].Value = ""; } if (inputRmGrid.Rows[i].Cells["TOTAL_MONEY"].Value == null || inputRmGrid.Rows[i].Cells["TOTAL_MONEY"].Value.ToString().Equals("0")) { inputRmGrid.Rows[i].Cells["TOTAL_MONEY"].Value = ""; } if (inputRmGrid.Rows[i].Cells["SOO_MONEY"].Value == null || inputRmGrid.Rows[i].Cells["SOO_MONEY"].Value.ToString().Equals("0")) { inputRmGrid.Rows[i].Cells["SOO_MONEY"].Value = ""; } if (inputRmGrid.Rows[i].Cells["DC_MONEY"].Value == null || inputRmGrid.Rows[i].Cells["DC_MONEY"].Value.ToString().Equals("0")) { inputRmGrid.Rows[i].Cells["DC_MONEY"].Value = ""; } if (inputRmGrid.Rows[i].Cells["TOTAL_SOO_MONEY"].Value == null || inputRmGrid.Rows[i].Cells["TOTAL_SOO_MONEY"].Value.ToString().Equals("0")) { inputRmGrid.Rows[i].Cells["TOTAL_SOO_MONEY"].Value = ""; } } } //데이타 끝나고 다시 copy를 써준 이유는 for중에 no에 값을 엏었기 때문에 출력물 데이타테이블(dt)를 다시 복사함 }
/// <summary> /// Creates or updates a <see cref="DataGridViewSummaryRow"/> for each group limited by the /// values in the columns from <paramref name="groupFromCol"/> to <paramref name="groupToCol"/>. /// </summary> /// <param name="grid">Extension class.</param> /// <param name="summaryType">Determines the aggregation type.</param> /// <param name="groupFromCol">Name of the first column that determines the group break values.</param> /// <param name="groupToCol">Name of the last column that determines the group break values.</param> /// <param name="summaryCol">Name of the column to aggregate.</param> /// <param name="style">Optional <see cref="DataGridViewCellStyle"/> for the summary rows.</param> /// <returns>Array of the <see cref="DataGridViewSummaryRow"/> rows displaying the aggregated values.</returns> public static DataGridViewSummaryRow[] AddSummaryRows(this DataGridView grid, SummaryType summaryType, string groupFromCol, string groupToCol, string summaryCol, DataGridViewCellStyle style = null) { return(AddSummaryRows( grid, summaryType, SummaryRowPosition.Below, groupFromCol, groupToCol, summaryCol, style)); }
// Methods public virtual void ApplyCellStyleToEditingControl(DataGridViewCellStyle dataGridViewCellStyle) {}
public void Form_Load_set_color() { DataSet objDataSet1 = new DataSet(); Database.Connection_Open(); Database.Fill("SELECT * FROM Color_Font_Set ORDER BY tmpid", objDataSet1, "Color_Font_Set", true); Database.Connection_Close(); TypeConverter tc0 = TypeDescriptor.GetConverter(typeof(Color)); Color newColor0 = (Color)tc0.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[6]["promp"].ToString()); foreach (SplitContainer spc in this.Controls) { foreach (Control ct in spc.Panel2.Controls) { if (ct.GetType() == typeof(Button)) { TypeConverter tc = TypeDescriptor.GetConverter(typeof(Font)); Font newFont = (Font)tc.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[13]["promp"].ToString()); ct.Font = newFont; TypeConverter tc1 = TypeDescriptor.GetConverter(typeof(Color)); Color newColor = (Color)tc1.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[14]["promp"].ToString()); ct.ForeColor = newColor; } } } this.BackColor = newColor0; TypeConverter tc2 = TypeDescriptor.GetConverter(typeof(Font)); Font newFont2 = (Font)tc2.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[2]["promp"].ToString()); TypeConverter tc3 = TypeDescriptor.GetConverter(typeof(Color)); Color newColor3 = (Color)tc3.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[8]["promp"].ToString()); TypeConverter tc7 = TypeDescriptor.GetConverter(typeof(Font)); Font newFont7 = (Font)tc7.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[7]["promp"].ToString()); TypeConverter tc8 = TypeDescriptor.GetConverter(typeof(Color)); Color newColor8 = (Color)tc8.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[8]["promp"].ToString()); TypeConverter tc9 = TypeDescriptor.GetConverter(typeof(Color)); Color newColor9 = (Color)tc9.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[9]["promp"].ToString()); TypeConverter tc10 = TypeDescriptor.GetConverter(typeof(Color)); Color newColor10 = (Color)tc10.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[10]["promp"].ToString()); TypeConverter tc11 = TypeDescriptor.GetConverter(typeof(Color)); Color newColor11 = (Color)tc11.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[11]["promp"].ToString()); TypeConverter tc12 = TypeDescriptor.GetConverter(typeof(Color)); Color newColor12 = (Color)tc12.ConvertFromString(objDataSet1.Tables["Color_Font_Set"].Rows[12]["promp"].ToString()); DataGridViewCellStyle objAlignRightCellStyle1 = new DataGridViewCellStyle(); objAlignRightCellStyle1.Font = newFont2; objAlignRightCellStyle1.BackColor = newColor3; DataGridViewCellStyle objAlignRightCellStyle2 = new DataGridViewCellStyle(); objAlignRightCellStyle2.BackColor = newColor9; objAlignRightCellStyle2.ForeColor = newColor10; DataGridViewCellStyle objAlignRightCellStyle3 = new DataGridViewCellStyle(); objAlignRightCellStyle3.BackColor = newColor11; objAlignRightCellStyle3.ForeColor = newColor12; dataGridView1.Font = newFont7; dataGridView1.BackgroundColor = newColor8; dataGridView1.ColumnHeadersDefaultCellStyle = objAlignRightCellStyle1; dataGridView1.AlternatingRowsDefaultCellStyle = objAlignRightCellStyle2; dataGridView1.DefaultCellStyle = objAlignRightCellStyle3; objDataSet1.Clear(); }
// Implements the // IDataGridViewEditingControl.ApplyCellStyleToEditingControl method. public void ApplyCellStyleToEditingControl( DataGridViewCellStyle dataGridViewCellStyle) { this.Font = dataGridViewCellStyle.Font; this.CalendarForeColor = dataGridViewCellStyle.ForeColor; this.CalendarMonthBackground = dataGridViewCellStyle.BackColor; }
protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) { if (Image != null) { base.Paint(graphics, clipBounds, new Rectangle(cellBounds.X + Image.Width, cellBounds.Y, cellBounds.Width - Image.Height, cellBounds.Height), rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts); if ((cellState & DataGridViewElementStates.Selected) != 0) { graphics.FillRectangle( new SolidBrush(this.DataGridView.DefaultCellStyle.SelectionBackColor) , cellBounds.X, cellBounds.Y, Image.Width, cellBounds.Height); } else { graphics.FillRectangle(new SolidBrush(this.DataGridView.DefaultCellStyle.BackColor), cellBounds.X, cellBounds.Y, Image.Width, cellBounds.Height); } graphics.DrawImage(Image, cellBounds.X, cellBounds.Y + 2, Image.Width, Math.Min(Image.Height, cellBounds.Height)); } else { base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts); } }
public TradingScreen(Player player) { _currentPlayer = player; InitializeComponent(); // Style, to display numeric column values DataGridViewCellStyle rightAlignedCellStyle = new DataGridViewCellStyle(); rightAlignedCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; // Populate the datagrid for the player's inventory dgvMyItems.RowHeadersVisible = false; dgvMyItems.AutoGenerateColumns = false; // This hidden column holds the item ID, so we know which item to sell dgvMyItems.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "ItemID", Visible = false }); dgvMyItems.Columns.Add(new DataGridViewTextBoxColumn { HeaderText = "Name", Width = 100, DataPropertyName = "Description" }); dgvMyItems.Columns.Add(new DataGridViewTextBoxColumn { HeaderText = "Qty", Width = 30, DefaultCellStyle = rightAlignedCellStyle, DataPropertyName = "Quantity" }); dgvMyItems.Columns.Add(new DataGridViewTextBoxColumn { HeaderText = "Price", Width = 35, DefaultCellStyle = rightAlignedCellStyle, DataPropertyName = "Price" }); dgvMyItems.Columns.Add(new DataGridViewButtonColumn { Text = "Sell 1", UseColumnTextForButtonValue = true, Width = 50, DataPropertyName = "ItemID" }); // Bind the player's inventory to the datagridview dgvMyItems.DataSource = _currentPlayer.Inventory; // When the user clicks on a row, call this function dgvMyItems.CellClick += dgvMyItems_CellClick; // Populate the datagrid for the vendor's inventory dgvVendorItems.RowHeadersVisible = false; dgvVendorItems.AutoGenerateColumns = false; // This hidden column holds the item ID, so we know which item to sell dgvVendorItems.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "ItemID", Visible = false }); dgvVendorItems.Columns.Add(new DataGridViewTextBoxColumn { HeaderText = "Name", Width = 100, DataPropertyName = "Description" }); dgvVendorItems.Columns.Add(new DataGridViewTextBoxColumn { HeaderText = "Qty", Width = 30, DefaultCellStyle = rightAlignedCellStyle, DataPropertyName = "Quantity" }); dgvVendorItems.Columns.Add(new DataGridViewTextBoxColumn { HeaderText = "Price", Width = 35, DefaultCellStyle = rightAlignedCellStyle, DataPropertyName = "Price" }); dgvVendorItems.Columns.Add(new DataGridViewButtonColumn { Text = "Buy 1", UseColumnTextForButtonValue = true, Width = 50, DataPropertyName = "ItemID" }); // Bind the vendor's inventory to the datagridview dgvVendorItems.DataSource = _currentPlayer.CurrentLocation.VendorWorkingHere.Inventory; // When the user clicks on a row, call this function dgvVendorItems.CellClick += dgvVendorItems_CellClick; }
protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) { Pool pool = value as Pool; if (pool != null) { base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts); } else { Host host = value as Host; if (host != null) { PatchingHostsDataGridViewRow row = (PatchingHostsDataGridViewRow)this.DataGridView.Rows[this.RowIndex]; if (row.HasPool) { Image hostIcon = Images.GetImage16For(host); base.Paint(graphics, clipBounds, new Rectangle(cellBounds.X + 16, cellBounds.Y, cellBounds.Width - 16, cellBounds.Height), rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts); if ((cellState & DataGridViewElementStates.Selected) != 0 && row.Enabled) { using (var brush = new SolidBrush(DataGridView.DefaultCellStyle.SelectionBackColor)) graphics.FillRectangle( brush, cellBounds.X, cellBounds.Y, hostIcon.Width, cellBounds.Height); } else { using (var brush = new SolidBrush(DataGridView.DefaultCellStyle.BackColor)) graphics.FillRectangle(brush, cellBounds.X, cellBounds.Y, hostIcon.Width, cellBounds.Height); } if (row.Enabled) { graphics.DrawImage(hostIcon, cellBounds.X, cellBounds.Y + 3, hostIcon.Width, hostIcon.Height); } else { graphics.DrawImage(hostIcon, new Rectangle(cellBounds.X, cellBounds.Y + 3, hostIcon.Width, hostIcon.Height), 0, 0, hostIcon.Width, hostIcon.Height, GraphicsUnit.Pixel, Drawing.GreyScaleAttributes); } } else { base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts); } } } }
internal DataGridViewCellStyleContentChangedEventArgs (DataGridViewCellStyle cellStyle, DataGridViewCellStyleScopes cellStyleScope) { this.cellStyle = cellStyle; this.cellStyleScope = cellStyleScope; }
protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) { Image icon = value as Image; if (icon == null) { return; } PatchingHostsDataGridViewRow row = (PatchingHostsDataGridViewRow)DataGridView.Rows[RowIndex]; if ((cellState & DataGridViewElementStates.Selected) != 0 && row.Enabled) { using (var brush = new SolidBrush(DataGridView.DefaultCellStyle.SelectionBackColor)) graphics.FillRectangle( brush, cellBounds.X, cellBounds.Y, cellBounds.Width, cellBounds.Height); } else { using (var brush = new SolidBrush(DataGridView.DefaultCellStyle.BackColor)) graphics.FillRectangle(brush, cellBounds.X, cellBounds.Y, cellBounds.Width, cellBounds.Height); } if (row.Enabled) { graphics.DrawImage(icon, cellBounds.X, cellBounds.Y + 3, icon.Width, icon.Height); } else { graphics.DrawImage(icon, new Rectangle(cellBounds.X, cellBounds.Y + 3, icon.Width, icon.Height), 0, 0, icon.Width, icon.Height, GraphicsUnit.Pixel, Drawing.GreyScaleAttributes); } }
// Constructors public DataGridViewCellPaintingEventArgs(DataGridView dataGridView, System.Drawing.Graphics graphics, System.Drawing.Rectangle clipBounds, System.Drawing.Rectangle cellBounds, int rowIndex, int columnIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) {}
protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates elementState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) { // The button cell is disabled, so paint the border, // background, and disabled button for the cell. if (!this.enabledValue) { // Draw the cell background, if specified. if ((paintParts & DataGridViewPaintParts.Background) == DataGridViewPaintParts.Background) { SolidBrush cellBackground = new SolidBrush(cellStyle.BackColor); graphics.FillRectangle(cellBackground, cellBounds); cellBackground.Dispose(); } // Draw the cell borders, if specified. if ((paintParts & DataGridViewPaintParts.Border) == DataGridViewPaintParts.Border) { PaintBorder(graphics, clipBounds, cellBounds, cellStyle, advancedBorderStyle); } // Calculate the area in which to draw the button. Rectangle buttonArea = cellBounds; Rectangle buttonAdjustment = this.BorderWidths(advancedBorderStyle); buttonArea.X += buttonAdjustment.X; buttonArea.Y += buttonAdjustment.Y; buttonArea.Height -= buttonAdjustment.Height; buttonArea.Width -= buttonAdjustment.Width; // Draw the disabled button. ButtonRenderer.DrawButton(graphics, buttonArea, PushButtonState.Disabled); // Draw the disabled button text. if (this.FormattedValue is String) { TextRenderer.DrawText(graphics, (string)this.FormattedValue, this.DataGridView.Font, buttonArea, SystemColors.GrayText); } } else { // The button cell is enabled, so let the base class // handle the painting. base.Paint(graphics, clipBounds, cellBounds, rowIndex, elementState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts); } }
public virtual void PositionEditingControl(bool setLocation, bool setSize, System.Drawing.Rectangle cellBounds, System.Drawing.Rectangle cellClip, DataGridViewCellStyle cellStyle, bool singleVerticalBorderAdded, bool singleHorizontalBorderAdded, bool isFirstDisplayedColumn, bool isFirstDisplayedRow) {}
void FormatoDgv() { //------------------------------------------------------------------// var dgv = dgvListado; dgv.MultiSelect = false; dgv.ReadOnly = true; dgv.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dgv.AllowUserToAddRows = false; dgv.AllowUserToDeleteRows = false; dgv.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; dgv.RowHeadersVisible = false; dgv.AllowUserToResizeColumns = false; dgv.AllowUserToResizeRows = false; dgv.DefaultCellStyle.Font = new Font("Tahoma", 10); dgv.RowsDefaultCellStyle.BackColor = Color.LightBlue; dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.White; DataGridViewCellStyle style = this.dgvListado.ColumnHeadersDefaultCellStyle; style.BackColor = Color.Honeydew; style.ForeColor = Color.Gray; //dgv.Columns.Clear(); dgv.ColumnCount = 6; // Setear Cabecera de Columna dgv.Columns[0].Name = "IDE"; dgv.Columns[1].Name = "NOMBRE"; dgv.Columns[2].Name = "ESTADO"; dgv.Columns[3].Name = "FECHAINAC"; dgv.Columns[4].Name = "CREACION"; dgv.Columns[5].Name = "VECES"; dgv.Columns[0].Width = 45; dgv.Columns[0].HeaderText = "ID"; dgv.Columns[0].DataPropertyName = "TIPO_VEHI_IDE"; dgv.Columns[1].Width = 320; dgv.Columns[1].HeaderText = "Descripción "; dgv.Columns[1].DataPropertyName = "TIPO_VEHI_NOMBRE"; dgv.Columns[2].Width = 85; dgv.Columns[2].HeaderText = "Estado"; dgv.Columns[2].DataPropertyName = "TIPO_VEHI_ESTADO"; // Columnas que no Deben Verse dgv.Columns[3].DataPropertyName = "TIPO_VEHI_FECHAINAC"; dgv.Columns[3].HeaderText = "F.Inactivo"; dgv.Columns[3].Visible = false; dgv.Columns[4].DataPropertyName = "CREACION"; dgv.Columns[4].HeaderText = "F.Creacion"; dgv.Columns[4].Visible = false; dgv.Columns[5].DataPropertyName = "VECES"; dgv.Columns[5].HeaderText = "Veces"; dgv.Columns[5].Visible = false; }
/// <summary> /// Creates or updates a <see cref="DataGridViewSummaryRow"/> for each group limited by the /// values in the columns from <paramref name="groupFromCol"/> to <paramref name="groupToCol"/>. /// </summary> /// <param name="grid">Extension class.</param> /// <param name="summaryType">Determines the aggregation type.</param> /// <param name="summaryPosition">Indicates the position of the <see cref="DataGridViewSummaryRow"/>.</param> /// <param name="groupFromCol">First column that determines the group break values.</param> /// <param name="groupToCol">Last column that determines the group break values.</param> /// <param name="summaryCol">Column to aggregate.</param> /// <param name="style">Optional <see cref="DataGridViewCellStyle"/> for the summary rows.</param> /// <returns>Array of the <see cref="DataGridViewSummaryRow"/> rows displaying the aggregated values.</returns> public static DataGridViewSummaryRow[] AddSummaryRows(this DataGridView grid, SummaryType summaryType, SummaryRowPosition summaryPosition, DataGridViewColumn groupFromCol, DataGridViewColumn groupToCol, DataGridViewColumn summaryCol, DataGridViewCellStyle style = null) { if (summaryType != SummaryType.None && summaryCol == null) { throw new ArgumentNullException(nameof(summaryCol)); } lock (grid.Rows) { var groups = FindSummaryGroups(grid, summaryPosition, groupFromCol, groupToCol); if (groups.Length == 0) { groups = CollectSummaryGroups(grid, summaryPosition, groupFromCol, groupToCol); } // calculate the specified aggregates. var summaryRows = new List <DataGridViewSummaryRow>(); if (groups.Length > 0) { for (int i = 0; i < groups.Length; i++) { // retrieve or create the summary row. var summaryRow = RetrieveSummaryRow(grid, groups[i], summaryPosition, groupFromCol, groupToCol) ?? CreateSummaryRow(grid, groups[i], summaryType, summaryPosition, groupFromCol, groupToCol, summaryCol, style); // calculate the aggregate value. CalculateSummary(summaryRow, summaryType, groups[i], summaryCol); summaryRows.Add(summaryRow); } return(summaryRows.ToArray()); } } return(null); }
public override void InitializeEditingControl(int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle) { base.InitializeEditingControl(rowIndex, initialFormattedValue, dataGridViewCellStyle); ((TextBox)this.DataGridView.EditingControl).UseSystemPasswordChar = UsePasswordCharWhenEditing; }
/// <summary> /// Custom implementation of the GetPreferredSize function. This implementation uses the preferred size of the base /// DataGridViewTextBoxCell cell and adds room for the up/down buttons. /// </summary> protected override Size GetPreferredSize(Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex, Size constraintSize) { if (this.DataGridView == null) { return new Size(-1, -1); } Size preferredSize = base.GetPreferredSize(graphics, cellStyle, rowIndex, constraintSize); if (constraintSize.Width == 0) { const int ButtonsWidth = 16; // Account for the width of the up/down buttons. const int ButtonMargin = 8; // Account for some blank pixels between the text and buttons. preferredSize.Width += ButtonsWidth + ButtonMargin; } return preferredSize; }
/// <summary> /// DataGridView 外观设置 /// </summary> private void dgv_Style() { DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle(); DataGridViewCellStyle dataGridViewCellStyle2 = new DataGridViewCellStyle(); DataGridViewCellStyle dataGridViewCellStyle3 = new DataGridViewCellStyle(); dataGridViewCellStyle1.Alignment = DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle1.BackColor = SystemColors.Control; dataGridViewCellStyle1.Font = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, ((134))); dataGridViewCellStyle1.ForeColor = SystemColors.WindowText; dataGridViewCellStyle1.SelectionBackColor = SystemColors.Control; dataGridViewCellStyle1.SelectionForeColor = SystemColors.HighlightText; dataGridViewCellStyle1.WrapMode = DataGridViewTriState.True; dataGridViewCellStyle2.Alignment = DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle2.BackColor = SystemColors.Window; dataGridViewCellStyle2.Font = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, ((134))); dataGridViewCellStyle2.ForeColor = SystemColors.ControlText; dataGridViewCellStyle2.SelectionBackColor = Color.FromArgb(250, 189, 129); dataGridViewCellStyle2.SelectionForeColor = Color.FromArgb(0, 0, 0); dataGridViewCellStyle2.WrapMode = DataGridViewTriState.False; dataGridViewCellStyle3.Alignment = DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle3.BackColor = SystemColors.Control; dataGridViewCellStyle3.Font = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, ((134))); dataGridViewCellStyle3.ForeColor = SystemColors.WindowText; dataGridViewCellStyle3.SelectionBackColor = SystemColors.Control; dataGridViewCellStyle3.SelectionForeColor = SystemColors.ControlText; dgv.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; dgv.DefaultCellStyle = dataGridViewCellStyle2; dgv.RowHeadersDefaultCellStyle = dataGridViewCellStyle3; dgv.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dgv.MultiSelect = true; //dgv.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; dgv.AllowUserToAddRows = false; dgv.AllowUserToDeleteRows = false; dgv.AllowUserToOrderColumns = false; dgv.AllowUserToResizeColumns = false; dgv.AllowUserToResizeRows = false; //this.dgv.GridColor = Color.BlueViolet; //this.dgv.BorderStyle = BorderStyle.Fixed3D; //this.dgv.CellBorderStyle = DataGridViewCellBorderStyle.None; //this.dgv.RowHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single; //this.dgv.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single; if (dgv.RowCount > 0 && dgv.RowCount < 99) { dgv.RowHeadersWidth = 30; } else if (dgv.RowCount > 99 && dgv.RowCount < 999) { dgv.RowHeadersWidth = 35; } else if (dgv.RowCount > 999 && dgv.RowCount < 9999) { dgv.RowHeadersWidth = 40; } else if (dgv.RowCount > 9999 && dgv.RowCount < 99999) { dgv.RowHeadersWidth = 45; } else if (dgv.RowCount > 99999 && dgv.RowCount < 999999) { dgv.RowHeadersWidth = 50; } else { dgv.RowHeadersWidth = 25; } dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; dgv.ColumnHeadersHeight = 25; dgv.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); //dgv.ScrollBars = ScrollBars.Vertical; }
/// <summary> /// Adjusts the location and size of the editing control given the alignment characteristics of the cell /// </summary> private Rectangle GetAdjustedEditingControlBounds(Rectangle editingControlBounds, DataGridViewCellStyle cellStyle) { // Add a 1 pixel padding on the left and right of the editing control editingControlBounds.X += 1; editingControlBounds.Width = Math.Max(0, editingControlBounds.Width - 2); // Adjust the vertical location of the editing control: int preferredHeight = cellStyle.Font.Height + 3; if (preferredHeight < editingControlBounds.Height) { switch (cellStyle.Alignment) { case DataGridViewContentAlignment.MiddleLeft: case DataGridViewContentAlignment.MiddleCenter: case DataGridViewContentAlignment.MiddleRight: editingControlBounds.Y += (editingControlBounds.Height - preferredHeight) / 2; break; case DataGridViewContentAlignment.BottomLeft: case DataGridViewContentAlignment.BottomCenter: case DataGridViewContentAlignment.BottomRight: editingControlBounds.Y += editingControlBounds.Height - preferredHeight; break; } } return editingControlBounds; }
/// <summary>The add tables.</summary> private void AddTables() { ClearGridsAndTabs(); SetRowCount(null); if (Batch != null) { string nullText = _settings.NullText; int counter = 1; _resizingGrid = true; foreach (Query query in Batch.Queries) { DataSet ds = query.Result; if (ds != null) { foreach (DataTable dt in ds.Tables) { DataGridView grid = new DataGridView(); DataGridViewCellStyle cellStyle = new DataGridViewCellStyle(); grid.AllowUserToAddRows = false; grid.AllowUserToDeleteRows = false; grid.Dock = DockStyle.Fill; grid.Name = "gridResults_" + counter; grid.ReadOnly = true; grid.DataSource = dt; grid.DataError += GridDataError; grid.DefaultCellStyle = cellStyle; cellStyle.NullValue = nullText; cellStyle.Font = CreateDefaultFont(); grid.DataBindingComplete += GridDataBindingComplete; grid.Disposed += GridDisposed; grid.ColumnWidthChanged += OnColumnWidthChanged; TabPage tabPage = new TabPage(); tabPage.Controls.Add(grid); tabPage.Name = "tabPageResults_" + counter; tabPage.Padding = new Padding(3); tabPage.Text = string.Format("{0}/Table {1}", ds.DataSetName, counter); tabPage.UseVisualStyleBackColor = false; _resultsTabControl.TabPages.Add(tabPage); // create a reasonable default max width for columns int maxColWidth = Math.Max(grid.ClientSize.Width / 2, 100); // Autosize the columns then change the widths, gleaned from SO - http://stackoverflow.com/a/1031871/276563 grid.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.DisplayedCells); for (int i = 0; i < grid.Columns.Count; i++) { int columnWidth = grid.Columns[i].Width; grid.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.None; string headerText = grid.Columns[i].HeaderText; if (!string.IsNullOrEmpty(headerText) && _columnSizes.ContainsKey(headerText)) { // use the previous column size in case its been adjusted etc grid.Columns[i].Width = _columnSizes[headerText]; } else { // reset to a the smaller of the 2 sizes, this is mainly for the bigger text columns that throw the size out grid.Columns[i].Width = Math.Min(columnWidth, maxColWidth); if (!string.IsNullOrEmpty(headerText)) { _columnSizes[headerText] = grid.Columns[i].Width; } } } // set the row count for the first tab for now. if (counter == 1) { SetRowCount(dt.Rows.Count); } counter++; } } } if (!string.IsNullOrEmpty(Batch.Messages)) { RichTextBox rtf = new RichTextBox(); rtf.Font = CreateDefaultFont(); rtf.Dock = DockStyle.Fill; rtf.ScrollBars = RichTextBoxScrollBars.ForcedBoth; rtf.Text = Batch.Messages; TabPage tabPage = new TabPage(); tabPage.Controls.Add(rtf); tabPage.Name = "tabPageResults_Messages"; tabPage.Padding = new Padding(3); tabPage.Dock = DockStyle.Fill; tabPage.Text = Resources.Messages; tabPage.UseVisualStyleBackColor = false; _resultsTabControl.TabPages.Add(tabPage); } _resizingGrid = false; } }
internal DataGridViewCellStyleContentChangedEventArgs(DataGridViewCellStyle dataGridViewCellStyle, bool changeAffectsPreferredSize) { this.dataGridViewCellStyle = dataGridViewCellStyle; this.changeAffectsPreferredSize = changeAffectsPreferredSize; }
protected override void Paint( Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) { string upperLabelText = ""; string upperValueText = ""; string lowerLabelText = ""; Image[] lowerValueImg = null; DataGridViewDoubleLineCellValue cellValue = formattedValue as DataGridViewDoubleLineCellValue; if (null != cellValue) { upperLabelText = cellValue.UpperLabelText; upperValueText = cellValue.UpperValueText; lowerLabelText = cellValue.LowerLabelText; lowerValueImg = cellValue.LowerValueImg; } base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value, "", errorText, cellStyle, advancedBorderStyle, paintParts); const int HORSPACE = 32; // 높이 const int HORITEMSPACE = 10; // 아이템 끝나는 좌표 y const int COLNAMESPACE = 46; // 칼럼 이름 시작 좌표 x const int COLITTEMSPACE = 350; // 아이템 끝나는 좌표 x const int ADDCOLITEMSPACE = 50; // 아이템 추가되는 좌표 X const int ICONHOR = 16; // 아이콘 크기 x const int ICONVER = 16; // 아이콘 크기 y //const string strKeyword2 = "True"; StringFormat format = new StringFormat(StringFormatFlags.DirectionRightToLeft); DataGridViewColumn parent = this.OwningColumn; //parent.GridAttributeValues(rowIndex); Font fnt = parent.InheritedStyle.Font; Font cellfnt = cellStyle.Font; if (lowerValueImg != null) { RectangleF newRect = RectangleF.Empty; int addItemspace = 0; for (int i = 0; i < lowerValueImg.Length; i++) { if (i == 0) { newRect = new RectangleF( cellBounds.Left + 315, cellBounds.Y + (HORSPACE) + HORITEMSPACE, ICONHOR, ICONVER); } else { addItemspace += ADDCOLITEMSPACE; newRect = new RectangleF( cellBounds.Left + 315 + addItemspace, cellBounds.Y + (HORSPACE) + HORITEMSPACE, ICONHOR, ICONVER); } graphics.DrawImage(lowerValueImg[i], newRect); } } /* * Image img = null; * if (parent.str3Value == strKeyword2) * { * img = ManagementConsoleWin32.Properties.Resources.icon_account_on; * //graphics.DrawImage( * //ManagementConsoleWin32.Properties.Resources.icon_account_on, newRect); * } * else * { * img = ManagementConsoleWin32.Properties.Resources.icon_account_off; * //graphics.DrawImage( * //ManagementConsoleWin32.Properties.Resources.icon_account_off, newRect); * } * graphics.DrawImage(img, newRect); * /**/ string cellText = formattedValue.ToString(); SizeF textSize = graphics.MeasureString(cellText, fnt); Color textColor = parent.InheritedStyle.ForeColor; if ((cellState & DataGridViewElementStates.Selected) == DataGridViewElementStates.Selected) { textColor = parent.InheritedStyle.SelectionForeColor; } Pen myPen = new Pen(Color.FromArgb(239, 243, 244)); Point first1pt = new Point(cellBounds.Left, cellBounds.Y + HORSPACE); Point first2pt = new Point(cellBounds.Right, cellBounds.Y + HORSPACE); Point second1pt = new Point(cellBounds.Left, cellBounds.Y + (HORSPACE * 2)); Point second2pt = new Point(cellBounds.Right, cellBounds.Y + (HORSPACE * 2)); graphics.DrawLine(myPen, first1pt, first2pt); graphics.DrawLine(myPen, second1pt, second2pt); // Draw the text: using (SolidBrush brush = new SolidBrush(textColor)) { graphics.DrawString( upperLabelText, //parent.TransLang(parent.str2ColName), fnt, brush, cellBounds.X + COLNAMESPACE, cellBounds.Y + HORITEMSPACE); graphics.DrawString( upperValueText, //parent.str2Value, cellfnt, brush, cellBounds.Left + COLITTEMSPACE + ICONVER, cellBounds.Y + HORITEMSPACE, format); graphics.DrawString( lowerLabelText, //parent.TransLang(parent.str3ColName), fnt, brush, cellBounds.X + COLNAMESPACE, cellBounds.Y + (HORSPACE) + HORITEMSPACE); } }
public DataGridViewEditingControlShowingEventArgs (Control control, DataGridViewCellStyle cellStyle) { this.control = control; this.cellStyle = cellStyle; }
public void Ctor_DataGridView_Graphics_Rectangle_Rectangle_Int_Int_DataGridViewElementStates_Object_Object_String_DataGridViewCellStyle_DataGridViewAdvancedBorderStyle_DataGridViewPaintParts(DataGridView dataGridView, Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, int columnIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) { var e = new DataGridViewCellPaintingEventArgs(dataGridView, graphics, clipBounds, cellBounds, rowIndex, columnIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts); Assert.Equal(graphics, e.Graphics); Assert.Equal(clipBounds, e.ClipBounds); Assert.Equal(cellBounds, e.CellBounds); Assert.Equal(rowIndex, e.RowIndex); Assert.Equal(columnIndex, e.ColumnIndex); Assert.Equal(cellState, e.State); Assert.Equal(value, e.Value); Assert.Equal(formattedValue, e.FormattedValue); Assert.Equal(errorText, e.ErrorText); Assert.Equal(cellStyle, e.CellStyle); Assert.Equal(advancedBorderStyle, e.AdvancedBorderStyle); Assert.Equal(paintParts, e.PaintParts); Assert.False(e.Handled); }
public DataGridViewCellFormattingEventArgs (int columnIndex, int rowIndex, object value, Type desiredType, DataGridViewCellStyle cellStyle) : base (value, desiredType) { this.columnIndex = columnIndex; this.rowIndex = rowIndex; this.cellStyle = cellStyle; }
public void ApplyCellStyleToEditingControl(DataGridViewCellStyle dataGridViewCellStyle) { this.Font = dataGridViewCellStyle.Font; this.ForeColor = dataGridViewCellStyle.ForeColor; this.BackColor = dataGridViewCellStyle.BackColor; }
// Constructors public DataGridViewRowPostPaintEventArgs(DataGridView dataGridView, System.Drawing.Graphics graphics, System.Drawing.Rectangle clipBounds, System.Drawing.Rectangle rowBounds, int rowIndex, DataGridViewElementStates rowState, string errorText, DataGridViewCellStyle inheritedRowStyle, bool isFirstDisplayedRow, bool isLastVisibleRow) {}
public void BuildColums() { dataGridView1.AutoGenerateColumns = false; dataGridView1.RowHeadersVisible = true; dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dataGridView1.AllowUserToAddRows = false; DataGridViewCellStyle CellStyle = new DataGridViewCellStyle() { Font = new Font("宋体", 12) }; dataGridView1.DefaultCellStyle = CellStyle; dataGridView1.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; dataGridView1.BackgroundColor = System.Drawing.SystemColors.Control; dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.DisplayedCellsExceptHeaders; dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCellsExceptHeader; dataGridView1.DefaultCellStyle.WrapMode = DataGridViewTriState.True; System.Windows.Forms.DataGridViewCellStyle dgCellStyle_MiddleCenter = new System.Windows.Forms.DataGridViewCellStyle(); dgCellStyle_MiddleCenter.Alignment = DataGridViewContentAlignment.MiddleCenter; System.Windows.Forms.DataGridViewCellStyle dgCellStyle_MiddleR = new System.Windows.Forms.DataGridViewCellStyle(); dgCellStyle_MiddleR.Alignment = DataGridViewContentAlignment.BottomRight; var c0 = new System.Windows.Forms.DataGridViewTextBoxColumn(); c0.ReadOnly = true; c0.DataPropertyName = "Id"; c0.DefaultCellStyle = dgCellStyle_MiddleCenter; c0.HeaderText = "订单号"; c0.MinimumWidth = 90; c0.Name = "order_no"; c0.Visible = false; var c1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); c1.ReadOnly = true; c1.DataPropertyName = "order_no"; c1.DefaultCellStyle = dgCellStyle_MiddleCenter; c1.HeaderText = "订单号"; c1.MinimumWidth = 90; c1.Name = "order_no"; var c2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); c2.ReadOnly = true; c2.DataPropertyName = "Issue"; c2.DefaultCellStyle = dgCellStyle_MiddleCenter; c2.HeaderText = "期号"; c2.MinimumWidth = 70; c2.Width = 70; c2.Name = "issue"; var c3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); c3.ReadOnly = true; c3.DataPropertyName = "customername"; c3.DefaultCellStyle = dgCellStyle_MiddleCenter; c3.HeaderText = "客户"; c3.MinimumWidth = 80; c3.Width = 60; c3.Name = "Num1_Code"; var c4 = new System.Windows.Forms.DataGridViewTextBoxColumn(); c4.ReadOnly = true; c4.DataPropertyName = "ordertypename"; c4.DefaultCellStyle = dgCellStyle_MiddleCenter; c4.HeaderText = "玩法"; c4.MinimumWidth = 80; c4.Width = 60; c4.Name = "Num2_Code"; var c5 = new System.Windows.Forms.DataGridViewTextBoxColumn(); c5.ReadOnly = true; c5.DataPropertyName = "total_in_money"; c5.DefaultCellStyle = dgCellStyle_MiddleCenter; c5.HeaderText = "金额"; c5.MinimumWidth = 70; c5.Width = 60; c5.Name = "Num3_Code"; var c7 = new System.Windows.Forms.DataGridViewTextBoxColumn(); c7.ReadOnly = true; c7.DataPropertyName = "ischeckname"; c7.DefaultCellStyle = dgCellStyle_MiddleCenter; c7.HeaderText = "校验"; c7.MinimumWidth = 70; c7.Width = 60; c7.Name = "Num5_Code"; var c8 = new System.Windows.Forms.DataGridViewTextBoxColumn(); c8.ReadOnly = true; c8.DataPropertyName = "statusname"; c8.DefaultCellStyle = dgCellStyle_MiddleCenter; c8.HeaderText = "中奖"; c8.MinimumWidth = 70; c8.Width = 60; c8.Name = "Num6_Code"; var c6 = new System.Windows.Forms.DataGridViewTextBoxColumn(); c6.ReadOnly = true; c6.DataPropertyName = "CreateTime"; c6.DefaultCellStyle = dgCellStyle_MiddleCenter; c6.HeaderText = "创建时间"; c6.MinimumWidth = 120; c6.Width = 60; c6.Name = "Num4_Code"; this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { c0, c1, c2, c3, c4, c5, c7, c8, c6 }); }
// Methods public virtual void ApplyStyle(DataGridViewCellStyle dataGridViewCellStyle) {}
/* * protected override void PaintBorder(Graphics graphics, Rectangle clipBounds, Rectangle bounds, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle) * { * if (Span.SpanPos == SpanPosition.NoSpan) * { * base.PaintBorder(graphics, clipBounds, bounds, cellStyle, advancedBorderStyle); * } * else if (Span.SpanPos == SpanPosition.SpanBase) * { * * base.PaintBorder(graphics, clipBounds, Span.GetSpanBaseRect(), cellStyle, advancedBorderStyle); * * * }else if(Span.SpanPos == SpanPosition.Spanned){ * base.PaintBorder(graphics, clipBounds, Span.GetSpanBaseRect(), cellStyle, advancedBorderStyle); * * } * else * { * * } * } */ protected override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle clipBounds, System.Drawing.Rectangle initCellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) { //IEasyGridCell baseCell = GetSpanBaseCell(); //DataGridViewCell cell = baseCell as DataGridViewCell; //cellStyle.BackColor = CellFunctions.BackColor(this); //String text = this.Text; Span.Paint(base.Paint, g, clipBounds, initCellBounds, rowIndex, cellState, value, formattedValue, ToolTipText, cellStyle, advancedBorderStyle, paintParts); }
// Constructors public DataGridViewCellParsingEventArgs(int rowIndex, int columnIndex, object value, Type desiredType, DataGridViewCellStyle inheritedCellStyle) {}
private void DebugWindow_Load(object sender, EventArgs e) { data.AutoGenerateColumns = true; string Password = (!String.IsNullOrEmpty(FileAccountSave.UserHashedPassword)) ? "True" : "False"; string ProxyStatus = (!String.IsNullOrEmpty(FileSettingsSave.Proxy)) ? "False" : "True"; string RPCStatus = (!String.IsNullOrEmpty(FileSettingsSave.RPC)) ? "False" : "True"; string Antivirus = String.Empty; string Firewall = String.Empty; string AntiSpyware = String.Empty; if (!DetectLinux.LinuxDetected()) { try { Antivirus = (String.IsNullOrEmpty(SecurityCenter("AntiVirusProduct"))) ? "---" : SecurityCenter("AntiVirusProduct"); Firewall = (String.IsNullOrEmpty(SecurityCenter("FirewallProduct"))) ? "Built-In" : SecurityCenter("FirewallProduct"); AntiSpyware = (String.IsNullOrEmpty(SecurityCenter("AntiSpywareProduct"))) ? "---" : SecurityCenter("AntiSpywareProduct"); } catch { Antivirus = "Unknown"; Firewall = "Unknown"; AntiSpyware = "Unknown"; } } string OS = ""; if (DetectLinux.LinuxDetected()) { OS = DetectLinux.Distro(); } else { OS = Environment.OSVersion.VersionString; } string UpdateSkip = ""; if (FileSettingsSave.IgnoreVersion == Application.ProductVersion || FileSettingsSave.IgnoreVersion == String.Empty) { UpdateSkip = "False"; } else { UpdateSkip = FileSettingsSave.IgnoreVersion; } string FirewallRuleStatus = ""; if (String.IsNullOrEmpty(FileSettingsSave.FirewallStatus)) { FirewallRuleStatus = "Not Exlcuded"; } else { FirewallRuleStatus = FileSettingsSave.FirewallStatus; } long memKb = 0; ulong lpFreeBytesAvailable = 0; List <string> GPUs = new List <string>(); string Win32_Processor = ""; if (!DetectLinux.LinuxDetected()) { Kernel32.GetPhysicallyInstalledSystemMemory(out memKb); ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT Name FROM Win32_VideoController"); string graphicsCard = string.Empty; foreach (ManagementObject mo in searcher.Get()) { foreach (PropertyData property in mo.Properties) { GPUs.Add(property.Value.ToString()); } } Win32_Processor = (from x in new ManagementObjectSearcher("SELECT Name FROM Win32_Processor").Get().Cast <ManagementObject>() select x.GetPropertyValue("Name")).FirstOrDefault().ToString(); Kernel32.GetDiskFreeSpaceEx(FileSettingsSave.GameInstallation, out lpFreeBytesAvailable, out ulong lpTotalNumberOfBytes, out ulong lpTotalNumberOfFreeBytes); } var Win32_VideoController = string.Join(" | ", GPUs); var settings = new List <ListType> { new ListType { Name = "InstallationDirectory", Value = FileSettingsSave.GameInstallation }, new ListType { Name = "Launcher Version", Value = Application.ProductVersion }, new ListType { Name = "Credentials Saved", Value = Password }, new ListType { Name = "Language", Value = FileSettingsSave.Lang }, new ListType { Name = "Skipping Update", Value = UpdateSkip }, new ListType { Name = "Disable Proxy", Value = ProxyStatus }, new ListType { Name = "Disable RPC", Value = RPCStatus }, new ListType { Name = "Firewall Rule", Value = FirewallRuleStatus }, new ListType { Name = "", Value = "" }, new ListType { Name = "Server Name", Value = ServerName }, new ListType { Name = "Server Address", Value = ServerIP }, new ListType { Name = "CDN Address", Value = FileSettingsSave.CDN }, new ListType { Name = "ProxyPort", Value = ServerProxy.ProxyPort.ToString() }, new ListType { Name = "", Value = "" }, }; if (!DetectLinux.LinuxDetected()) { settings.AddRange(new[] { new ListType { Name = "Antivirus", Value = Antivirus }, new ListType { Name = "Firewall Application", Value = Firewall }, new ListType { Name = "AntiSpyware", Value = AntiSpyware }, new ListType { Name = "", Value = "" }, new ListType { Name = "CPU", Value = Win32_Processor }, new ListType { Name = "GPU", Value = Win32_VideoController }, new ListType { Name = "RAM", Value = (memKb / 1024).ToString() + "MB" }, new ListType { Name = "Disk Space Left", Value = FormatFileSize(lpFreeBytesAvailable) }, new ListType { Name = "", Value = "" } }); } settings.AddRange(new[] { new ListType { Name = "HWID", Value = HardwareID.FingerPrint.Value() }, new ListType { Name = "Operating System", Value = OS }, new ListType { Name = "Environment Version", Value = Environment.OSVersion.Version.ToString() }, new ListType { Name = "Screen Resolution", Value = Screen.PrimaryScreen.Bounds.Width + "x" + Screen.PrimaryScreen.Bounds.Height } }); data.DataSource = settings; DataGridViewCellStyle style = new DataGridViewCellStyle { Font = new Font(data.Font, FontStyle.Regular) }; data.Columns[0].DefaultCellStyle = style; data.Columns[0].Width += 50; int size_x = 452; int size_y = 580; data.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.Size = new Size(size_x, size_y); }
// Constructors public DataGridViewCellFormattingEventArgs(int columnIndex, int rowIndex, object value, Type desiredType, DataGridViewCellStyle cellStyle) {}
protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts) { PoolHostDataGridViewOneCheckboxRow row = (PoolHostDataGridViewOneCheckboxRow)this.OwningRow; if (value is Host || value is Pool) { Image hostIcon = Images.GetImage16For(value as IXenObject); var iconIndent = row.IsCheckable ? 0 : 16; var textIndent = iconIndent + 16; base.Paint(graphics, clipBounds, new Rectangle(cellBounds.X + textIndent, cellBounds.Y, cellBounds.Width - textIndent, cellBounds.Height), rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts); if ((cellState & DataGridViewElementStates.Selected) != 0 && row.Enabled) { using (var brush = new SolidBrush(DataGridView.DefaultCellStyle.SelectionBackColor)) graphics.FillRectangle( brush, cellBounds.X, cellBounds.Y, hostIcon.Width + iconIndent, cellBounds.Height); } else { //Background behind the host icon using (var brush = new SolidBrush(this.DataGridView.DefaultCellStyle.BackColor)) graphics.FillRectangle(brush, cellBounds.X, cellBounds.Y, hostIcon.Width + iconIndent, cellBounds.Height); } if (row.Enabled) { graphics.DrawImage(hostIcon, cellBounds.X + iconIndent, cellBounds.Y + 3, hostIcon.Width, hostIcon.Height); } else { graphics.DrawImage(hostIcon, new Rectangle(cellBounds.X + iconIndent, cellBounds.Y + 3, hostIcon.Width, hostIcon.Height), 0, 0, hostIcon.Width, hostIcon.Height, GraphicsUnit.Pixel, Drawing.GreyScaleAttributes); } } else { base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts); } }
public virtual DataGridViewCellStyle GetInheritedStyle(DataGridViewCellStyle inheritedCellStyle, int rowIndex, bool includeColors) {}
/// <summary> /// Creates or updates a <see cref="DataGridViewSummaryRow"/> for each group limited by the /// values in the columns from <paramref name="groupFromCol"/> to <paramref name="groupToCol"/>. /// </summary> /// <param name="grid">Extension class.</param> /// <param name="summaryType">Determines the aggregation type.</param> /// <param name="summaryPosition">Indicates the position of the <see cref="DataGridViewSummaryRow"/>.</param> /// <param name="groupFromCol">Name of the first column that determines the group break values.</param> /// <param name="groupToCol">Name of the last column that determines the group break values.</param> /// <param name="summaryCol">Name of the column to aggregate.</param> /// <param name="style">Optional <see cref="DataGridViewCellStyle"/> for the summary rows.</param> /// <returns>Array of the <see cref="DataGridViewSummaryRow"/> rows displaying the aggregated values.</returns> public static DataGridViewSummaryRow[] AddSummaryRows(this DataGridView grid, SummaryType summaryType, SummaryRowPosition summaryPosition, string groupFromCol, string groupToCol, string summaryCol, DataGridViewCellStyle style = null) { return(AddSummaryRows( grid, summaryType, summaryPosition, String.IsNullOrEmpty(groupFromCol) ? null : grid.Columns[groupFromCol], String.IsNullOrEmpty(groupToCol) ? null : grid.Columns[groupToCol], String.IsNullOrEmpty(summaryCol) ? null : grid.Columns[summaryCol], style)); }
public virtual object ParseFormattedValue(object formattedValue, DataGridViewCellStyle cellStyle, System.ComponentModel.TypeConverter formattedValueTypeConverter, System.ComponentModel.TypeConverter valueTypeConverter) {}
private void SayfayıDoldur(bool tarihBazli) { DatabaseClass database = new DatabaseClass(); datagrid1Doldur(database, tarihBazli); datagrid2Doldur(database, tarihBazli); try { veresiyeDurumu(); toplamGoster(); veresiyeDoldur(); raporDoldur(); } catch (Exception) { } int num = 0; while (true) { if (num >= (this.dataGridView1.Rows.Count)) { for (int i = 0; i < (this.dataGridView2.Rows.Count); i++) { DataGridViewCellStyle style2 = new DataGridViewCellStyle(); if (this.dataGridView2.Rows[i].Cells[0].Value.Equals("TOPLAM :")) { style2.BackColor = Color.Green; style2.ForeColor = Color.White; } if ((i == (this.dataGridView2.Rows.Count - 2))) { style2.BackColor = Color.White; style2.ForeColor = Color.White; } if ((i == (this.dataGridView2.Rows.Count - 3))) { style2.BackColor = Color.White; style2.ForeColor = Color.White; } this.dataGridView2.Rows[i].DefaultCellStyle = style2; } for (int i = 0; i < (this.dataGridView3.Rows.Count); i++) { DataGridViewCellStyle style3 = new DataGridViewCellStyle(); if ((i == (this.dataGridView3.Rows.Count - 1))) { style3.BackColor = Color.White; style3.ForeColor = Color.White; } this.dataGridView3.Rows[i].DefaultCellStyle = style3; } return; } DataGridViewCellStyle style = new DataGridViewCellStyle(); if (this.dataGridView1.Rows[num].Cells[0].Value.Equals("TOPLAM :")) { style.BackColor = Color.Green; style.ForeColor = Color.White; } if ((num == (this.dataGridView1.Rows.Count - 2))) { style.BackColor = Color.White; style.ForeColor = Color.White; } if ((num == (this.dataGridView1.Rows.Count - 3))) { style.BackColor = Color.White; style.ForeColor = Color.White; } this.dataGridView1.Rows[num].DefaultCellStyle = style; num++; } }
public virtual System.Drawing.Rectangle PositionEditingPanel(System.Drawing.Rectangle cellBounds, System.Drawing.Rectangle cellClip, DataGridViewCellStyle cellStyle, bool singleVerticalBorderAdded, bool singleHorizontalBorderAdded, bool isFirstDisplayedColumn, bool isFirstDisplayedRow) {}
/// <summary> /// Customized implementation of the GetErrorIconBounds function in order to draw the potential /// error icon next to the up/down buttons and not on top of them. /// </summary> protected override Rectangle GetErrorIconBounds(Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex) { const int ButtonsWidth = 16; Rectangle errorIconBounds = base.GetErrorIconBounds(graphics, cellStyle, rowIndex); if (this.DataGridView.RightToLeft == RightToLeft.Yes) { errorIconBounds.X = errorIconBounds.Left + ButtonsWidth; } else { errorIconBounds.X = errorIconBounds.Left - ButtonsWidth; } return errorIconBounds; }
/// <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() { DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle(); DataGridViewCellStyle dataGridViewCellStyle2 = new DataGridViewCellStyle(); DataGridViewCellStyle dataGridViewCellStyle3 = new DataGridViewCellStyle(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmDetailsProviding)); this.btnApply = new Button(); this.btnClose = new Button(); this.drgList = new DataGridView(); this.lstIDTmp = new ListBox(); ((System.ComponentModel.ISupportInitialize)(this.drgList)).BeginInit(); this.SuspendLayout(); // // btnApply // this.btnApply.Location = new System.Drawing.Point(12, 330); this.btnApply.Name = "btnApply"; this.btnApply.Size = new System.Drawing.Size(160, 23); this.btnApply.TabIndex = 3; this.btnApply.Text = "Chấp nhận thay đổi"; this.btnApply.UseVisualStyleBackColor = true; this.btnApply.Click += new System.EventHandler(this.BtnApplyClick); // // btnClose // this.btnClose.DialogResult = DialogResult.Cancel; this.btnClose.Location = new System.Drawing.Point(311, 330); this.btnClose.Name = "btnClose"; this.btnClose.Size = new System.Drawing.Size(164, 23); this.btnClose.TabIndex = 4; this.btnClose.Text = "Đóng của sổ"; this.btnClose.UseVisualStyleBackColor = true; this.btnClose.Click += new System.EventHandler(this.BtnCloseClick); // // drgList // dataGridViewCellStyle1.Alignment = DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle1.WrapMode = DataGridViewTriState.True; this.drgList.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; this.drgList.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dataGridViewCellStyle2.Alignment = DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window; dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText; dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle2.WrapMode = DataGridViewTriState.True; this.drgList.DefaultCellStyle = dataGridViewCellStyle2; this.drgList.Location = new System.Drawing.Point(0, 0); this.drgList.Name = "drgList"; dataGridViewCellStyle3.Alignment = DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control; dataGridViewCellStyle3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText; dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle3.WrapMode = DataGridViewTriState.True; this.drgList.RowHeadersDefaultCellStyle = dataGridViewCellStyle3; this.drgList.RowTemplate.Resizable = DataGridViewTriState.True; this.drgList.Size = new System.Drawing.Size(488, 324); this.drgList.TabIndex = 5; // // lstIDTmp // this.lstIDTmp.FormattingEnabled = true; this.lstIDTmp.Location = new System.Drawing.Point(523, 12); this.lstIDTmp.Name = "lstIDTmp"; this.lstIDTmp.Size = new System.Drawing.Size(59, 186); this.lstIDTmp.TabIndex = 6; this.lstIDTmp.Visible = false; // // frmDetailsProviding // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = AutoScaleMode.Font; this.CancelButton = this.btnClose; this.ClientSize = new System.Drawing.Size(492, 357); this.ControlBox = false; this.Controls.Add(this.lstIDTmp); this.Controls.Add(this.drgList); this.Controls.Add(this.btnClose); this.Controls.Add(this.btnApply); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.KeyPreview = true; this.Name = "frmDetailsProviding"; this.Text = "Form1"; ((System.ComponentModel.ISupportInitialize)(this.drgList)).EndInit(); this.ResumeLayout(false); }
/// <summary> /// Creates or updates a <see cref="DataGridViewSummaryRow"/> for each group limited by the /// values in columns <paramref name="groupCol"/>. /// </summary> /// <param name="grid">Extension class.</param> /// <param name="summaryType">Determines the aggregation type.</param> /// <param name="summaryPosition">Indicates the position of the <see cref="DataGridViewSummaryRow"/>.</param> /// <param name="groupCol">Column that determines the group break values.</param> /// <param name="summaryCol">Column to aggregate.</param> /// <param name="style">Optional <see cref="DataGridViewCellStyle"/> for the summary rows.</param> /// <returns>Array of the <see cref="DataGridViewSummaryRow"/> rows displaying the aggregated values.</returns> public static DataGridViewSummaryRow[] AddSummaryRows(this DataGridView grid, SummaryType summaryType, SummaryRowPosition summaryPosition, DataGridViewColumn groupCol, DataGridViewColumn summaryCol, DataGridViewCellStyle style = null) { return(AddSummaryRows( grid, summaryType, summaryPosition, groupCol, groupCol, summaryCol, style)); }
public DataGridViewCellStyleVWG(DataGridViewCellStyle dataGridViewCellStyle) { _dataGridViewCellStyle = dataGridViewCellStyle; }
private void InitializeComponent() { var DataGridViewCellStyle13 = new DataGridViewCellStyle(); var DataGridViewCellStyle14 = new DataGridViewCellStyle(); var DataGridViewCellStyle16 = new DataGridViewCellStyle(); var DataGridViewCellStyle15 = new DataGridViewCellStyle(); employeeNameLabel = new Label(); dateLabel = new Label(); Label9 = new Label(); TableLayoutPanel3 = new TableLayoutPanel(); Label11 = new Label(); deviceNameLabel = new Label(); siteLocationLabel = new Label(); Label10 = new Label(); Label1 = new Label(); modifiedOnLabel = new Label(); TableLayoutPanel4 = new TableLayoutPanel(); Label6 = new Label(); workDoneLabel = new Label(); Panel4 = new Panel(); _entryDetailsDataGrid = new Bunifu.UI.WinForms.BunifuDataGridView(); _entryDetailsDataGrid.SelectionChanged += new EventHandler(entryDetailsDataGrid_SelectionChanged); reasonLabel = new CustomizedControlsLibrary.ShapedLabel(); _closeLabel = new Label(); _closeLabel.MouseHover += new EventHandler(closeLabel_MouseHover); _closeLabel.MouseLeave += new EventHandler(closeLabel_MouseLeave); _closeLabel.Click += new EventHandler(closeLabel_Click); Label12 = new Label(); Column6 = new DataGridViewTextBoxColumn(); Column1 = new DataGridViewTextBoxColumn(); Column2 = new DataGridViewTextBoxColumn(); Column4 = new DataGridViewTextBoxColumn(); Column3 = new DataGridViewTextBoxColumn(); Column5 = new DataGridViewTextBoxColumn(); Column7 = new DataGridViewTextBoxColumn(); Column8 = new DataGridViewTextBoxColumn(); Column9 = new DataGridViewTextBoxColumn(); Column10 = new DataGridViewTextBoxColumn(); Column11 = new DataGridViewTextBoxColumn(); TableLayoutPanel3.SuspendLayout(); TableLayoutPanel4.SuspendLayout(); Panel4.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)_entryDetailsDataGrid).BeginInit(); SuspendLayout(); // // employeeNameLabel // employeeNameLabel.BackColor = Color.White; employeeNameLabel.Font = new Font("Segoe UI Semibold", 13.74545f, FontStyle.Bold, GraphicsUnit.Point, Conversions.ToByte(0)); employeeNameLabel.ForeColor = Color.FromArgb(Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64))); employeeNameLabel.Location = new Point(45, 49); employeeNameLabel.Margin = new Padding(1, 0, 1, 0); employeeNameLabel.Name = "employeeNameLabel"; employeeNameLabel.Size = new Size(319, 39); employeeNameLabel.TabIndex = 11; employeeNameLabel.Text = "John Doe"; employeeNameLabel.TextAlign = ContentAlignment.MiddleLeft; // // dateLabel // dateLabel.BackColor = Color.White; dateLabel.BorderStyle = BorderStyle.FixedSingle; dateLabel.Font = new Font("Segoe UI Semibold", 11.78182f, FontStyle.Bold, GraphicsUnit.Point, Conversions.ToByte(0)); dateLabel.ForeColor = Color.DimGray; dateLabel.Location = new Point(225, 89); dateLabel.Margin = new Padding(1, 0, 1, 0); dateLabel.Name = "dateLabel"; dateLabel.Size = new Size(165, 33); dateLabel.TabIndex = 16; dateLabel.Text = "Jan 9, 2019"; dateLabel.TextAlign = ContentAlignment.MiddleCenter; // // Label9 // Label9.AutoSize = true; Label9.Font = new Font("Segoe UI Semibold", 11.78182f, FontStyle.Bold); Label9.Location = new Point(59, 359); Label9.Margin = new Padding(1, 0, 1, 0); Label9.Name = "Label9"; Label9.Size = new Size(63, 25); Label9.TabIndex = 14; Label9.Text = "Notes"; // // TableLayoutPanel3 // TableLayoutPanel3.ColumnCount = 2; TableLayoutPanel3.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 42.71844f)); TableLayoutPanel3.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 57.28156f)); TableLayoutPanel3.Controls.Add(Label11, 0, 0); TableLayoutPanel3.Controls.Add(deviceNameLabel, 1, 1); TableLayoutPanel3.Controls.Add(siteLocationLabel, 1, 0); TableLayoutPanel3.Controls.Add(Label10, 0, 1); TableLayoutPanel3.Controls.Add(Label1, 0, 2); TableLayoutPanel3.Controls.Add(modifiedOnLabel, 1, 2); TableLayoutPanel3.Location = new Point(590, 120); TableLayoutPanel3.Margin = new Padding(1); TableLayoutPanel3.Name = "TableLayoutPanel3"; TableLayoutPanel3.RowCount = 3; TableLayoutPanel3.RowStyles.Add(new RowStyle(SizeType.Percent, 33.33333f)); TableLayoutPanel3.RowStyles.Add(new RowStyle(SizeType.Percent, 35.10638f)); TableLayoutPanel3.RowStyles.Add(new RowStyle(SizeType.Percent, 31.91489f)); TableLayoutPanel3.Size = new Size(412, 94); TableLayoutPanel3.TabIndex = 18; // // Label11 // Label11.Anchor = AnchorStyles.Top | AnchorStyles.Right; Label11.AutoSize = true; Label11.BackColor = Color.White; Label11.Font = new Font("Segoe UI Semibold", 11.78182f, FontStyle.Bold, GraphicsUnit.Point, Conversions.ToByte(0)); Label11.ForeColor = Color.FromArgb(Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64))); Label11.Location = new Point(47, 0); Label11.Margin = new Padding(1, 0, 1, 0); Label11.Name = "Label11"; Label11.Size = new Size(127, 25); Label11.TabIndex = 1; Label11.Text = "Site Location:"; Label11.TextAlign = ContentAlignment.MiddleCenter; // // deviceNameLabel // deviceNameLabel.AutoSize = true; deviceNameLabel.BackColor = Color.White; deviceNameLabel.Font = new Font("Segoe UI", 11.78182f, FontStyle.Regular, GraphicsUnit.Point, Conversions.ToByte(0)); deviceNameLabel.Location = new Point(176, 31); deviceNameLabel.Margin = new Padding(1, 0, 1, 0); deviceNameLabel.Name = "deviceNameLabel"; deviceNameLabel.Size = new Size(45, 25); deviceNameLabel.TabIndex = 13; deviceNameLabel.Text = "N/A"; deviceNameLabel.TextAlign = ContentAlignment.MiddleCenter; // // siteLocationLabel // siteLocationLabel.AutoSize = true; siteLocationLabel.BackColor = Color.White; siteLocationLabel.Font = new Font("Segoe UI", 11.78182f, FontStyle.Regular, GraphicsUnit.Point, Conversions.ToByte(0)); siteLocationLabel.Location = new Point(176, 0); siteLocationLabel.Margin = new Padding(1, 0, 1, 0); siteLocationLabel.Name = "siteLocationLabel"; siteLocationLabel.Size = new Size(45, 25); siteLocationLabel.TabIndex = 11; siteLocationLabel.Text = "N/A"; siteLocationLabel.TextAlign = ContentAlignment.MiddleCenter; // // Label10 // Label10.Anchor = AnchorStyles.Top | AnchorStyles.Right; Label10.BackColor = Color.White; Label10.Font = new Font("Segoe UI Semibold", 11.78182f, FontStyle.Bold, GraphicsUnit.Point, Conversions.ToByte(0)); Label10.ForeColor = Color.FromArgb(Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64))); Label10.Location = new Point(1, 31); Label10.Margin = new Padding(1, 0, 1, 0); Label10.Name = "Label10"; Label10.Size = new Size(173, 27); Label10.TabIndex = 12; Label10.Text = "Device Name:"; Label10.TextAlign = ContentAlignment.MiddleRight; // // Label1 // Label1.Anchor = AnchorStyles.Top | AnchorStyles.Right; Label1.BackColor = Color.White; Label1.Font = new Font("Segoe UI Semibold", 11.78182f, FontStyle.Bold, GraphicsUnit.Point, Conversions.ToByte(0)); Label1.ForeColor = Color.FromArgb(Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64))); Label1.Location = new Point(1, 63); Label1.Margin = new Padding(1, 0, 1, 0); Label1.Name = "Label1"; Label1.Size = new Size(173, 27); Label1.TabIndex = 14; Label1.Text = "Modification Date:"; Label1.TextAlign = ContentAlignment.MiddleRight; // // modifiedOnLabel // modifiedOnLabel.AutoSize = true; modifiedOnLabel.BackColor = Color.White; modifiedOnLabel.Font = new Font("Segoe UI", 11.78182f, FontStyle.Regular, GraphicsUnit.Point, Conversions.ToByte(0)); modifiedOnLabel.Location = new Point(176, 63); modifiedOnLabel.Margin = new Padding(1, 0, 1, 0); modifiedOnLabel.Name = "modifiedOnLabel"; modifiedOnLabel.Size = new Size(45, 25); modifiedOnLabel.TabIndex = 15; modifiedOnLabel.Text = "N/A"; modifiedOnLabel.TextAlign = ContentAlignment.MiddleCenter; // // TableLayoutPanel4 // TableLayoutPanel4.ColumnCount = 2; TableLayoutPanel4.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50.2994f)); TableLayoutPanel4.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 234.0f)); TableLayoutPanel4.Controls.Add(Label6, 0, 0); TableLayoutPanel4.Controls.Add(workDoneLabel, 1, 0); TableLayoutPanel4.Location = new Point(590, 230); TableLayoutPanel4.Margin = new Padding(1); TableLayoutPanel4.Name = "TableLayoutPanel4"; TableLayoutPanel4.RowCount = 1; TableLayoutPanel4.RowStyles.Add(new RowStyle(SizeType.Percent, 20.625f)); TableLayoutPanel4.RowStyles.Add(new RowStyle(SizeType.Absolute, 130.0f)); TableLayoutPanel4.Size = new Size(412, 130); TableLayoutPanel4.TabIndex = 19; // // Label6 // Label6.Anchor = AnchorStyles.Top | AnchorStyles.Right; Label6.AutoSize = true; Label6.BackColor = Color.White; Label6.Font = new Font("Segoe UI Semibold", 11.78182f, FontStyle.Bold, GraphicsUnit.Point, Conversions.ToByte(0)); Label6.ForeColor = Color.FromArgb(Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64))); Label6.Location = new Point(19, 0); Label6.Margin = new Padding(1, 0, 1, 0); Label6.Name = "Label6"; Label6.Size = new Size(158, 25); Label6.TabIndex = 1; Label6.Text = "Work Performed:"; Label6.TextAlign = ContentAlignment.MiddleRight; // // workDoneLabel // workDoneLabel.AutoSize = true; workDoneLabel.BackColor = Color.White; workDoneLabel.Font = new Font("Segoe UI", 11.78182f, FontStyle.Regular, GraphicsUnit.Point, Conversions.ToByte(0)); workDoneLabel.Location = new Point(179, 0); workDoneLabel.Margin = new Padding(1, 0, 1, 0); workDoneLabel.Name = "workDoneLabel"; workDoneLabel.Size = new Size(45, 25); workDoneLabel.TabIndex = 12; workDoneLabel.Text = "N/A"; workDoneLabel.TextAlign = ContentAlignment.MiddleCenter; // // Panel4 // Panel4.Anchor = AnchorStyles.Top; Panel4.BorderStyle = BorderStyle.FixedSingle; Panel4.Controls.Add(_entryDetailsDataGrid); Panel4.Location = new Point(42, 120); Panel4.Name = "Panel4"; Panel4.Size = new Size(543, 218); Panel4.TabIndex = 111; // // entryDetailsDataGrid // _entryDetailsDataGrid.AllowCustomTheming = true; _entryDetailsDataGrid.AllowUserToAddRows = false; _entryDetailsDataGrid.AllowUserToDeleteRows = false; _entryDetailsDataGrid.AllowUserToResizeRows = false; DataGridViewCellStyle13.BackColor = Color.White; DataGridViewCellStyle13.ForeColor = Color.Black; DataGridViewCellStyle13.SelectionBackColor = Color.FromArgb(Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64))); _entryDetailsDataGrid.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle13; _entryDetailsDataGrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; _entryDetailsDataGrid.BackgroundColor = Color.White; _entryDetailsDataGrid.BorderStyle = BorderStyle.None; _entryDetailsDataGrid.CellBorderStyle = DataGridViewCellBorderStyle.SingleHorizontal; _entryDetailsDataGrid.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.None; DataGridViewCellStyle14.Alignment = DataGridViewContentAlignment.MiddleLeft; DataGridViewCellStyle14.BackColor = Color.FromArgb(Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64))); DataGridViewCellStyle14.Font = new Font("Segoe UI Semibold", 11.75f, FontStyle.Bold); DataGridViewCellStyle14.ForeColor = Color.White; DataGridViewCellStyle14.SelectionBackColor = Color.FromArgb(Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64))); DataGridViewCellStyle14.SelectionForeColor = SystemColors.HighlightText; DataGridViewCellStyle14.WrapMode = DataGridViewTriState.True; _entryDetailsDataGrid.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle14; _entryDetailsDataGrid.ColumnHeadersHeight = 40; _entryDetailsDataGrid.Columns.AddRange(new DataGridViewColumn[] { Column6, Column1, Column2, Column4, Column3, Column5, Column7, Column8, Column9, Column10, Column11 }); _entryDetailsDataGrid.CurrentTheme.AlternatingRowsStyle.BackColor = Color.White; _entryDetailsDataGrid.CurrentTheme.AlternatingRowsStyle.Font = new Font("Segoe UI Semibold", 9.75f, FontStyle.Bold); _entryDetailsDataGrid.CurrentTheme.AlternatingRowsStyle.ForeColor = Color.Black; _entryDetailsDataGrid.CurrentTheme.AlternatingRowsStyle.SelectionBackColor = Color.FromArgb(Conversions.ToInteger(Conversions.ToByte(224)), Conversions.ToInteger(Conversions.ToByte(224)), Conversions.ToInteger(Conversions.ToByte(224))); _entryDetailsDataGrid.CurrentTheme.AlternatingRowsStyle.SelectionForeColor = Color.Black; _entryDetailsDataGrid.CurrentTheme.BackColor = Color.Snow; _entryDetailsDataGrid.CurrentTheme.GridColor = Color.Gray; _entryDetailsDataGrid.CurrentTheme.HeaderStyle.BackColor = Color.FromArgb(Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64))); _entryDetailsDataGrid.CurrentTheme.HeaderStyle.Font = new Font("Segoe UI Semibold", 11.75f, FontStyle.Bold); _entryDetailsDataGrid.CurrentTheme.HeaderStyle.ForeColor = Color.White; _entryDetailsDataGrid.CurrentTheme.Name = null; _entryDetailsDataGrid.CurrentTheme.RowsStyle.BackColor = Color.WhiteSmoke; _entryDetailsDataGrid.CurrentTheme.RowsStyle.Font = new Font("Segoe UI Semibold", 9.75f, FontStyle.Bold); _entryDetailsDataGrid.CurrentTheme.RowsStyle.ForeColor = Color.Black; _entryDetailsDataGrid.CurrentTheme.RowsStyle.SelectionBackColor = Color.Gray; _entryDetailsDataGrid.CurrentTheme.RowsStyle.SelectionForeColor = Color.Black; DataGridViewCellStyle16.Alignment = DataGridViewContentAlignment.MiddleLeft; DataGridViewCellStyle16.BackColor = Color.WhiteSmoke; DataGridViewCellStyle16.Font = new Font("Segoe UI Semibold", 9.75f, FontStyle.Bold); DataGridViewCellStyle16.ForeColor = Color.Black; DataGridViewCellStyle16.SelectionBackColor = Color.Gray; DataGridViewCellStyle16.SelectionForeColor = Color.Black; DataGridViewCellStyle16.WrapMode = DataGridViewTriState.False; _entryDetailsDataGrid.DefaultCellStyle = DataGridViewCellStyle16; _entryDetailsDataGrid.Dock = DockStyle.Fill; _entryDetailsDataGrid.EnableHeadersVisualStyles = false; _entryDetailsDataGrid.GridColor = Color.Gray; _entryDetailsDataGrid.HeaderBackColor = Color.FromArgb(Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64))); _entryDetailsDataGrid.HeaderBgColor = Color.Empty; _entryDetailsDataGrid.HeaderForeColor = Color.White; _entryDetailsDataGrid.Location = new Point(0, 0); _entryDetailsDataGrid.Name = "_entryDetailsDataGrid"; _entryDetailsDataGrid.ReadOnly = true; _entryDetailsDataGrid.RowHeadersVisible = false; _entryDetailsDataGrid.RowTemplate.DefaultCellStyle.SelectionBackColor = Color.Gray; _entryDetailsDataGrid.RowTemplate.Height = 40; _entryDetailsDataGrid.SelectionMode = DataGridViewSelectionMode.FullRowSelect; _entryDetailsDataGrid.Size = new Size(541, 216); _entryDetailsDataGrid.TabIndex = 57; _entryDetailsDataGrid.Theme = Bunifu.UI.WinForms.BunifuDataGridView.PresetThemes.Dark; // // reasonLabel // reasonLabel.BackColor = Color.PapayaWhip; reasonLabel.BorderColor = Color.White; reasonLabel.Edge = 50; reasonLabel.Font = new Font("Segoe UI", 11.78182f, FontStyle.Regular, GraphicsUnit.Point, Conversions.ToByte(0)); reasonLabel.Location = new Point(59, 387); reasonLabel.Name = "reasonLabel"; reasonLabel.Padding = new Padding(5); reasonLabel.Size = new Size(686, 105); reasonLabel.TabIndex = 112; reasonLabel.Text = "N/A"; // // closeLabel // _closeLabel.Anchor = AnchorStyles.Top | AnchorStyles.Right; _closeLabel.BackColor = Color.FromArgb(Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64))); _closeLabel.Font = new Font("Arial Narrow", 22.25455f, FontStyle.Regular, GraphicsUnit.Point, Conversions.ToByte(0)); _closeLabel.ForeColor = Color.White; _closeLabel.Location = new Point(981, 0); _closeLabel.Margin = new Padding(0); _closeLabel.Name = "_closeLabel"; _closeLabel.Size = new Size(48, 46); _closeLabel.TabIndex = 114; _closeLabel.Text = "🗙"; _closeLabel.TextAlign = ContentAlignment.MiddleCenter; // // Label12 // Label12.BackColor = Color.FromArgb(Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64))); Label12.Dock = DockStyle.Top; Label12.Font = new Font("Microsoft Sans Serif", 24.0f, FontStyle.Regular, GraphicsUnit.Point, Conversions.ToByte(0)); Label12.ForeColor = Color.FromArgb(Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64))); Label12.Location = new Point(0, 0); Label12.Name = "Label12"; Label12.Size = new Size(1029, 46); Label12.TabIndex = 113; Label12.TextAlign = ContentAlignment.MiddleCenter; // // Column6 // DataGridViewCellStyle15.SelectionBackColor = Color.FromArgb(Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64)), Conversions.ToInteger(Conversions.ToByte(64))); DataGridViewCellStyle15.WrapMode = DataGridViewTriState.False; Column6.DefaultCellStyle = DataGridViewCellStyle15; Column6.FillWeight = 60.9197f; Column6.HeaderText = "Clock In"; Column6.Name = "Column6"; Column6.ReadOnly = true; Column6.Resizable = DataGridViewTriState.True; // // Column1 // Column1.FillWeight = 71.14038f; Column1.HeaderText = "Clock Out"; Column1.Name = "Column1"; Column1.ReadOnly = true; // // Column2 // Column2.FillWeight = 137.7865f; Column2.HeaderText = "Punched By"; Column2.Name = "Column2"; Column2.ReadOnly = true; // // Column4 // Column4.FillWeight = 118.181f; Column4.HeaderText = "Modified Field"; Column4.Name = "Column4"; Column4.ReadOnly = true; // // Column3 // Column3.FillWeight = 127.3232f; Column3.HeaderText = "Notes"; Column3.Name = "Column3"; Column3.ReadOnly = true; Column3.Visible = false; // // Column5 // Column5.FillWeight = 75.70589f; Column5.HeaderText = "Site Location"; Column5.Name = "Column5"; Column5.ReadOnly = true; Column5.Visible = false; // // Column7 // Column7.FillWeight = 69.87342f; Column7.HeaderText = "Device Name"; Column7.Name = "Column7"; Column7.ReadOnly = true; Column7.Visible = false; // // Column8 // Column8.FillWeight = 127.3232f; Column8.HeaderText = "Modification Date"; Column8.Name = "Column8"; Column8.ReadOnly = true; Column8.Visible = false; // // Column9 // Column9.HeaderText = "type"; Column9.Name = "Column9"; Column9.ReadOnly = true; Column9.Visible = false; // // Column10 // Column10.HeaderText = "punchType"; Column10.Name = "Column10"; Column10.ReadOnly = true; Column10.Visible = false; // // Column11 // Column11.HeaderText = "jobDescription"; Column11.Name = "Column11"; Column11.ReadOnly = true; Column11.Visible = false; // // FrmDetailedEntry // AutoScaleDimensions = new SizeF(6.0f, 13.0f); AutoScaleMode = AutoScaleMode.Font; BackColor = Color.White; ClientSize = new Size(1029, 555); ControlBox = false; Controls.Add(_closeLabel); Controls.Add(Label12); Controls.Add(reasonLabel); Controls.Add(Panel4); Controls.Add(TableLayoutPanel4); Controls.Add(TableLayoutPanel3); Controls.Add(employeeNameLabel); Controls.Add(dateLabel); Controls.Add(Label9); FormBorderStyle = FormBorderStyle.FixedSingle; Margin = new Padding(2); Name = "FrmDetailedEntry"; StartPosition = FormStartPosition.CenterParent; TableLayoutPanel3.ResumeLayout(false); TableLayoutPanel3.PerformLayout(); TableLayoutPanel4.ResumeLayout(false); TableLayoutPanel4.PerformLayout(); Panel4.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)_entryDetailsDataGrid).EndInit(); Load += new EventHandler(FrmDetailedEntry_Load); ResumeLayout(false); PerformLayout(); }