about Font

Please support our C# advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Feb 2009
Posts: 9
Reputation: cljlxwater is an unknown quantity at this point 
Solved Threads: 0
cljlxwater cljlxwater is offline Offline
Newbie Poster

about Font

 
0
  #1
Mar 4th, 2009
private void ToolStripButtonBold_CheckedChanged(object sender, EventArgs e)
{
Font oldFont;
Font newFont;

bool checkState = ((ToolStripButton)sender).Checked;

//Get the font that is being used in the selected text.
oldFont = this.richTextBoxText.SelectionFont;

if (!checkState)
newFont = new Font(oldFont, oldFont.Style & ~FontStyle.Bold); else
newFont = new Font(oldFont, oldFont.Style | FontStyle.Bold);
//Insert the new font and return focus to the RichTextBox
this.richTextBoxText.SelectionFont = newFont;
this.richTextBoxText.Focus();

this.ToolStripMenuItemBold.CheckedChanged -= new EventHandler(ToolStripMenuItemBold_CheckedChanged);
this.ToolStripMenuItemBold.Checked = checkState;
this.ToolStripMenuItemBold.CheckedChanged += new EventHandler(ToolStripMenuItemBold_CheckedChanged);
}

this one -newFont = new Font(oldFont, oldFont.Style & ~FontStyle.Bold); i can't understand ,please tell me ,thank you
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,735
Reputation: LizR has a spectacular aura about LizR has a spectacular aura about 
Solved Threads: 186
LizR LizR is offline Offline
Posting Virtuoso

Re: about Font

 
0
  #2
Mar 4th, 2009
Well. Debug, watch what happens as you go through the stages.. Especially looking at the newFont.Style property
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 585 | Replies: 1
Thread Tools Search this Thread



Tag cloud for C#
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC