473,569 Members | 2,457 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Panel Scrollbars Problem

26 New Member
Hi all,

I am using panel with autoscroll = true in C#

I have added dataGridView control inside panel.

When the height and width of dataGridView increases and becomes more than panel size, scrollbars of panel are enabled.

When i scroll using any scrollbar and click on the dataGridView which is inside panel, the position of the scrolled scrollbar changes automatically and scrollbars goes to start position.

can anyone tell me how to solve this problem???
Dec 5 '08 #1
5 4716
Ramk
61 New Member
Expand|Select|Wrap|Line Numbers
  1. private void panel1_Scroll(object sender, ScrollEventArgs e)
  2. {
  3.   dataGridView1.Focus();
  4. }
Dec 5 '08 #2
kulabhishek
26 New Member
Thank you Ramk, that solved the problem.
Dec 8 '08 #3
kulabhishek
26 New Member
Hi,

Actually the above approach solved the problem to some extent.

whenever i click on DataGridView after scrolling, the problem is not there, but now if i leave the scrollbars in any position other than starting position and the focus is shifted to other control say ComboBox, now again when i click on DataGridView inside panel, scrollbars move to original position.

can you please suggest something

Regards
Abhishek
Dec 10 '08 #4
Frinavale
9,735 Recognized Expert Moderator Expert
Have you considered adding scroll bars to the DataGridView instead of the Panel?
Dec 10 '08 #5
kulabhishek
26 New Member
Hi Frinavale,

Actually I am not using DataGridView as it is, I have created User Control "Table", in which user will be allowed to merge rows and columns. so I am painting the whole DataGridView in CellPainting event.

This "Table" control is added in other application on panel for which AutoScroll is enabled.

so I set the Width and Height of DataGridView equal to sum of Widths of columns and that of heights of rows respectively.

now here the above mentioned problem comes into picture.

Anyway I have found the solution to this problem, i am handling the MouseDown and MouseClick events for DataGridView in which i m setting the position of the scrollbars for the panel.

Thanks for all your suggestions :)

Regards
Abhishek
Dec 11 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
4082
by: Raymond Dynowski | last post by:
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
2
6011
by: Sascha Schmidt | last post by:
Hello ! I'm trying to combine an external (not part of the panel) vertical scrollbar (VScrollBar) with a panel in order to scroll the content of the panel vertically using the external VScrollbar. I can't set the "AutoScroll"-property to true and then use the generated scrollbars inside the panel, because i have to use this external...
0
1324
by: Tom | last post by:
I have a panel that is set for autoscrolling, however I -DON'T- want the scrollbars to show up. Do anyone know of any way to make a panel autoscroll and yet have no scrollbars? I know that is an odd request but trust me, it is what I need to do in this screwyapplications case :-) Basically, I am keeping this panel synced with another panel...
5
22271
by: Rob T | last post by:
To keep my example simple, let's say I have a windows application form with a panel in it. For this example, I want to draw a single line in the panel, which is larger than the size of the panel. Is there a way to get the scrollbars to show up? Also....If I were to put a control (like a button) into the panel, the scrollbars are...
0
1250
by: Elroyskimms | last post by:
I have a fixed witdth panel control with horizontal scrollbars. In it, I load a table and in each table cell is an instance of a user control that I created it. In theory, 3-5 of these controls are visible in the panel at any given time, and the scrollbars can be used to see anything that is offscreen (overflowed). This works as expected in...
9
4262
by: she_prog | last post by:
Dear All, I need to save the content of a panel to a bitmap. The panel can have many child controls which also need to be saved. The problem would be solved if I could have the panel saved to a Graphics object, which is the same as if I'd need to print it. It'd be easy using Control.DrawToBitmap, but I also need the invisible part of the...
1
2930
by: mrabie | last post by:
Hi All, I know this has been discussed before but i can't really find an answer to what i want to do. I am developing an application for touchscreen using C#. It's going to be a fullscreen application somewhat like a new windows shell. I want the user to scroll up/down the objects currently viewed on the display using finger gestures...
2
9429
by: ATR2000 | last post by:
I have setup a Panel to have a width of 100% so that it will adjust to users screensize. Within the panel I have a table. Unfortunately the table holds a lot of data and exceeds the size of the screen. The panel has a height of 350px and the scrollbar is set to auto so that both scrollbars appear when needed. What is happening is that due...
2
4272
by: kulabhishek | last post by:
Hello all. I have developed one user control "Grid" in C# and I am using it in another user control inside one panel. The AutoScroll property for the panel is enabled. When the height or width of "Grid" increases and becomes more than panel size, scrollbars of panel are enabled. When I scroll using any scrollbar and click on the...
0
7703
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...
0
7618
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...
1
7678
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...
0
6286
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...
1
5514
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...
0
5222
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...
0
3644
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1226
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.