Solved

Form with embedded scrollbars

Posted on 2008-06-22
8
582 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
 
LVL 47

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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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 47

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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:…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now