如何在gridcontrol的一个单元格内添加两个图标
时间: 2023-05-21 13:04:57 浏览: 346
您可以通过在单元格字体上方或下方使用字符代码添加第二个图标来实现在GridControl的单个单元格内添加两个图标的效果。为此,您可以使用类似如下代码的方法:
```csharp
gridControl1[0, 1].Value = "Hello World";
// 空心圆
gridControl1[0, 1].Appearance.Cell.Options.UseTextOptions = true;
gridControl1[0, 1].Appearance.Cell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far;
gridControl1[0, 1].Appearance.Cell.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center;
gridControl1[0, 1].Appearance.Cell.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
gridControl1[0, 1].Appearance.Cell.TextOptions.Trimming = DevExpress.Utils.Trimming.None;
gridControl1[0, 1].Appearance.Cell.Font = new System.Drawing.Font("Webdings", 12.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2)));
gridControl1[0, 1].Appearance.Cell.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(192)))), ((int)(((byte)(128))))); // 空心圆颜色
gridControl1[0, 1].Appearance.Cell.TextOptions.Trimming = DevExpress.Utils.Trimming.None;
gridControl1[0, 1].Appearance.Cell.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Default;
gridControl1[0, 1].Value += " c";
// 实心圆
gridControl1[0, 1].Appearance.Cell.Options.UseTextOptions = true;
gridControl1[0, 1].Appearance.Cell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far;
gridControl1[0, 1].Appearance.Cell.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center;
gridControl1[0, 1].Appearance.Cell.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap;
gridControl1[0, 1].Appearance.Cell.TextOptions.Trimming = DevExpress.Utils.Trimming.None;
gridControl1[0, 1].Appearance.Cell.Font = new System.Drawing.Font("Wingdings", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(2)));
gridControl1[0, 1].Appearance.Cell.ForeColor = System.Drawing.Color.Green; // 实心圆颜色
gridControl1[0, 1].Appearance.Cell.TextOptions.Trimming = DevExpress.Utils.Trimming.None;
gridControl1[0, 1].Appearance.Cell.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Default;
gridControl1[0, 1].Value += " a";
```
这将在GridControl的第一个单元格内添加两个图标(一个空心圆和一个实心圆)。您可以根据需要更改字符代码、设置字体和颜色等。
阅读全文