Sign in to follow this  

Of sticks and Carets...

This topic is 4352 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How do I shrink the size of the Caret in an Edit control? I can do everything with the control but control that darn caret. Right now my window is small, 8 pixels in height, but the caret is huge, like 30 pixels. The only thing that comes tom mine would be to subclass the window and interupt part of the painting process, or perhpas try to check for the painting of the edit control in the main window proc by checking the hwnd of the edit contrl against the hwnd returned in the win proc. Thx! Bolt

Share this post


Link to post
Share on other sites
Okay, basically I create an Edit control where the user can input some numbers. The edit window is very small in height, only 8 pixels. The thing is, when a user clicks in the edit field to enter numbers the caret is huge, like 20 pixels high. So it extends out of the edit area and onto the main window. What I'm trying to do is find a way to shrink the size of the caret so that it fits inside of the edit control instead of "spilling" over the edges of the control onto the main window...

Hope this helps clear things up

Share this post


Link to post
Share on other sites
I assume you're developing in Windows with tradition Win32 programming style. To create a caret, you invoke CreateCaret () API function and supply the caret width:
BOOL CreateCaret(HWND hWnd, HBITMAP hBitmap, int nWidth, int nHeight);

If nWidth == 0 it takes the default system's caret attributes. To get system's caret settings, you call SystemParametersInfo () with SPI_GETCARETWIDTH. You may look up MSDN for details.

Share this post


Link to post
Share on other sites

This topic is 4352 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this