Thread: Help resizing client area

  1. #1
    Unregistered
    Guest

    Smile Help resizing client area

    Greetings! I am making a paint program, and I need to know how to resize the CLIENT AREA of the window, not the window itself. I am trying to get the client area to be 64x64, but have had no luck. Please guide me in the right direction! I thought sending a WM_SIZE message would do the trick, but it didn't. Any help would be greatly apperciated! ^_^

  2. #2
    Registered User
    Join Date
    May 2002
    Posts
    317
    The quick solution would be to make the area you paint in a child window whose size you can control when you create, or whatever. If you look into thee window styles you'll see you can create windows with no borders, aka just a client area. Make the icon null, and window type WS_CHILDWINDOW|WS_VISIBLE. This should take care of your problem.

  3. #3
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    You could call

    AdjustWindowRect() //gets window rect from client rect

    and then use the values in

    SetWindowPos() or MoveWindow()//moves and/or sizes windows
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  4. #4
    Unregistered
    Guest
    Thanks for taking the time to post replys. I apperciate both of your solutions. I had little trouble implimenting the first solution, but, I would really like an example of the second one if it wouldn't be too much trouble.

  5. #5
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Post what you have tried and I will correct it. Will not just write the code for you.

    Send in a *RECT (&Rect) set to 0 and the size needed (0,0,64,64) to AdjustWindowRect().
    GetWindowLong() will get the styles, look up the flag probably GWL_STYLE.
    Set the BOOL to true if the window has a menu.

    On a successful return the Rect will contain the dimensions of the window rect.

    Then just resize the window.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. MFC: Clear Client Area
    By mrafcho001 in forum Windows Programming
    Replies: 2
    Last Post: 06-27-2005, 01:35 PM
  2. Displaying more shapes in the same client Area
    By sajeev_js in forum Windows Programming
    Replies: 1
    Last Post: 06-11-2005, 01:52 PM
  3. MDI client area auto sizing.
    By Rare177 in forum Windows Programming
    Replies: 1
    Last Post: 04-09-2005, 04:49 AM
  4. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM
  5. Clearing the client area
    By Isometric in forum Windows Programming
    Replies: 15
    Last Post: 01-29-2002, 10:07 PM