1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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