Re: Usable ClientRectangle for Form
- From: "Lloyd Dupont" <net.galador@ld>
- Date: Mon, 11 Jul 2005 11:23:59 +1000
Form.ClientRectangle is what you are after.
personally I would do
Rectangle client = ClientRectangle;
e.Graphics.SetClip(client);
e.Graphics.TranslateTransform(client.X, client.Y);
"Bit Twiddler" <bittwiddler35@xxxxxxxxxxx> wrote in message
news:uhQc7XWhFHA.2424@xxxxxxxxxxxxxxxxxxxxxxx
>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
>>
>
>
.
- References:
- Usable ClientRectangle for Form
- From: Bit Twiddler
- Re: Usable ClientRectangle for Form
- From: Bit Twiddler
- Usable ClientRectangle for Form
- Prev by Date: Re: No double-buffering on a Panel?
- Next by Date: RE: Control licensing issues when accessing from COM
- Previous by thread: Re: Usable ClientRectangle for Form
- Next by thread: No double-buffering on a Panel?
- Index(es):
Relevant Pages
|