Depuis la version 10.10, cette méthode est obsolète : voir cette page.
Dans toute grille libre de signalétique, il est possible de placer ce module qui permet d'ajouter une colonne contenant un bouton. Ce bouton permet de zoomer vers un document de vente. La seule condition est que la requête SQL associée à cette grille amène au moins les colonnes TYPE, ID, JOURNAL et PIECE de LIGNES_V ou PIEDS_V.
L'exemple de customizer repris ci-dessous est associé à une grille personnalisée dont la requête SQL est :
select type,id,journal,piece from PIEDS_V where id_cli=@c_id order by date desc
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using MercatorApi;
using MercatorUi;
using System.Windows.Forms;
namespace SigCli
{
public class Customizer : MercatorUi.ICustomizers.IFormLoadCustomizer, MercatorUi.ICustomizers.IFormClosedCustomizer
{
private System.Drawing.Image imgZoom = MercatorUi._Divers.ImageFromResource("_catch");
public void FormLoadCustomize(Form WindowsForm)
{
MercatorUi.Forms.Sig.SigForm sigForm = (MercatorUi.Forms.Sig.SigForm)WindowsForm;
MercatorUi.Forms.Sig.SigGrids.UserDefined userDefinedGrid = (MercatorUi.Forms.Sig.SigGrids.UserDefined)sigForm.MovableControls["9739737CA0"];
userDefinedGrid.Grid.StandardColumnsCreated += new MercatorUi.GridPro.StandardColumnsCreatedHandler(userDefinedGrid_StandardColumnsCreated);
userDefinedGrid.Grid.CellSuperClick += new MercatorUi.GridPro.CellSuperClickHandler(GridBrouillons_CellSuperClick);
}
public void FormClosedCustomize(Form WindowsForm)
{
MercatorUi.Forms.Sig.SigForm sigForm = (MercatorUi.Forms.Sig.SigForm)WindowsForm;
MercatorUi.Forms.Sig.SigGrids.UserDefined userDefinedGrid = (MercatorUi.Forms.Sig.SigGrids.UserDefined)sigForm.MovableControls["9739737CA0"];
userDefinedGrid.Grid.StandardColumnsCreated -= new MercatorUi.GridPro.StandardColumnsCreatedHandler(userDefinedGrid_StandardColumnsCreated);
userDefinedGrid.Grid.CellSuperClick -= new MercatorUi.GridPro.CellSuperClickHandler(GridBrouillons_CellSuperClick);
}
void userDefinedGrid_StandardColumnsCreated(object sender, EventArgs e)
{
MercatorUi.GridPro.DataGridViewXPro grid = (MercatorUi.GridPro.DataGridViewXPro)sender;
grid.Columns[0].Visible = false; // masquer la colonne TYPE
grid.Columns[1].Visible = false; // masquer la colonne ID
grid.Columns[3].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft; // colonne PIECE
((MercatorUi.GridPro.DataGridViewDoubleTextBoxColumn)grid.Columns[3]).DisplayFormat = "#########";
MercatorUi.GridPro.DataGridViewHidableButtonXColumn colButtonZoom = new MercatorUi.GridPro.DataGridViewHidableButtonXColumn();
colButtonZoom.Name = "zoom";
colButtonZoom.HeaderText = "";
colButtonZoom.Image = imgZoom;
colButtonZoom.Width = 34;
grid.Columns.Add(colButtonZoom);
}
void GridBrouillons_CellSuperClick(object sender, DataGridViewCellEventArgs e)
{
MercatorUi.GridPro.DataGridViewXPro grid = (MercatorUi.GridPro.DataGridViewXPro)sender;
MercatorUi.Forms.Sig.SigGrids.UserDefined userDefined = (MercatorUi.Forms.Sig.SigGrids.UserDefined)grid.Parent;
if ((e.RowIndex >= 0) && (e.ColumnIndex >= 0) && (grid.Columns[e.ColumnIndex].Name == "zoom"))
MercatorUi.Globals.Main.ShowBillingExisting("V", Convert.ToInt32(grid.Rows[e.RowIndex].Cells[0].Value), grid.Rows[e.RowIndex].Cells[1].Value.ToString(), grid.Rows[e.RowIndex].Cells[2].Value.ToString(), Convert.ToInt64(grid.Rows[e.RowIndex].Cells[3].Value));
}
}
}