HideCaret() Windows API function doesn't work properly

Discussion in 'C#' started by cygnusX, Oct 8, 2007.

  1. cygnusX

    cygnusX New Member

    Joined:
    Oct 8, 2007
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    I want to hide the caret in the RichTextBox control and do that with the win api function HideCaret(),but it doesn't work.The cursor is still visible and blinking.Where i should call the function.I tried in the Enter event of the control but doesn't work again.As far as i know i should call the HideCaret() when the RichTextBox gets the focus.Is that right?
    Here is the code:

    [DllImport("User32.dll")]
    static extern Boolean HideCaret(System.IntPtr hWnd);

    private void richTextBox1_Enter(object sender, EventArgs e)
    {
    HideCaret(richTextBox1.Handle);
    }
     
  2. KaiyureBoy

    KaiyureBoy New Member

    Joined:
    May 17, 2008
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    Yep, thanks, thats good idea.

    I tried some possibilities ( etc.) but with no success.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice