473,406 Members | 2,451 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,406 software developers and data experts.

Force a panel to scroll

How do you force a panel to scroll in code.
I have a large picture box inside my panel.
I would like the panel to default to the centre of the screen, rather than
the scrollbars showing the top left corner

Thanks
Ray
Nov 16 '05 #1
3 4070

Try this

private const int WM_VSCROLL = 0x115;
private const int SB_LINEDOWN = 1;
private const int SB_PAGEUP= 2;
private const int SB_PAGEDOWN= 3;
private const int SB_THUMBPOSITION= 4;
private const int SB_THUMBTRACK= 5;
private const int SB_TOP= 6;
private const int SB_BOTTOM = 7;
private const int SB_ENDSCROLL = 8;

[DllImport("user32.dll")]
private static extern int SendMessage(IntPtr hWnd, int wMsg, IntPtr wParam,
IntPtr lParam);

// use the constant values based on the functionality
SendMessage(panel1.Handle, WM_VSCROLL, (IntPtr) SB_LINEDOWN , IntPtr.Zero);

--
Shak
(Houston)
"Raymond Dynowski" <de***@tesco.net> wrote in message
news:dV_Dc.103$7I6.72@newsfe1-win...
How do you force a panel to scroll in code.
I have a large picture box inside my panel.
I would like the panel to default to the centre of the screen, rather than
the scrollbars showing the top left corner

Thanks
Ray

Nov 16 '05 #2
> I would like the panel to default to the centre of the screen, rather than
the scrollbars showing the top left corner I'm not sure what you mean by this... you want to center the picture? Is the
picture larger than the panel in which it's contained?

--
John Wood
EMail: first name, dot, last name, at priorganize.com

"Raymond Dynowski" <de***@tesco.net> wrote in message
news:dV_Dc.103$7I6.72@newsfe1-win... How do you force a panel to scroll in code.
I have a large picture box inside my panel.
I would like the panel to default to the centre of the screen, rather than
the scrollbars showing the top left corner

Thanks
Ray

Nov 16 '05 #3
Raymond,
How do you force a panel to scroll in code.
I have a large picture box inside my panel. Have you tried setting the Panel.AutoScrollMinSize to the size of the
picture box, so the scroll bars appear, then set the
Panel.AutoScrollPosition so the PictureBox is "centered".

Be certain to read the help on AutoScrollPosition as the coordinates you
give it to scroll may not be what you initially expect (you need to use
negative offsets sometimes).
I would like the panel to default to the centre of the screen, rather than
the scrollbars showing the top left corner Do you want the image to center the panel, or do you really want the panel
to center the screen?

Hope this helps
Jay
"Raymond Dynowski" <de***@tesco.net> wrote in message
news:dV_Dc.103$7I6.72@newsfe1-win... How do you force a panel to scroll in code.
I have a large picture box inside my panel.
I would like the panel to default to the centre of the screen, rather than
the scrollbars showing the top left corner

Thanks
Ray

Nov 16 '05 #4

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

Similar topics

1
by: Anand Ganesh | last post by:
Hi All, I am trying to draw a picture in a panel control. It is drawing up correctly. When the picture size is greater than the panel control, I am expecting horizontal and vertical scroll...
14
by: Open Wound | last post by:
What method can I call to programmatically scroll a panel? There is ScrollControlIntoView() but I don't have a control to scroll into view. I just want the panel to scroll up by 100 pixels. ...
0
by: Raymond Dynowski | last post by:
I have a custom image that I draw to a picture box. The image is too big to view, so I put the picture box within a panel, so that I can scroll around the image, so far so good. I would like to...
2
by: Jason Chu | last post by:
Simple compatibility question, I have this: <table height="100%" width="50%" border="1"> <tr height="50%"> <td> <asp:Panel id="Panel1" runat="server" Height="100%" Width="100%"...
17
by: n. Smith | last post by:
Can anyone help here? I need to scroll a panel in code, because I don't want to display the scroll bar on screen. Any suggestions. N.
2
by: Paul E Collins | last post by:
I'm writing an application whose main window consists of a particular UserControl that I have placed inside a docked Panel so that it will fill the whole window. The panel also has the AutoScroll...
4
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, I've windows form, in this form i've a panel. I want to draw lines inside the panel using the panel coordinates( meaing that the left upper corner of the panel is 0,0), how can i do it? ...
0
by: mike | last post by:
Hi guys, I have a windows form and on load event I dynamically created a panel and dynamically create/add pictureboxes to panel and added a panel to the form with docking with fill. I am...
4
by: mateusz.zajakala | last post by:
Hi, I have panel (with autoscroll property) on which I'm dynamicaly adding of controls. When I want to scroll my panel using scrollbars it freezes all the controls added on that panel, makes...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
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
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,...
0
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...
0
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
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,...

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.