` Printed Icetips Article

Icetips Article



Windows API: Need to subclass for redrawing of DrawFocusRect
2002-11-04 -- Jim Kane
 
Newsgroups: TopSpeed.Topic.Language


you probably want prop:clienthandle not prop:handle in addition to
invalidate and updatewindow.
you'll need to subclass and redraw your focus rec in response to wm_paint or
if another window overlaps yours, your focus rectangle will go away and not
be redrawn.
jim kane
"Arnor Baldvinsson"  wrote in message
news:3dc6ca9e.16236968@news.softvelocity.com...
> Hi all,
>
> Recently I saw a posting on one of the newsgroups about drawing the
> focus rectangle.  I've been playing with the DrawFocusRect and while
> there are no errors posted and the function succeedes, but there is no
> rectangle drawn.  Here is my test code:
>
> DrawRect        ROUTINE
>  Data
> R       Like(RECT)
> ThisDC  Long
> hwnd    Long
> X       Byte
>  Code
>  0{Prop:Pixels} = True
>  R.Top    = 1
>  R.Left   = 1
>  R.Right  = 50
>  R.Bottom = 50
>  Hwnd     = 0{Prop:Handle}
>  ThisDC   = GetDC(Hwnd)
>  X = DrawFocusRect(ThisDC,R)
>  Message('X = ' & X)
>  ReleaseDC(Hwnd,ThisDC)
>  0{Prop:Pixels} = False
>
> DrawFocusRect always returns 1, indicating success.  I've looked at
> some example code on MSDN and can't see any difference.  I've also
> tried to create a compatible bitmat and draw on it, with same results.
>
> Any ideas welcome:)
>
> Best regards,
>
> ArnĂ³r Baldvinsson
> Icetips Software
> San Antonio, Texas, USA
> www.icetips.com
> arnor@icetips.com
> ICQ:  113314380
>
> Subscribe to information from Icetips.com:
> http://www.icetips.com/getnotificationinfo.htm



Printed November 21, 2024, 6:57 am
This article has been viewed/printed 35202 times.
Google search has resulted in 53 hits on this article since January 25, 2004.