Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Form with embedded scrollbars

Posted on 2008-06-22
8
Medium Priority
?
591 Views
Last Modified: 2010-08-05
Hello,

I'm trying to get some scrollbars into my main window. In older Windows days (MFC) you set a windows style and you get nice embedded scrollbars.

I didn't find something like that in Windows Forms. So I took HScrollBar and VScrollBar with docking 'bottom' and 'right'.
But the result is not satisfying. The bottom right corner of the window, where the two ScrollBars come together doesn't look like you know it from standard windows applications.
The scrollbars are overlapping. But I want the size gripper between them.

Any suggestions ?
0
Comment
Question by:Pacman
8 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 21843916
have you tried the AutoScroll property? Scrollbar will be shown just when some control exceeds the form borders.
0
 
LVL 9

Author Comment

by:Pacman
ID: 21843968
I'm not sure if AutoScroll will do the job here. I think it's only for scrolling controls.
I have no controls inside my frame window. I want to render some graphics and use scrollbars to navigate.
0
 
LVL 6

Expert Comment

by:Bruce_1975
ID: 21844164
You can use a panel. Docking should be set to Top to use the autoscroll feature.

Regards,
Bruce
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
LVL 48

Expert Comment

by:Wayne Taylor (webtubbs)
ID: 21844180
You can still use AutoScroll. Then simply put your graphics into a PictureBox control, with it's SizeMode property set to AutoSize. Don't dock the PictureBox at all, but place it at location (0, 0).

This will cause the picturebox to grow to fit the size of the image, and if larger than the form, cause the scrollbars to appear.

Wayne
0
 
LVL 9

Author Comment

by:Pacman
ID: 21844185
As said I cannot use the autoscroll feature because I need to set the min/max values manually. AutoScroll only works with controls in your panel.

But I've found a solution now:

I've to build the form and use HScrollBar and VScrollBar without docking but with ANCHORS..
0
 
LVL 9

Author Comment

by:Pacman
ID: 21844193
webtubbs

It's not so easy because I dont work with GDI graphics. I'm on OpenGL ...
0
 
LVL 48

Expert Comment

by:Wayne Taylor (webtubbs)
ID: 21844209
OK, fair enough, but can't you just load the created image into the picturebox?

    PictureBox1.Image = MyImage

I could be wrong though, because I know bugger-all about OpenGL.

BTW, posting your comment after choosing to close the question caused a "Request for Review" to be made to Community Support ( http:/Q_23506807.html ). You will need to restart the process.

Wayne

0
 
LVL 9

Accepted Solution

by:
Pacman earned 0 total points
ID: 21845230
I don't have an image in that way. The OpenGl drawing commands go directly to the rendering pipe.

OK I will close this question now.
I've found the solution:

Take a panel control and put HScrollBar and VScrollBar and the OpenGL drawing control in it.
Set Anchors of Scrollbars and the drawing control so that resizing the panel will resize the child controls also.

This is the same technique as the visual studio text editor uses (you can see it with Spy++).

Thank you for your hints.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Loops Section Overview

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question