Re: Draw over controls



On Mon, 4 Aug 2008 09:07:36 -0700 (PDT), Pavel Minaev
<int19h@xxxxxxxxx> wrote:

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.

Right now, I have all my controls and their associated labels together
in seprate panels. Adding more panels seems rather, ugly. Would it
be considered bad form to use them so liberaly? Right now i'm toying
around with that idea. I've placed a panel over the controls(and
parent panel) and when the desired control set is clicked, the overlay
panel is displayed. It works right now with solid colors being set
but i'm having an issue with transparency, but I can work that out.

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
http://www.usenet.com
.



Relevant Pages

  • 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: Q: Owner Drawn LB with Panels for the Items
    ... TextBox control is slapped on top of the ListBox to enable in-place editing. ... individual controls as the list items. ... If all the controls are the same width as a panel and you ... > ControlPaint and it only has Draw... ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Rectangle in pixel, user coordinates in mm, TODO-draw the points correct.
    ... If rectangle is ok, which define zero point, draw. ... // Pixel vom Panel ermitteln ... int pixelLeft = panelInput.Left; ... g.DrawRectangle(Pens.Red, FactorZollMillimeter * abmessungen.X1, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: 9CWL weekly drawing exercises
    ... Brooke can always draw a panel of Amos getting booted in the rump ... I was discussing the strip with a ... > character development stuff at all. ...
    (rec.arts.comics.strips)
  • Re: Transparent panels/controls.
    ... This is a hassle (not being able to overlay controls) - but I'm working my ... them to draw. ... In my form there is a normal main panel with a background ... I have managed to succesfully add controls to the transparent panel to test ...
    (microsoft.public.dotnet.framework.drawing)