Jump to content

Drop down list font


roro69
 Share

Recommended Posts

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
 
 
 
Link to comment
Share on other sites

Hello

Thank you very much for your answers

It's a shame because with fontname combo CodeLab; it is obliged to load the style one by one to see the result style font in the canvas.

 

Too bad I will pass visual studio and event combo DrawItem

 

Thank you for help

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...