Re: Usable ClientRectangle for Form



I don't know if this is the proper solution, but I ended up using a
transform on the graphics object to translate the drawing so that that is
automatically occurs UNDER the status bar:

private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;

// Start drawing BELOW the statusbar
Matrix matrix = new Matrix();
matrix.Translate(0, menuStrip1.Height);
g.Transform = matrix;

// Now (0,0) is below the statusbar
g.DrawRectangle(Pens.Red, 0, 0, ...);
...


"Bit Twiddler" <bittwiddler35@xxxxxxxxxxx> wrote in message
news:ew5xOHWhFHA.1244@xxxxxxxxxxxxxxxxxxxxxxx
> Hi,
>
> I am performing drawing directly on the surface of a WinForm (double
> buffering).
>
> My form has a menu, statusbar, etc.
>
> The ClientRectangle of my form includes the areas taken up by the menu,
> statusbar, etc. What I want to get is a rectangle that represents the
> area of the form where I need to do my drawing. Is there an easy way to
> get his rectangle or do I have to calculate it myself all the time?
>
> Thanks,
> BT
>


.



Relevant Pages

  • Re: Usable ClientRectangle for Form
    ... >transform on the graphics object to translate the drawing so that that is ... > // Start drawing BELOW the statusbar ... >> The ClientRectangle of my form includes the areas taken up by the menu, ... What I want to get is a rectangle that represents the ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Graphics transforms
    ... I'm drawing a Rectangle somewhere on a Graphics object over an image and ... I now want to use that rectangle to describe the part of the image I want to ... To grab it I'm stuffing it in a BufferedImage by drawing on its Graphics ...
    (comp.lang.java.gui)
  • Re: What are these lines?
    ... Their backcolor appears to be white. ... I am trying to achieve the same look by drawing the same 3 lines in vbasic, ... The resize GrabHandle is part of the statusbar. ... common controls may give you what you are looking for. ...
    (microsoft.public.vb.general.discussion)
  • Re: Drawing during MouseMove. Can I use this.CreateGraphics?
    ... In MouseMove I store the current mouse position and invalidate the screen ... In Paint, I do all the drawing I normally do and then, if the user is ... >> It's strongly discouraged to store the Graphics object handed to you in ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: dashed line not displaying
    ... tab> Object> Create from File> MO Visio Drawing. ... I am unable to use the pencil tool (to resize in any ... the invisible rectangle as I mentioned in my last post. ...
    (microsoft.public.visio.general)