I wanna to make my bold,italic,underline buttons work with eachother in richtextbox. I found an example, but its in c#. Help pls, how its works in c++:
if(e.Button==toolBarButton1)
{
int fStyle = (int)FontStyle.Bold + (int)FontStyle.Italic;
FontStyle f = (FontStyle)fStyle;
richTextBox1.SelectionFont =
new Font(richTextBox1.Font.Name, richTextBox1.Font.Size, f);
}
my version, I want to remake it
if ( RichTextBox1->SelectionFont != nullptr )
{
System::Drawing::Font^ currentFont = RichTextBox1->SelectionFont;
System::Drawing::FontStyle newFontStyle;
if ( RichTextBox1->SelectionFont->Bold == true )
{
newFontStyle = FontStyle::Regular;
}
else
{
newFontStyle = FontStyle::Bold;
}
RichTextBox1->SelectionFont = gcnew System::Drawing::Font( currentFont->FontFamily,currentFont->Size,newFontStyle );