473,480 Members | 1,688 Online
Bytes | Software Development & Data Engineering Community
Create 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 3542
On Tue, 04 Mar 2008 17:28:00 -0800, Newbro
<Ne****@discussions.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 DisplayRectangle and
AutoScrollPosition properties. Changing either of them affects what is
shown in the ScrollableControl (which Panel inherits). If I recall
correctly, changing DisplayRectangle won't update the scroll bars
automatically (there's another method to do that), so probably you want to
set AutoScrollPosition.

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
ScrollControlIntoView() 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
ScrollableControl. 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 DisplayRectangle, which will be updated
according to the scroll position. Set the AutoScrollPosition 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
9339
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. ...
1
3236
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...
0
1429
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...
1
1951
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...
1
9497
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...
3
2275
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...
0
1929
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...
0
2868
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....
0
3697
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 ? ...
0
7037
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,...
0
6904
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...
0
7034
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,...
1
6732
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...
0
6886
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5324
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,...
1
4768
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...
0
2990
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...
1
558
muto222
php
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.