none
How to change the color of selection? RRS feed

  • Question

  • Now, i want to change the color of the selection from the window. The default one is blue color such as select the row, select the textbox.

    How can i change it??

    Thanks you

    Friday, July 13, 2007 4:00 AM

Answers

  • Hi,please check following code

    Code Snippet

      Private Sub TextBox1_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.Enter
            ' If the TextBox contains text, change its foreground and background colors.
            If TextBox1.Text <> [String].Empty Then
                TextBox1.ForeColor = Color.Red
                TextBox1.BackColor = Color.Black
                ' Move the selection pointer to the end of the text of the control.
                TextBox1.Select(TextBox1.Text.Length, 0)
            End If
        End Sub 'textBox1_Enter


        Private Sub TextBox1_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.Leave
            ' Reset the colors and selection of the TextBox after focus is lost.
            TextBox1.ForeColor = Color.Black
            TextBox1.BackColor = Color.White
            TextBox1.Select(0, 0)
        End Sub 'textBox1_Leave

     

    With Regards

     

    Tuesday, July 17, 2007 3:45 AM