Bonjour, je suis débutant en C#

J'utilise un logiciel dérivé de WinDev et j'essaie de modifier un script C# pour imprimer un modèle d'étiquette comportant des informations récupérées d'un fichier type .csv.

Dans ce script, il y a une fonction qui affiche un codebarre si l'information du chant "sCNCFiles" existe et si l'information n'existe pas, elle ne l'affiche pas.
Je souhaite créer une fonction quasiment similaire en affichant non pas un code barre mais une épaisse ligne noire si l'information du chant "sBN" existe et ne s'affiche pas si l'information n'existe pas. (voir photo ci-dessous)

Nom : Capture d'écran .jpg
Affichages : 254
Taille : 315,4 Ko

J'ai trouvé la fonction à intégrer dans le script servant à dessiner une ligne ici: https://www.developpez.net/forums/d6...essiner-ligne/
J'ai essayé de copier le code pour dessiner une ligne dans un picturebox mais comme je m'en doutais le script ne fonctionne plus après avoir rajouté cette fonction.


Auriez-vous une idée?
Merci d'avance,

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
private void DetailReport_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {
 
	string CodMateriale = (string)this.Parameters["CodMateriale"].Value;
	string CodColore = (string)this.Parameters["CodColore"].Value;
	double Spessore = (double)this.Parameters["Spessore"].Value;
 
	DetailReport.FilterString = string.Format("[sCodMateriale] = '{0}' AND [sCodColore] = '{1}' AND [nSpessore] = {2}", CodMateriale, CodColore, Spessore);
}
 
private void DetailReport2_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {
 
	int IDP = (int)this.Parameters["IDP"].Value;
	DetailReport2.FilterString = string.Format("[iIDP] = {0}", IDP);
}
 
 
private void cfDimensioni_GetValue(object sender, DevExpress.XtraReports.UI.GetValueEventArgs e) {
 
	string maschera = "{0} x {1} x {2} mm";
	string lunghezza = DetailReport2.GetCurrentColumnValue("nBase").ToString();
	string larghezza = DetailReport2.GetCurrentColumnValue("nAltezza").ToString();
	string spessore = this.Parameters["Spessore"].Value .ToString();
 
 
	string dimensioni = string.Format(maschera, lunghezza, larghezza, spessore);
	e.Value = dimensioni;
}
 
 
private string GetDatoFST(string key) {
	List<KeyValuePair<string, string>> DatiFST = DetailReport2.GetCurrentColumnValue("DatiFST") as List<KeyValuePair<string, string>>;
      if (DatiFST != null) {
	      if (DatiFST.Count(d => d.Key == key) > 0)
                return DatiFST.Find(d => d.Key == key).Value;
            else
                return string.Empty;
      }
      else
      	return string.Empty;
}
 
private void barCode1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {
	barCode1.Visible = !string.IsNullOrEmpty(barCode1.Text);
}
 
private void cfMyCncFile_GetValue(object sender, DevExpress.XtraReports.UI.GetValueEventArgs e) {
	string cnc = DetailReport2.GetCurrentColumnValue("sCNCFiles").ToString();
	cnc = Path.GetFileNameWithoutExtension(cnc);
	if(!string.IsNullOrEmpty(cnc)) {
		cnc += ".CIX";
		e.Value = cnc;
	}
	else
		e.Value = string.Empty;
}
 
private void pictureBox2_Paint(object sender, PaintEventArgs e) {
      e.Graphics.DrawLine(Pens.Black, 0, 100, 100, 100);
}