Hi..
I am working on richtextbox now I want to chang font style at run time by using shortcut key like ctrl+b..
How it is possible..?
any body help please
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Kanhialal kkPosted May 12, 2011, 6:29 AM
sir I have retrieved items in comboxbox from database like this...
SELECT UPPER(item_Name) as Item_Name FROM New_Item_ForShop order by Item_Name asc
now I want to select the data as Alphabetically I mean if I press G in keyboard than select the series of G in combox..
thanks for helping almost...
Kindly further help
FroglegPosted May 12, 2011, 3:33 AM
public partial class Form1 : Form
{
Font myFont = new Font("Arial", 16,FontStyle.Italic);
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.KeyPreview = true;
}
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (e.Modifiers== Keys.Control && e.KeyCode== Keys.B)
{
richTextBox1.SelectionFont = myFont;
}
}
private void bttnLoad_Click(object sender, EventArgs e)
{
richTextBox1.LoadFile("test.rtf");
}
private void bttnSaveToFile_Click(object sender, EventArgs e)
{
richTextBox1.SaveFile("test.rtf");
}
private void bttnSaveToDatabase_Click(object sender, EventArgs e)
{
string rtfStr = this.richTextBox1.Rtf;//text only
//save to database
}
Kanhialal kkPosted May 12, 2011, 2:57 AM
Working properly as required.
but now I want to save in database as some portion is bold and some regular format..
kindly help.
FroglegPosted May 12, 2011, 2:44 AM
public partial class Form1 : Form
{
Font myFont = new Font("Arial", 16,FontStyle.Italic);
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.KeyPreview = true;
}
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (e.Modifiers== Keys.Control && e.KeyCode== Keys.B)
{
richTextBox1.SelectionFont = myFont;
}
}
}