本文整理汇总了C#中System.Windows.Forms.DataGridViewCellPaintingEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# DataGridViewCellPaintingEventArgs类的具体用法?C# DataGridViewCellPaintingEventArgs怎么用?C# DataGridViewCellPaintingEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataGridViewCellPaintingEventArgs类属于System.Windows.Forms命名空间,在下文中一共展示了DataGridViewCellPaintingEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: board_CellPainting
private void board_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
string number = "";
// foreach(item c in List of items)
if (_idc.Any(c => (number = c.Number) != "" && c.X == e.ColumnIndex && c.Y == e.RowIndex))
{
var r = new Rectangle(e.CellBounds.X, e.CellBounds.Y, e.CellBounds.Width, e.CellBounds.Height);
e.Graphics.FillRectangle(Brushes.White, r);
var f = new Font(e.CellStyle.Font.FontFamily, 7);
e.Graphics.DrawString(number, f, Brushes.Black, r);
e.PaintContent(e.ClipBounds);
e.Handled = true;
}
}
开发者ID:Tens101010,项目名称:CrossWordPuzzle,代码行数:15,代码来源:Form1.cs
示例2: BuildStatusImageColumnCellPainting
public static void BuildStatusImageColumnCellPainting(DataGridViewCellPaintingEventArgs e, GitRevision revision, Brush foreBrush, Font rowFont)
{
if (revision.BuildStatus != null)
{
Image buildStatusImage = null;
switch (revision.BuildStatus.Status)
{
case BuildInfo.BuildStatus.Success:
buildStatusImage = Resources.BuildSuccessful;
break;
case BuildInfo.BuildStatus.Failure:
buildStatusImage = Resources.BuildFailed;
break;
case BuildInfo.BuildStatus.Unknown:
buildStatusImage = Resources.BuildCancelled;
break;
case BuildInfo.BuildStatus.InProgress:
buildStatusImage = Resources.Icon_77;
break;
case BuildInfo.BuildStatus.Unstable:
buildStatusImage = Resources.bug;
break;
case BuildInfo.BuildStatus.Stopped:
buildStatusImage = Resources.BuildCancelled;
break;
}
if (buildStatusImage != null)
{
e.Graphics.DrawImage(buildStatusImage, new Rectangle(e.CellBounds.Left, e.CellBounds.Top + 4, 16, 16));
}
}
}
开发者ID:neoandrew1000,项目名称:gitextensions,代码行数:34,代码来源:BuildInfoDrawingLogic.cs
示例3: BuildStatusMessageCellPainting
public static void BuildStatusMessageCellPainting(DataGridViewCellPaintingEventArgs e, GitRevision revision, Brush foreBrush, Font rowFont)
{
if (revision.BuildStatus != null)
{
Brush buildStatusForebrush = foreBrush;
switch (revision.BuildStatus.Status)
{
case BuildInfo.BuildStatus.Success:
buildStatusForebrush = Brushes.DarkGreen;
break;
case BuildInfo.BuildStatus.Failure:
buildStatusForebrush = Brushes.DarkRed;
break;
case BuildInfo.BuildStatus.InProgress:
buildStatusForebrush = Brushes.Blue;
break;
case BuildInfo.BuildStatus.Unstable:
buildStatusForebrush = Brushes.OrangeRed;
break;
case BuildInfo.BuildStatus.Stopped:
buildStatusForebrush = Brushes.Gray;
break;
}
var text = (string)e.FormattedValue;
e.Graphics.DrawString(text, rowFont, buildStatusForebrush, new PointF(e.CellBounds.Left, e.CellBounds.Top + 4));
}
}
开发者ID:neoandrew1000,项目名称:gitextensions,代码行数:29,代码来源:BuildInfoDrawingLogic.cs
示例4: OnCellPainting
protected override void OnCellPainting(DataGridViewCellPaintingEventArgs e)
{
base.OnCellPainting(e);
if (e.RowIndex >= 0 && Rows[e.RowIndex].Tag is Host)
{
PoolHostDataGridViewOneCheckboxRow row = (PoolHostDataGridViewOneCheckboxRow)Rows[e.RowIndex];
//Paintout checkbox - note: it's still there
if (!row.CheckBoxVisible && e.ColumnIndex == 1)
{
e.PaintBackground(e.ClipBounds, true);
e.Handled = true;
}
else if (row.HasPool && (e.ColumnIndex == 0 || e.ColumnIndex == 1))
{
e.PaintBackground(e.ClipBounds, true);
e.Handled = true;
}
else if (!row.HasPool && e.ColumnIndex == 0)
{
e.PaintBackground(e.ClipBounds, true);
e.Handled = true;
}
}
}
开发者ID:huizh,项目名称:xenadmin,代码行数:25,代码来源:PoolHostDataGridViewOneCheckbox.cs
示例5: boomarkDataGridView_CellPainting
void boomarkDataGridView_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
if (this.bookmarkData == null)
return;
lock (this.paintLock)
{
try
{
if (e.RowIndex < 0 || e.ColumnIndex < 0 || this.bookmarkData.Bookmarks.Count <= e.RowIndex)
{
e.Handled = false;
return;
}
int lineNum = this.bookmarkData.Bookmarks[e.RowIndex].LineNum;
//if (e.ColumnIndex == 1)
//{
// CommentPainting(this.bookmarkDataGridView, lineNum, e);
//}
//else
{
PaintHelper.CellPainting(this.logPaintContext, this.bookmarkDataGridView, lineNum, e);
}
}
catch (Exception ex)
{
Logger.logError(ex.StackTrace);
}
}
}
开发者ID:gspatace,项目名称:logexpert,代码行数:31,代码来源:BookmarkWindow.cs
示例6: dgvContours_CellPainting
private void dgvContours_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
e.Paint(e.ClipBounds, DataGridViewPaintParts.All);
e.Handled = true;
if (e.RowIndex < 0) return;
Template template = samples[e.RowIndex];
if (e.ColumnIndex == -1)
{
e.Graphics.DrawString(e.RowIndex.ToString(), Font, Brushes.Black, e.CellBounds.Location);
return;
}
if (e.ColumnIndex == 0)
{
var rect = new Rectangle(e.CellBounds.X, e.CellBounds.Y, (e.CellBounds.Width - 24)/2, e.CellBounds.Height);
rect.Inflate(-20, -20);
Rectangle boundRect = template.contour.SourceBoundingRect;
float k1 = 1f * rect.Width / boundRect.Width;
float k2 = 1f * rect.Height / boundRect.Height;
float k = Math.Min(k1, k2);
e.Graphics.DrawImage(bmp,
new Rectangle(rect.X, rect.Y, (int)(boundRect.Width * k), (int)(boundRect.Height * k)),
boundRect, GraphicsUnit.Pixel);
}
if (e.ColumnIndex == 0)
{
template.Draw(e.Graphics, e.CellBounds);
}
}
开发者ID:Lapa-Alya,项目名称:SearchOfHouseNumbers,代码行数:34,代码来源:ShowContoursForm.cs
示例7: OnCellPainting
protected override void OnCellPainting(DataGridViewCellPaintingEventArgs e)
{
if (e.RowIndex != -1 && e.ColumnIndex != -1)
{
if ((CurrentRow != null && e.RowIndex == CurrentRow.Index) || SelectedRowsFromCells.Contains(Rows[e.RowIndex]))
{
Color nextbackcolor = e.CellStyle.BackColor;
switch (App.CurrentConfig.Theme)
{
case Classes.Config.ThemeStyle.LessDark:
nextbackcolor = Color.FromArgb(116, 116, 116);
break;
case Classes.Config.ThemeStyle.Dark:
nextbackcolor = Color.FromArgb(84, 84, 84);
break;
case Classes.Config.ThemeStyle.MoreDark:
nextbackcolor = Color.FromArgb(52, 52, 52);
break;
case Classes.Config.ThemeStyle.TonOfDarkness:
nextbackcolor = Color.FromArgb(36, 36, 36);
break;
}
e.CellStyle.BackColor = nextbackcolor;
e.CellStyle.ForeColor = Functions.ContrastColor(e.CellStyle.BackColor);
}
}
base.OnCellPainting(e);
}
开发者ID:Alfred-Wallace,项目名称:GKeyBank,代码行数:29,代码来源:kDataGridView.cs
示例8: OnCellPainting
protected override void OnCellPainting(DataGridViewCellPaintingEventArgs e)
{
Rectangle newRect = new Rectangle(e.CellBounds.X - 1, e.CellBounds.Y - 1, e.CellBounds.Width, e.CellBounds.Height);
if (e.ColumnIndex == -1 && e.RowIndex == -1)
{
e.Graphics.DrawRectangle(Pens.LightSteelBlue, newRect);
}
else
{
if (e.ColumnIndex == -1)
{
Color begin = Color.FromArgb(241, 244, 248);
Color end = RowHeaderColor;
using (Brush brush = new LinearGradientBrush(
e.CellBounds, begin, end, LinearGradientMode.Vertical))
{
e.Graphics.FillRectangle(brush, e.CellBounds);
e.Graphics.DrawRectangle(Pens.LightSteelBlue, newRect);
}
DataGridViewPaintParts pa =
DataGridViewPaintParts.Border |
DataGridViewPaintParts.ContentBackground |
DataGridViewPaintParts.ContentForeground |
DataGridViewPaintParts.ErrorIcon |
DataGridViewPaintParts.Focus |
DataGridViewPaintParts.SelectionBackground;
e.Paint(e.ClipBounds, pa);
e.Handled = true;
}
if (e.RowIndex == -1)
{
Color begin = Color.FromArgb(241, 244, 248);
Color end = ColumnHeaderColor;
using (Brush brush = new LinearGradientBrush(
e.CellBounds, begin, end, LinearGradientMode.Vertical))
{
e.Graphics.FillRectangle(brush, e.CellBounds);
e.Graphics.DrawRectangle(Pens.LightSteelBlue, newRect);
}
DataGridViewPaintParts pa =
DataGridViewPaintParts.Border |
DataGridViewPaintParts.ContentBackground |
DataGridViewPaintParts.ContentForeground |
DataGridViewPaintParts.ErrorIcon |
DataGridViewPaintParts.Focus |
DataGridViewPaintParts.SelectionBackground;
e.Paint(e.ClipBounds, pa);
e.Handled = true;
}
}
}
开发者ID:hpbaotho,项目名称:top4ever-pos,代码行数:57,代码来源:DataGirdViewExt.cs
示例9: dataGridView_CellPainting
private void dataGridView_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
// check that we are in a header cell!
if (e.RowIndex == -1 && e.ColumnIndex > 0)
{
e.PaintBackground(e.ClipBounds, true);
Rectangle rect = MatrixDataGridView.GetColumnDisplayRectangle(e.ColumnIndex, true);
Size titleSize = TextRenderer.MeasureText(e.Value.ToString(), e.CellStyle.Font);
int offset = 4;
if (MatrixDataGridView.ColumnHeadersHeight < titleSize.Width + 2 * offset)
{
MatrixDataGridView.ColumnHeadersHeight = titleSize.Width + 2 * offset;
}
e.Graphics.TranslateTransform(1, titleSize.Width);
e.Graphics.RotateTransform(-90.0f);
e.Graphics.DrawString(e.Value.ToString(), MatrixDataGridView.Font, Brushes.Black,
new PointF(rect.Y - (MatrixDataGridView.ColumnHeadersHeight - titleSize.Width - offset), rect.X));
e.Graphics.RotateTransform(90.0f);
e.Graphics.TranslateTransform(-1, -titleSize.Width);
e.Handled = true;
}
if (e.RowIndex != -1 && e.ColumnIndex > 0)
{
var state = (ProjectDependency)e.Value;
/*if (state == ProjectDependency.Invalid)
e.CellStyle.BackColor = Color.Silver;*/
e.PaintBackground(e.ClipBounds, true);
Rectangle rect = MatrixDataGridView.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, true);
var CheckBoxRegion = new Rectangle(rect.X + box_offset, rect.Y + box_offset, box_size, box_size);
switch (state)
{
case ProjectDependency.None:
ControlPaint.DrawCheckBox(e.Graphics, CheckBoxRegion, ButtonState.Normal);
break;
case ProjectDependency.Direct:
ControlPaint.DrawCheckBox(e.Graphics, CheckBoxRegion, ButtonState.Checked);
break;
case ProjectDependency.Indirect:
ControlPaint.DrawCheckBox(e.Graphics, CheckBoxRegion, ButtonState.Checked | ButtonState.Inactive);
break;
case ProjectDependency.Invalid:
ControlPaint.DrawCheckBox(e.Graphics, CheckBoxRegion, ButtonState.Inactive);
break;
}
e.Handled = true;
}
}
开发者ID:tort32,项目名称:DepAnalyzer,代码行数:56,代码来源:ProjectsDepMatrix.cs
示例10: dgKarton_CellPainting
private void dgKarton_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
//if ((e.RowIndex != -1) && (e.ColumnIndex == dgKarton.Columns["CIKK_ALL_KESZLET"].Index))
//{
// if ((double)dgKarton.Rows[e.RowIndex].Cells[dgKarton.Columns["CIKK_ALL_KESZLET"].Index].Value < (double)dgKarton.Rows[e.RowIndex].Cells[dgKarton.Columns["OPTIMALIS_KESZLET"].Index].Value)
// {
// dgKarton.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = Color.Yellow;
// //dgKarton.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Yellow;
// }
// if ((double)dgKarton.Rows[e.RowIndex].Cells[dgKarton.Columns["CIKK_ALL_KESZLET"].Index].Value < (double)dgKarton.Rows[e.RowIndex].Cells[dgKarton.Columns["MINIMUM_KESZLET"].Index].Value)
// {
// dgKarton.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = Color.Red;
// //dgKarton.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Red;
// }
//}
if (this.dgKarton.Columns["CIKK_ALL_KESZLET"].Index ==
e.ColumnIndex && e.RowIndex >= 0)
{
Rectangle newRect = new Rectangle(e.CellBounds.X + 1,
e.CellBounds.Y + 1, e.CellBounds.Width - 4,
e.CellBounds.Height - 4);
using (
Brush gridBrush = new SolidBrush(this.dgKarton.GridColor),
backColorBrush = new SolidBrush(e.CellStyle.BackColor))
{
using (Pen gridLinePen = new Pen(gridBrush))
{
// Erase the cell.
e.Graphics.FillRectangle(backColorBrush, e.CellBounds);
// Draw the grid lines (only the right and bottom lines;
// DataGridView takes care of the others).
e.Graphics.DrawLine(gridLinePen, e.CellBounds.Left,
e.CellBounds.Bottom - 1, e.CellBounds.Right - 1,
e.CellBounds.Bottom - 1);
e.Graphics.DrawLine(gridLinePen, e.CellBounds.Right - 1,
e.CellBounds.Top, e.CellBounds.Right - 1,
e.CellBounds.Bottom);
// Draw the inset highlight box.
// e.Graphics.DrawRectangle(Pens.Blue, newRect);
// Draw the text content of the cell, ignoring alignment.
if (e.Value != null)
{
e.Graphics.DrawString((String)e.Value.ToString(), e.CellStyle.Font,
Brushes.Crimson, e.CellBounds.X + 2,
e.CellBounds.Y + 2, StringFormat.GenericDefault);
}
e.Handled = true;
}
}
}
}
开发者ID:hayrettinbebek,项目名称:e-cafe,代码行数:56,代码来源:frmKeszletKarton.cs
示例11: OnCellPainting
protected override void OnCellPainting(DataGridViewCellPaintingEventArgs e)
{
base.OnCellPainting(e);
Point p = new Point(e.ColumnIndex, e.RowIndex);
if (invisibleColumnRow.Contains(p))
{
e.Graphics.FillRectangle(new SolidBrush(this.BackgroundColor), e.CellBounds);
e.Handled = true;
}
}
开发者ID:Heimiko,项目名称:NzbSearcher,代码行数:10,代码来源:frmConfig.cs
示例12: SetCellBounds
private static void SetCellBounds(DataGridViewCellPaintingEventArgs e, Rectangle bounds)
{
// HACK: this works around the fact that PaintContent for column headers
// ingore the clipbounds passed into it, instead using CellBounds, and the
// fact that CellBounds is a readonly property. It relies on the implementation
// detail that CellBounds has a backing private field called cellBounds. This may
// break on future updates to the framework.
typeof(DataGridViewCellPaintingEventArgs).InvokeMember("cellBounds", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.SetField, null, e, new object[]{bounds});
}
开发者ID:TheJayMann-duplicate,项目名称:DQ9MapTool,代码行数:10,代码来源:MapForm.cs
示例13: playlistView_CellPainting
private void playlistView_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
if (e.RowIndex >= 0 && e.RowIndex < mpc.CurrentPlaylist.Count)
{
if (mpc.CurrentPlaylist[e.RowIndex].ID == mpc.CurrentSong.ID)
{
e.CellStyle.Font = new Font(e.CellStyle.Font, FontStyle.Bold);
}
}
}
开发者ID:koson,项目名称:jawsper-projects,代码行数:10,代码来源:Form1.Events.cs
示例14: dgvClient_CellPainting
private void dgvClient_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
//if (e.ColumnIndex == 3 && e.RowIndex > -1)
//{
// Image img = GymMgr.Properties.Resources.add;
// e.Graphics.DrawImage(img, e.CellBounds.Location);
// e.PaintContent(e.CellBounds);
// e.Handled = true;
//}
}
开发者ID:khaikin,项目名称:GymMgr,代码行数:10,代码来源:ucSubscriptions.cs
示例15: DataGridViewEx_CellPainting
//セル描画イベントハンドラ
private void DataGridViewEx_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
//このメソッドでは、ヘッダの描画のみを行う
if (e.ColumnIndex >= 0 && e.RowIndex == -1)
{
//そのヘッダがどのドッキングセルに属しているか調べる
int index = -1;
for (int i = 0; i < DockingCellList.Count; i++)
{
if (e.ColumnIndex >= DockingCellList[i].Start
&& e.ColumnIndex < DockingCellList[i].Start + DockingCellList[i].Count)
{
index = i;
break;
}
}
//とりあえず塗りつぶす
e.Graphics.FillRectangle(new SolidBrush(e.CellStyle.BackColor), e.CellBounds);
//ドッキングしている場合
if (index >= 0)
{
//上段
int x = e.CellBounds.X;
for (int i = e.ColumnIndex - 1; i >= DockingCellList[index].Start; i--)
{
x -= this.Columns[i].Width;
}
int width = 0;
for (int i = DockingCellList[index].Start; i < DockingCellList[index].Start + DockingCellList[index].Count; i++)
{
width += this.Columns[i].Width;
}
Rectangle rect1 = new Rectangle(x, e.CellBounds.Y, width, e.CellBounds.Height / 2);
DrawCell(e.Graphics, rect1);
e.Graphics.DrawString(DockingCellList[index].Text, e.CellStyle.Font, Brushes.Black, rect1.X + 2, rect1.Y + 2);
//下段
Rectangle rect2 = new Rectangle(e.CellBounds.X, e.CellBounds.Y + e.CellBounds.Height / 2, e.CellBounds.Width, e.CellBounds.Height / 2);
DrawCell(e.Graphics, rect2);
e.Graphics.DrawString(e.Value.ToString(), e.CellStyle.Font, Brushes.Black, rect2.X + 2, rect2.Y + 2);
}
//ドッキングしていない場合
else
{
DrawCell(e.Graphics, e.CellBounds);
e.Graphics.DrawString(e.Value.ToString(), e.CellStyle.Font, Brushes.Black, e.CellBounds.X + 2, e.CellBounds.Y + 2);
}
//ハンドルされたことを報告
e.Handled = true;
}
}
开发者ID:manbou404,项目名称:CSharpLab,代码行数:56,代码来源:Class1.cs
示例16: OnCellPainting
protected override void OnCellPainting(DataGridViewCellPaintingEventArgs e)
{
base.OnCellPainting(e);
if (e.ColumnIndex > -1 && e.RowIndex > -1)
{
if (this[e.ColumnIndex, e.RowIndex].Value == null || this[e.ColumnIndex, e.RowIndex].Value.Equals(""))
this[e.ColumnIndex, e.RowIndex].Style.BackColor = Color.Transparent;
else
this[e.ColumnIndex, e.RowIndex].Style.BackColor = Color.CornflowerBlue;
}
}
开发者ID:RicoPlays,项目名称:sm64dse,代码行数:11,代码来源:ImportImage4BPP.cs
示例17: gvEmptyNetworkName_CellPainting
private void gvEmptyNetworkName_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
if (e.RowIndex < 0)
return;
if (e.ColumnIndex == dcSelect.Index)
{
e.Paint(e.CellBounds, DataGridViewPaintParts.All);
e.Graphics.DrawImage(Resources.Select, e.CellBounds.Left + 3, e.CellBounds.Top + 3);
e.Handled = true;
}
}
开发者ID:Winsor,项目名称:ITInfra,代码行数:11,代码来源:EmptyNetworkName.cs
示例18: upgradeEquipmentGrid_CellPainting
private void upgradeEquipmentGrid_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
// This just hides numeric fields that aren't supported, they return -1
if ((e.Value is int && (int)e.Value == -1) ||
(e.Value is double && Math.Abs((double)e.Value + 1) < Double.Epsilon) ||
(e.Value is EquippableSlotFlags && (EquippableSlotFlags)e.Value == EquippableSlotFlags.None) ||
(e.Value is CoverageFlags && (CoverageFlags)e.Value == CoverageFlags.None))
{
e.PaintBackground(e.ClipBounds, true);
e.Handled = true;
}
}
开发者ID:IbespwnAC,项目名称:MagTools,代码行数:12,代码来源:EquipmentUpgradesForm.cs
示例19: AreasTree_CellPainting
private void AreasTree_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
if (e.RowIndex < 0)
return;
if (e.ColumnIndex == dcSelectToReport.Index)
{
Image cellImage = Resources.print;
e.Paint(e.CellBounds, DataGridViewPaintParts.All);
e.Graphics.DrawImage(cellImage, e.CellBounds.Left + 3, e.CellBounds.Top + 3);
e.Handled = true;
}
}
开发者ID:Winsor,项目名称:ITInfra,代码行数:12,代码来源:AreaDetailSelection.cs
示例20: dgCategories_CellPainting
private void dgCategories_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
if (e.RowIndex >= 0)
{
if ((decimal)dsCategories.Tables["Category"].Rows[e.RowIndex]["total"] < 0)
e.CellStyle.BackColor = Settings.Default.NegativeTotalRowColor;
if ((decimal)dsCategories.Tables["Category"].Rows[e.RowIndex]["total"] > 0)
e.CellStyle.BackColor = Settings.Default.PositiveTotalRowColor;
}
}
开发者ID:ahtisam,项目名称:HomeAccounting,代码行数:12,代码来源:frmCategoryManagement.cs
注:本文中的System.Windows.Forms.DataGridViewCellPaintingEventArgs类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论