473,804 Members | 3,720 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Autoscroll oversized userControl in panel

I have this program running on PDA compact framework in which it will receive
paint message from server's networkstream and updates the client's screen by
drawing on this custom 'Draw' userControl.

Now on the PDA this 'Draw' userControl has a size of 480 x 320.
This control is added to a panel with autoscroll set to true. Since the PDA
screen has a size of 320 x 240, scroll will always be visible and show the
left top sectionof the userControl.

The program can receive paint message and update the PDA screen just fine by
drawing on this userControl, however at some point if the draw point if
outside of the current clientRectangle , I want to scroll this point before
drawing on the userControl. However I'm not sure how to do that. Since
clientRectangle can only be read, I've tried us this.Bounds or similar
functions but doesn't seem to do the job.

Any ideas would be great, Thanks in advanced
Mar 5 '08 #1
1 3558
On Tue, 04 Mar 2008 17:28:00 -0800, Newbro
<Ne****@discuss ions.microsoft. comwrote:
[...]
The program can receive paint message and update the PDA screen just
fine by
drawing on this userControl, however at some point if the draw point if
outside of the current clientRectangle , I want to scroll this point
before
drawing on the userControl. However I'm not sure how to do that. Since
clientRectangle can only be read, I've tried us this.Bounds or similar
functions but doesn't seem to do the job.

Any ideas would be great, Thanks in advanced
Well, the first thing that comes to mind is the DisplayRectangl e and
AutoScrollPosit ion properties. Changing either of them affects what is
shown in the ScrollableContr ol (which Panel inherits). If I recall
correctly, changing DisplayRectangl e won't update the scroll bars
automatically (there's another method to do that), so probably you want to
set AutoScrollPosit ion.

That said, I'm also a bit confused by your description. Your post says
that you are drawing into a custom UserControl. However, typically a
UserControl is used for composition of other controls. If you're
compositing other controls, then it seems to me that your panel should
instead be a UserControl and should directly contain the other controls
you want. If that's the case, then you can just use the
ScrollControlIn toView() method to show whatever needs to be shown.

On the other hand, if you're not compositing and you're doing all the
drawing yourself, it seems like the custom control should just be derived
from Control directly. Using a UserControl is overkill in that
situation. Alternatively, your custom control can inherit
ScrollableContr ol. That would provide the flattest control hierarchy; I
don't see any reason to nest controls when you don't need to. Just draw
whatever you're drawing into the DisplayRectangl e, which will be updated
according to the scroll position. Set the AutoScrollPosit ion as necessary
to ensure that the "draw point" is within the viewable area.

Pete
Mar 5 '08 #2

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

Similar topics

1
9368
by: John | last post by:
I'm trying to use the DrawText() method to draw some very long string text on the Panel with AutoScroll enabled. However, for some unknown reasons, I could not trigger the ScrollBar to show up. Here is the simplicied section of drawing code: private void panel_Paint(object sender, System.Windows.Forms.PaintEventArgs e) { panel.AutoScroll = true;
1
3252
by: Chris Morse | last post by:
I'm trying to figure out how to get Panel to autoscroll a picturebox that changes size. Initially, the picture box is the same size as the panel, but when I add a "zoom" function that doubles the picturebox's size, the panel does not display any scroll bars. Now, even in the IDE designer, I cann't get scroll bars to appear. I've set the AutoScroll to True and nothing seems to work. Any suggestions?
0
1444
by: 23s | last post by:
I have 2 rich textboxes within an auto-scrolling panel object. The textboxes aren't wider than the panel, so it never scrolls horizontally. But the combined height of both textboxes is taller than that of the panel, so the panel scrolls up and down in order to accomodate both of them. The user can drag the Vscrollbar just fine and move about normally. This setup is probably easier to illustrate than describe verbally: ...
1
1970
by: Workgroups | last post by:
Not having much luck tracking this down... I'm working with a form, Form1, which contains a panel called pnlParent. Both Form1 and pnlParent have AutoScroll = False. pnlParent contains a panel called pnlScroller. pnlScroller.AutoScroll = True. Finally, pnlScroller contains a custom control I wrote (in which I override OnPaint & paint entirely custom, if that matters). So in summary there are 4 controls with the following...
1
9523
by: Kent | last post by:
Hi, I have a form which contain 2 panels, Master and Detail, Master panel is on top and Detail panel is at the bottom. In the form, I set Detail panel to Dock to the bottom and Master panel Dock to fill. As a result, when I do form resize, Detail's height always retain whereas Master height change base on form size. What I want to do now is I want to set a minimum size for the form, so that if the form got resize small than certain...
3
2293
by: Tom Bianchi | last post by:
Hi, I have a Panel with the AutoScroll property set to True and many TextBoxes into it, with only some of them positioned in the visible portion of the panel. Is there a Panel event that I can handle when I tab from textbox to textbox and the panel has to scroll *automatically* from the current position to bring the focused control into view ? I know it is possible to use the Enter event of each textbox, but I must execute a time...
0
1952
by: Neeraj | last post by:
Hi I have panel and inside the panel i have many picturebox,if number of picturebox increase ,i have set panel's autoscroll property to true,but as and when i click on any of the picturebox ,i want to stop default scrollmoving property of panel,so that i can use this event for my picturebox. I donot want to set its autoscroll to false,i want panel's scrollbar to be visible ,but they should'nt function when i scroll mousewheel on
0
2897
by: eweaver | last post by:
Hello, I have a problem with getting an autoscrollbar to end up where I want it. Things to know about the prob: I have an imagebox inside of a Panel for (inheritance of) autoscroll capabilities. The imagebox is named panel2 for my own conventions and the panel will be named panel1 Panel2 (the imagebox) is set to fit to the size of Panel1 (the Panel). All of this works great... I have broken up an extremely large image (width wise, not mem...
0
3720
by: MrNobody | last post by:
Here is a quick sample app I made which illustrates the problem I am having making my own UserControl: how do I get scrollbars to appear if I draw something bigger than the ClientSize ? Apparently Autoscroll doesn't do it, and if I change the properties Size or ClientSize to reflect the size of the image I draw it simply makes the entire control grow instead of forcing scorllbars. In Java I would have updated the control's...
0
9706
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
9582
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
10580
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...
0
10335
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9157
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...
1
7621
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5525
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
5652
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2993
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.