Re: SetCaretPos within OnPaint method of user control
- From: "Peter Duniho" <NpOeStPeAdM@xxxxxxxxxxxxxxxx>
- Date: Mon, 31 Mar 2008 11:03:07 -0700
On Mon, 31 Mar 2008 10:15:32 -0700, Steve Richter <StephenRichter@xxxxxxxxx> wrote:
How do I SetCaretPos within the OnPaint method of a user control?
The caret either does not display or is not positioned where I expect
it to be. I am guessing SetCaretPos is working outside the confines
and relative location of the ClipRectangle.
I doubt the issue has anything to do with the ClipRectangle.
in the code that follows, the caret ends up hugging the far left
border of the Form, nowhere near where the user control is located.
Have you tried passing the control's own window handle to the ShowCaret() function?
For what it's worth, the OnPaint() method isn't really a great place to be relocating and showing the caret anyway. The only thing you should be doing in there is actual drawing. I don't think that's related to your problem, but I think you'll be better off in the long run setting and showing the caret in a more appropriate place (like in the OnEnter() override for showing it, and there and wherever else user interaction would move the caret for setting the position).
Pete
.
- Follow-Ups:
- Re: SetCaretPos within OnPaint method of user control
- From: Steve Richter
- Re: SetCaretPos within OnPaint method of user control
- References:
- SetCaretPos within OnPaint method of user control
- From: Steve Richter
- SetCaretPos within OnPaint method of user control
- Prev by Date: Re: Getting a file version
- Next by Date: How can I determine if a point is a given distance from a second point?
- Previous by thread: SetCaretPos within OnPaint method of user control
- Next by thread: Re: SetCaretPos within OnPaint method of user control
- Index(es):
Relevant Pages
|
|