lothos12345 Posted October 16, 2006 Posted October 16, 2006 I have a button that bolds selected text in an Rtf textbox. The problem is I want to be able to unbold the selected text if they click the bold button again the and the selected text is bolded. Just adding and undo button will not work because the user could have made several changes since bolding the selected text. Basically I want it to work like Word. This has to be in Visual Basic.NET. Any help given is greatly appreciated. Quote
Leaders snarfblam Posted October 16, 2006 Leaders Posted October 16, 2006 What is the problem? Why not check if the font is bold, and if so make it not bold, if not make it bold. Or, here is a niftier solution. This code toggles whether or not text is bold in one step. MyRTF.SelectionFont = new Font(MyRTF.SelectionFont, MyRTF.SelectionFont.Style ^ FontStyle.Bold); Quote [sIGPIC]e[/sIGPIC]
techmanbd Posted October 17, 2006 Posted October 17, 2006 Maybe this can help. Here is what I do for a pause button that when pressed again, my test continues. Somewhat the same concept of what you are asking. Private Sub btnPauseTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPauseTest.Click If Me.btnPauseTest.Text = "PAUSE" Then If thrdTest.IsAlive Then thrdTest.Suspend() Me.tmrTestTime.Enabled = False Me.btnPauseTest.Text = "CONTINUE" Else If thrdTest.IsAlive Then thrdTest.Resume() Me.tmrTestTime.Enabled = True Me.btnPauseTest.Text = "PAUSE" End If End Sub Quote Live as if you were to die tomorrow. Learn as if you were to live forever. Gandhi
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.