Re: Draw over controls

Tech-Archive recommends: Fix windows errors by optimizing your registry



On Aug 4, 6:54 pm, Brandon Arnold <reason...@xxxxxxxxx> wrote:
I have a panel that contains a label and a picturebox. When clicked, I
want to draw a rectangle over everything. I can draw the rect and set
the color, no big deal. The problem is because I have to pass the rect
of the panel, it draws on that, and under the other controls. How can
I force it to draw OVER everything else? Ideally this would also be
trackable since the whole thing(panel and children) will be dragable.

You shouldn't really draw outside Paint events, because other controls
can decide to redraw at arbitrary moment of time, and will erase your
changes. Instead, just create an empty Panel of the desired color, and
place it where you want your rectangle to be displayed. If you want
some fancy filling on the panel (gradient, etc), then, instead of
changing its BackColor, handle its Paint event and paint whatever you
want in it.
.



Relevant Pages

  • Re: DrawText fails when attempting to retrieve string extents
    ... DT_CALCRECT is filling Right and Bottom to make the rectangle big enough. ... using the Sprite to draw text (see documentation about ID3DXSprite::Begin ... > RECT Rect; ...
    (microsoft.public.win32.programmer.directx.graphics)
  • RE: GDI+ Clip Region allows 0.0f width pen to draw through
    ... Just to make this more outrageous if you draw the vertical lines from the ... I took the previous code I posted and made the panel anchor to all four ... private void panel1_SizeChanged ... In other words create a rectangle that is a wider than the panel. ...
    (microsoft.public.win32.programmer.gdi)
  • Re: My earlier post was Horizontal Line
    ... The code below is the exact of my Report module. ... It can draw the table ... starting point for the line or rectangle. ... QBColor function to specify the color. ...
    (microsoft.public.access.formscoding)
  • Zero Width Pen Draws through clipped region...
    ... Exclude the rectangle from the graphics clip region. ... Draw a line down the panel. ... IF you use a pen that is more than one pixel the clipping works correctly. ...
    (microsoft.public.dotnet.framework.drawing)
  • RE: TreeView multiple selections
    ... But with this behavior I can't draw a node to normal after selecting twice ... .Net2.0 has added the build-in support for custom-draw. ... rectangle based on your requirement. ... Dim focusPen As New Pen ...
    (microsoft.public.dotnet.general)