|
-
Jan 9th, 2004, 05:33 PM
#1
Thread Starter
New Member
Can I add a button to my status bar?
A while back, I found some code to add a progress bar to a status bar (I wanted it to look similar to the IE browser status bar). This progress bar (actually a custom StatusBarPanel) in the status bar was going to be my way of allowing the user to track how far along in a 'process' the app was. Now, I'd like to add a button (for cancelling) to the right of that progress bar.
If someone could at least give me an idea or example of how to generally add a command button to the status bar, I'm sure I can figure out how to make it fit in with my customized status bar.
Any help is much appreciated!
-
Jan 9th, 2004, 10:30 PM
#2
Sleep mode
This should give you a start .
VB Code:
Dim gx As Graphics = Me.StatusBar1.CreateGraphics
ControlPaint.DrawButton(gx, New Rectangle(0, 0, 60, 30), ButtonState.Flat)
-
Jan 9th, 2004, 10:49 PM
#3
Frenzied Member
Interesting, I never thought about a button in a status bar for a GUI. Guess I haven't noticed the IE browser status bar that you mention (I've noticed the status bar of course, just no buttons).
How about a screen shot to take a look?
TIA,
Mike
-
Jan 9th, 2004, 10:52 PM
#4
Sleep mode
If some C# code doesn't scare you , then go to codeproject.com . loads of beautiful controls .
-
Jan 9th, 2004, 11:02 PM
#5
Frenzied Member
Hmmm... cool stuff, I'm sure, giving it a quick look. Very cool programming anyway.
Guess I'm still thinking "how would I use a button on a status bar" in my app. Interactive stuff and status stuff mixed together just doesn't make sense to me. Of course it may open up a nice GUI experience. That's why I want to see a screen shot of a deployed application.
Regards,
Mike
-
Jan 10th, 2004, 04:32 PM
#6
Hi.
You can just create a regular button, and use the parent property.
MyButton.Parent=MyStatusBar
Then set the button location and size to match the panel, and you're set.
Of course, if your app allows the user to resize, then you have to relocate the button to the new position on a sizechanged event.
I wish I could think of something witty to put in my sig...
...Currently using VS2013...
-
Jan 10th, 2004, 04:40 PM
#7
Why not shorten the status bar and put the button on the side instead?
The status bar is named that for a reason, I don't think it was really ment to have buttons added to it.
-
Jan 12th, 2004, 01:15 PM
#8
Thread Starter
New Member
Hey, all! Didn't mean to post and run away... I just had a busy weekend.
Anyway, when I mentioned the IE bar I was refering to a status bar with progress bar, not necessarily the buttons. I've been asked why I would want a button on my status bar...
Well, my company is having me re-write a HUGE app in .NET. The problem with it now is that it is so process-intensive that the user can do very little inside the app while one of these processes is running (some of these processes take hours). So, instead of forcing the user to look at a modal form with a progress bar (essentially locking them out of all other app functionality), I have decided to take advantage of threading and eliminate as many unnecessary forms as possible. I want it nice and concise. When one of these lengthy process is started, I want to thread the process thereby returning GUI control to the user for other app functions. The progress for that process can be tracked in the progress bar in the status bar (like IE) and all forms except the main form are closed. So what is the button for? CANCEL... I need to provide a simple way to abort the process if the user so desires. I've seen a status bar that looks exactly like this in various apps. The button is only visible to the right of the progress bar when the process is running.
Hope that makes for sense.
Thanks to all for the help. This should get me started. For some reason it just seem too easy. I'm trying to avoid always doing a relocate any time the form size changes, so I'll likely try Pirate's method first. I've also seen references to doing a StatusBar1.Controls.Add and specifying a button.
Thanks again. I'll keep you posted.
-
Jan 14th, 2004, 01:14 AM
#9
New Member
I ran into a similar problem while trying to make a MDI web browser. I wanted a tabbed interface, kinda like Opera.
All you really have to do is use the status bar itself!
Use the Panels collection in the status bar. Each panel has 3 properties you're interested in, Borderstyle, Icon, and text.
Border style determines the type of button it is, whether it's raised or inset. In my web browser, I used this as which window was active (active was inset, all others raised).
Icon, is the icon. Of course.
Text, is the text.
Using this, you can emulate IE's status bar
Just watch for the Status Bar's PanelClick event, then use "e.StatusBarPanel" as the panel. Apparantly in .NET, they removed the tag property, so you'll have to find some mechanism of tagging each button dynamically... perhaps a collection?
-
Jan 14th, 2004, 01:40 AM
#10
Originally posted by RoxSox
I ran into a similar problem while trying to make a MDI web browser. I wanted a tabbed interface, kinda like Opera.
I hate to be an ass, but just use Opera and don't try emulating it with IE's monkey-**** rendering engine in a .NET environment.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|