Vous consultez une page technique concernant le logiciel de gestion Mercator. Celle-ci contient des informations spécifiques destinées aux professionnels de Mercator. Souhaitez-vous être redirigés vers des informations plus générales ?


   Ne plus poser cette question

Placement d'un composant visuel .Net dans l'écran de fond de Mercator

0000002227     -      27/08/2017

Cet exemple illustre la façon d'ajouter un composant visuel écrit en C# dans l'écran de fond de Mercator.

Dans ce cas, le composant (grille) est défini dans screen.dll.

Zoom
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using MercatorApi;
using MercatorUi;
using Screen;

// <ReferenceInclude>Screen.dll</ReferenceInclude>

namespace Main
{
    public class Customizer : MercatorUi.ICustomizers.IExec
    {
        public void Main(MercatorUi.ICustomizers.ExecAction Action)
        {
            if (MercatorUi.Globals.IsMajuro && (Action == MercatorUi.ICustomizers.ExecAction.UserLogin))
            {

                if (MercatorUi.Globals.StarterMainForm.Hublot.Controls["grid"] != null)
                    MercatorUi.Globals.StarterMainForm.Hublot.Controls.Remove(MercatorUi.Globals.StarterMainForm.Hublot.Controls["grid"]);

                Grid grid = new Grid.Grid();
                grid.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                               | System.Windows.Forms.AnchorStyles.Left)
                               | System.Windows.Forms.AnchorStyles.Right)));
                grid.Location = new System.Drawing.Point(20, 20);
                grid.Name = "Grid";
                grid.Size = new System.Drawing.Size(MercatorUi.Globals.StarterMainForm.Hublot.Width - 50, MercatorUi.Globals.StarterMainForm.Hublot.Height - 50);
                grid.TabIndex = 0;

                MercatorUi.Globals.StarterMainForm.Hublot.Controls.Add(grid);
                Grid.SupportRefresh();
                Grid.BringToFront();
            }
            else if (MercatorUi.Globals.IsMajuro && (Action == MercatorUi.ICustomizers.ExecAction.DossierClose))
            {
                if (MercatorUi.Globals.StarterMainForm.Hublot.Controls["Grid"] != null)
                    MercatorUi.Globals.StarterMainForm.Hublot.Controls.Remove(MercatorUi.Globals.StarterMainForm.Hublot.Controls["Grid"]);
            }
        }
    }
}