[Gtk-sharp-list] FontButton Font change Not working
netgear
cool_rainbow at rocketmail.com
Wed Jun 1 04:51:21 UTC 2016
Im using the following code to obtain the selected font from a FontButton.But
the fontName is not changing even if i choose a different font.. the size
change is working.What I'm i doing wrong? Please advice.
* protected void OnFontbutton2FontSet (object sender, EventArgs e)
{
try{
string sfont = fontbutton2.FontName;
string fontName=sfont.Substring(0,sfont.LastIndexOf(' '));
int fontSize=int.Parse(sfont.Substring(sfont.LastIndexOf('
')+1).Trim());// I know, looks a bit ugly
cfont=new Font(fontName ,fontSize,
FontStyle.Regular,System.Drawing.GraphicsUnit.Pixel);
selectedfont=new Font(fontName ,fontSize,
FontStyle.Regular,System.Drawing.GraphicsUnit.Pixel);
MessageDialog md = new MessageDialog (this,
DialogFlags.DestroyWithParent, MessageType.Info, ButtonsType.Close,
fontName);
int result = md.Run ();
MessageDialog md2 = new MessageDialog (this,
DialogFlags.DestroyWithParent, MessageType.Info, ButtonsType.Close,
selectedfont.Name);
int result2 = md2.Run ();
if (wwork.IsBusy == false) {
wwork.RunWorkerAsync ();
} else {
bgdirty = true;
}
}
catch(Exception error) {
}
}*
But the newly created font `cfont` object stays as the default font,only the
font size changes .. font name does not change.What I'm i doing wrong.
Please advice.
--
View this message in context: http://mono.1490590.n4.nabble.com/FontButton-Font-change-Not-working-tp4667916.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.
More information about the Gtk-sharp-list
mailing list