zeddy (1) [Avatar] Offline

so far i enjoy reading ur book. however after compiling the program in chapter 4 and playing it around, i discover something weird...

I found something weird with the program created in Chapter 4. I thought it was my code, but I downloaded your code and it still bogs my mind.

Do this:
- Load image
- Maximize the window
- Use the bottom-right edge to resize the window
- Tada! The program looks crashed, but you still can hit the restore button (or doubleclick the titlebar), but wait, where is the status bar?

Is it a bug in the owner-drawn panel code or a bug in the .Net framework?

eebrown (89) [Avatar] Offline
Re: window resize makes status bar disappear!
Hey Zeddy,

I apologize for the delay in responding to your post. Logistical problems. I tried this using VS .NET 1.1 on Windows XP Pro. I assume what you are seeing is similar.

I would call this a "feature" rather than a bug. You really shouldn't be able to resize a maximized window. When you grab the resize tool that is associated with the StatusBar control, you are resizing the StatusBar itself and not the entire window. The resize properly occurs with the space for the status bar, allowing you to effectively resize the status bar to nothing.

Now when you restore or perform any other operation, the status bar is now the smaller size. I was able to effectively remove the status bar from the window, or just make is smaller than it was originally.

So I guess the lesson is don't resize when you maximize the window. By the way, I tried this with an early Whidbey version I have, and still see the same behavior. I'll submit a bug report on this.