Windows Vista Forums

How to get the "client area" of a window?
  1. #1


    fö Guest

    How to get the "client area" of a window?

    When a window is resized the SizeChangedEventArgs only give
    me the new size of the whole window including title and borders.
    How do I get the width and height of what was formerly known as
    "client area" of a window? In GDI the answer was given by
    GetClientRect(). What's it in WPF?



      My System SpecsSystem Spec

  2. #2


    Drew Marsh Guest

    Re: How to get the "client area" of a window?

    fo wrote:

    > When a window is resized the SizeChangedEventArgs only give me the new
    > size of the whole window including title and borders. How do I get the
    > width and height of what was formerly known as "client area" of a
    > window? In GDI the answer was given by GetClientRect(). What's it in
    > WPF?


    You can get the ActualWidth/Height of the window's content (the root) element.

    HTH,
    Drew

    ___________________________________
    Drew Marsh
    Chief Software Architect
    Mimeo.com, Inc. - http://www.mimeo.com
    Microsoft C# / WPF MVP
    Weblog - http://blog.hackedbrain.com/



      My System SpecsSystem Spec

  3. #3


    fö Guest

    Re: How to get the "client area" of a window?

    Well, it's just the other way around: I want to resize the
    window's root element (a canvas) to its client area. So
    I'd better ask how to do this.

    Thanks,
    fö

    "Drew Marsh" wrote:

    > fo wrote:
    >
    > > When a window is resized the SizeChangedEventArgs only give me the new
    > > size of the whole window including title and borders. How do I get the
    > > width and height of what was formerly known as "client area" of a
    > > window? In GDI the answer was given by GetClientRect(). What's it in
    > > WPF?

    >
    > You can get the ActualWidth/Height of the window's content (the root) element.
    >
    > HTH,
    > Drew
    >
    > ___________________________________
    > Drew Marsh
    > Chief Software Architect
    > Mimeo.com, Inc. - http://www.mimeo.com
    > Microsoft C# / WPF MVP
    > Weblog - http://blog.hackedbrain.com/
    >
    >
    >


      My System SpecsSystem Spec

  4. #4


    Drew Marsh Guest

    Re: How to get the "client area" of a window?

    fö wrote:

    > Well, it's just the other way around: I want to resize the window's
    > root element (a canvas) to its client area. So I'd better ask how to
    > do this.


    Perhaps I don't undersand, this should be automatic. The Window always stretches
    its content to fit the client area. Do you have a screenshot of what you're
    experiencing vs. what you're expecting?

    Cheers,
    Drew



      My System SpecsSystem Spec

How to get the "client area" of a window? problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Plug a cable into network adaptor "Local Area Connection"?? khayes .NET General 3 10 Mar 2009
Plug a cable into network adapter "local area connection" dmpp209 Network & Sharing 0 17 Feb 2009
Shortcut changes when changing attribute from "Normal window" to "Maximized" magoo Vista General 1 20 Nov 2008
Vista style status bar and preview area in "find file" window Spike Spiegel Vista General 1 11 Apr 2008
Where are settings for "Confirm after download" & "in same window" Roland Vista performance & maintenance 0 22 Dec 2006