Solved

Form with embedded scrollbars

Posted on 2008-06-22
8
583 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
I need help finding an unknown string value within a string in my VB.Net application 3 37
Run time Error 4 34
Error on link 14 38
Entity Framework 7 32
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:…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

920 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

15 Experts available now in Live!

Get 1:1 Help Now