/// <summary> /// Draws a row so that all columns are merged into one /// </summary> /// <param name="row">The index of the row to draw</param> /// <param name="graphics">The graphics object</param> private void DrawMergeRow(int row, Graphics graphics) { var rowRectangle = this.GetRowDisplayRectangle(row, true); if (rowRectangle.Y == 0) { return; } graphics.FillRectangle(new SolidBrush(this.MergeColor), rowRectangle); rowRectangle.X--; rowRectangle.Y--; var format = new StringFormat(); format.Alignment = StringAlignment.Near; format.LineAlignment = StringAlignment.Center; var font = FontHelper.EmboldenFont(this.ColumnHeadersDefaultCellStyle.Font); graphics.DrawString(this.Rows[row].Cells[this.MergeColumn].Value.ToString(), font, new SolidBrush(Color.Black), rowRectangle, format); }
/// <summary> /// Handles the CellFormatting event of the grdPlaylist control. /// </summary> private void grdPlaylist_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (e.RowIndex == -1) { return; } if (e.CellStyle == null) { return; } if (e.RowIndex == GetCurrentTrackIndex()) { if (!e.CellStyle.Font.Bold) { e.CellStyle.Font = FontHelper.EmboldenFont(_font); } } else { if (e.CellStyle.Font.Bold) { e.CellStyle.Font = _font; } } }