473,791 Members | 2,973 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Scrollab leControl". 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 10488
Already solved it by adding this code on the onpaint event:

//Adjust the scroll position
Matrix m = new Matrix();
m.Translate(thi s.AutoScrollPos ition.X,this.Au toScrollPositio n.Y,MatrixOrder .
Append);
pe.Graphics.Tra nsform=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.Scrollab leControl". 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
1554
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 scrollbars or to know if mouse has been used on scrollbar?
2
2597
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 good while and I'm getting really frustrated now! My problem is this - my custom controls periodically disappear from my
3
1606
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 property on my custom control (like the background color). The change is not reflected across my project. If I select and delete the button from my form, then add it again the changes will be shown. But I want to be able to have the change...
11
18151
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 ListView columns so it should be doable, thanks
6
11082
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 how those properties are set. I want to be able to do two other things: a) add User control instances to my page, filling in the place of placeholder controls, and b) programmatically setting custom properties on those dynamically spawned...
15
6523
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 accept other controls. The control i drag drop on it becomes the child of my custom control's parent form and not the child of my custom control. Then i added this line "" before my custom control class (i dont know what this line does). Now
6
7726
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 not match the windows color theme (e.g., Blue). So, I want to custom draw every scrollbar within my application. The problem is that scrollbars can show up in many types of controls that I use within my app, such as in Forms, TextBoxes, ComboBox...
2
1654
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 user control, but I am not able to get a basic link button to click. This seems so ridiculously basic, but I am not able to get this to work. What am I missing?
4
2493
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 unsuccessfully in creating the whole pane as a user control and have succeeded in adding the pane and then dynamically adding the content which is a user control to the pane, dynamically within the page. However I would like to have a single pane...
0
9669
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9515
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10427
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10155
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9029
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5431
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5559
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3718
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.