473,378 Members | 1,368 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Custom control: adding scrollbars

Hi,

I've drawn my own control using GDI+. But the control is bigger than a
normal form could display, so I want to add scrollbars. Saw somewhere that
you have to inherit from "System.Windows.Forms.ScrollableControl". So I did
that, and the scrollbars are displayed very nice. But when you actually
start scrolling the graphics I've drawn with GDI+ are completely disturbed.

Someone know what I'm doing wrong? Is there another way to add scrollbars to
a custom control?

cheers,

Gerben
Nov 15 '05 #1
1 10452
Already solved it by adding this code on the onpaint event:

//Adjust the scroll position
Matrix m = new Matrix();
m.Translate(this.AutoScrollPosition.X,this.AutoScr ollPosition.Y,MatrixOrder.
Append);
pe.Graphics.Transform=m;

Thank to Bob Powell (http://www.bobpowell.net/gdiplus_faq.htm)

greets

"Gerben van Loon" <ge******@home.nl> wrote in message
news:bf**********@news3.tilbu1.nb.home.nl...
Hi,

I've drawn my own control using GDI+. But the control is bigger than a
normal form could display, so I want to add scrollbars. Saw somewhere that
you have to inherit from "System.Windows.Forms.ScrollableControl". So I did that, and the scrollbars are displayed very nice. But when you actually
start scrolling the graphics I've drawn with GDI+ are completely disturbed.
Someone know what I'm doing wrong? Is there another way to add scrollbars to a custom control?

cheers,

Gerben

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Msqln | last post by:
Hi I made a form with picturebox and scrollbars. However, scrollbars react to arrow keys. What I would like is that scrollbars react only to mouse. Is there a way to ignore keyboard for...
2
by: Suzanne | last post by:
Hi all, I'm reposting this message as I'm experiencing this problem more and more frequently : I really hope someone out there can help me as I've been tearing my hair out on this one for a...
3
by: Pug Fugly | last post by:
I have created a simple windows custom cotrol that inherits a button. I have it added to the toolbox and I am able to add it to my form successfully. The problem comes when I decide to change a...
11
by: Pete Kane | last post by:
Hi All, does anyone know how to add TabPages of ones own classes at design time ? ideally when adding a new TabControl it would contain tab pages of my own classes, I know you can achieve this with...
6
by: | last post by:
I have made some user controls with custom properties. I can set those properties on instances of my user controls, and I have programmed my user control to do useful visual things in response to...
15
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt...
6
by: =?Utf-8?B?bGpsZXZlbmQy?= | last post by:
I am implementing an Office 2007 – like interface, including the ability to change colors. One issue that I have is that scrollbars look poor if the application color theme (e.g., Black) does...
2
by: jfolland | last post by:
I am trying to add a basic user control to a web site; coming from visual studio 2003 this was extremely easy. I would just add the user control and then add the controls that I want on that...
4
by: =?Utf-8?B?UmljaEI=?= | last post by:
I am trying to create a project using the ASP.NET AJAX accordion control. I would like to dynamically add panes to the control with a form template added when the pane is added. I have tried...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.