Hello ,
Is it possible in the Drop down list fontname of CodeLab .; can draw like the paint net dropdown list fontname
I would like in the plugin that I have tried to make the Drop down list like this
If it is not possible ; I will do my plugin in visual studio but I find it a bit complicated create plugin with Visual studio
I started my visual studio code like this:
private void MonEffetConfigDialog_Load(object sender, EventArgs e)
{
this.MaCombo1.DrawMode = DrawMode.OwnerDrawFixed;
this.MaCombo1.ItemHeight = 18;
this.MaCombo1.DrawItem += new DrawItemEventHandler(this.MaCombo2_DrawItem);
InstalledFontCollection MesPolicesInstalle = new InstalledFontCollection();
FontFamily[] FontFamille = MesPolicesInstalle.Families;
FontFamily[] MonTableau = FontFamille;
for (int i = 0; i < MonTableau.Length; i++)
{
FontFamily FontFamille1 = MonTableau[i];
if (FontFamille1.IsStyleAvailable(FontStyle.Regular))
{
this.Macombo1.Items.Add(FontFamille1.Name);
}
}
}
private void MaCombo2_DrawItem(object sender, DrawItemEventArgs e)
{
e.DrawBackground();
ComboBox Macombo = (ComboBox)sender;
string texte = (e.Index > -1) ? Macombo.Items[e.Index].ToString() : Macombo.Text;
Font Police = new Font(texte, Macombo.Font.Size);
Brush Pinceau = new SolidBrush(e.ForeColor);
float fl = ((float)e.Bounds.Height - e.Graphics.MeasureString(texte, Police).Height) / 2f;
e.Graphics.DrawString(text, font, brush, (float)e.Bounds.X, (float)e.Bounds.Y +fl);
Police.Dispose();
Pinceau.Dispose();
e.DrawFocusRectangle();
}
But I preferred to make my plugin with codelab.
Thank you very much for your answers and assistance