In het rooster met de acties van de informatiebestanden de uitgevoerde acties cursief zetten

0000002094     -      07-11-2013

Deze programmering is de Aruba-versie van deze parameterinstelling. Hiermee 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:

Zoom
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using MercatorApi;
using MercatorUi;
using System.Windows.Forms;
using System.Drawing;

namespace SigCli
{
    public class Customizer : MercatorUi.ICustomizers.IFormLoadCustomizer, MercatorUi.ICustomizers.IFormClosedCustomizer
    {

        public void FormLoadCustomize(Form WindowsForm)
        {
            MercatorUi.Forms.Sig.SigForm sigForm = (MercatorUi.Forms.Sig.SigForm)WindowsForm;
            List<Control> l = sigForm.FindMovableControlsByType(typeof(MercatorUi.Forms.Sig.SigGrids.Actions));
            if (l.Count == 0)
                return;
            MercatorUi.Forms.Sig.SigGrids.Actions actions = (MercatorUi.Forms.Sig.SigGrids.Actions)l[0];
            actions.Grid.CellFormatted += new DataGridViewCellFormattingEventHandler(actions_CellFormatted);
        }

        public void FormClosedCustomize(Form WindowsForm)
        {
            MercatorUi.Forms.Sig.SigForm sigForm = (MercatorUi.Forms.Sig.SigForm)WindowsForm;
            List<Control> l = sigForm.FindMovableControlsByType(typeof(MercatorUi.Forms.Sig.SigGrids.Actions));
            if (l.Count == 0)
                return;
            MercatorUi.Forms.Sig.SigGrids.Actions actions = (MercatorUi.Forms.Sig.SigGrids.Actions)l[0];
            actions.Grid.CellFormatted -= new DataGridViewCellFormattingEventHandler(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 System.Drawing.Font("Microsoft Sans Serif", 8.25F, FontStyle.Italic, GraphicsUnit.Point, ((byte)(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.

Belangrijke opmerking: vanaf versie 8.1 zal het cursief-attribuut standaard door Mercator worden gebruikt om aan te geven of een actie in Legacy of in Aruba werd gegenereerd. Wij raden dan ook aan om dit cursief-attribuut niet te gebruiken, maar eerder de kleur van de lijnen te veranderen. Daartoe hoeft u enkel deze lijnen

Zoom
if (Convert.ToDateTime(grid.Rows[e.RowIndex].Cells["date_done"].Value) > new DateTime(1900, 1, 1))
    e.CellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, FontStyle.Italic, GraphicsUnit.Point, ((byte)(0)));

te vervangen door

Zoom
if (Convert.ToDateTime(grid.Rows[e.RowIndex].Cells["date_done"].Value) > new DateTime(1900, 1, 1))
{
    e.CellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
    e.CellStyle.ForeColor = Color.DarkGreen;
}