Met deze programmering kunt u de lijnen cursief zetten die overeenstemmen met acties in de roosters met de informatiebestandacties (in plaats van ze te doorstrepen).
De hier geïllustreerde programmering wordt gerealiseerd op basis van een SigCli-customizer die de volgende interfaces implementeert:
De customizer ziet er als volgt uit:
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using MercatorApi;
using MercatorUi;
using System.Windows.Forms;
using System.Drawing;
using System.Linq;
namespace SigCli
{
public class Customizer : MercatorUi.ICustomizers.IFormLoadCustomizer, MercatorUi.ICustomizers.IFormClosedCustomizer
{
public void FormLoadCustomize(Form form)
{
MercatorUi.Forms.Sig.SigForm sigForm = (MercatorUi.Forms.Sig.SigForm)form;
MercatorUi.Forms.Sig.SigGrids.Actions actions = sigForm.MovableControls.Values.OfType<MercatorUi.Forms.Sig.SigGrids.Actions>().FirstOrDefault();
if (actions != null)
actions.Grid.CellFormatted += Actions_CellFormatted;
}
public void FormClosedCustomize(Form form)
{
MercatorUi.Forms.Sig.SigForm sigForm = (MercatorUi.Forms.Sig.SigForm)form;
MercatorUi.Forms.Sig.SigGrids.Actions actions = sigForm.MovableControls.Values.OfType<MercatorUi.Forms.Sig.SigGrids.Actions>().FirstOrDefault();
if (actions != null)
actions.Grid.CellFormatted -= Actions_CellFormatted;
}
private void Actions_CellFormatted(object sender, DataGridViewCellFormattingEventArgs e)
{
DataGridView grid = (DataGridView)sender;
if (Convert.ToDateTime(grid.Rows[e.RowIndex].Cells["date_done"].Value) > new DateTime(1900, 1, 1))
e.CellStyle.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Italic, GraphicsUnit.Point, 0);
}
}
}
Merk op dat hier gebruik wordt gemaakt van het event CellFormatted van MercatorUi.GridPro.DataGridViewXPro. Dankzij dit event kan het formaat van een cel worden bewerkt, nadat Mercator het standaardevent CellFormatting heeft uitgevoerd.