IT Community - Software Programming, Web Development and Technical Support

Problem with scrollbars of panel in C#

This is a discussion on Problem with scrollbars of panel in C# within the C# Programming forums, part of the Software Development category; Problem with scrollbars of panel in C# I am using panel with autoscroll = true. I have added dataGridView control inside ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > C# Programming

Register FAQ Members List Calendar Mark Forums Read
  #1  
Old 05-26-2009, 01:55 AM
bluesky bluesky is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 667
bluesky is on a distinguished road
Default Problem with scrollbars of panel in C#

Problem with scrollbars of panel in C#

I am using panel with autoscroll = true.

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
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 05-26-2009, 01:56 AM
shaalini shaalini is offline
D-Web Architect
 
Join Date: Apr 2007
Posts: 633
shaalini is on a distinguished road
Default Re: Problem with scrollbars of panel in C#

Hi,

I confuse why the size of your DataGridView in the panel will increase? DataGridView has scroll bar by default. When the count of the rows in DataGridView is great, it will show scroll bar automatically. Can you tell me the reason why you want to enlarge the DataGridView and let the panel show scroll bar?
__________________
Shaalini.S
Be the Best of Whatever you are...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 05-26-2009, 01:58 AM
bluesky bluesky is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 667
bluesky is on a distinguished road
Default Re: Problem with scrollbars of panel in C#

Hi,

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.

i have tried like this :

private void panel1_Scroll(object sender, ScrollEventArgs e)
{
dataGridView1.Focus();
}

but actually the above approach solves 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.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 05-26-2009, 02:51 AM
bluesky bluesky is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 667
bluesky is on a distinguished road
Default Re: Problem with scrollbars of panel in C#

Hi,

I have found the solution to this problem, I am handling the MouseDown and MouseClick events for DataGridView in which I am setting the position of the scrollbars for the panel, this position was saved in "Panel_Scroll" event.

Thanks for all
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
a new problem? saravanan Computer Hardware 0 03-24-2008 06:09 AM
Problem in IE krishnakumar HTML, CSS and Javascript Coding Techniques 13 11-28-2007 08:51 PM
publicdomainregistry - control panel? annerz General Web hosting Discussions 0 11-06-2007 08:10 PM
How to create an image from panel background Image S.Vinothkumar C# Programming 1 10-22-2007 02:52 AM
My LiteralControl inside the AJAX panel is not working? kingmaker ASP and ASP.NET Programming 0 08-20-2007 10:00 PM


All times are GMT -7. The time now is 01:47 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.
Our Partners
One Way Moving Companies | Stamford Dentist | Euro Millions Lottery | Home Loans| Furniture

SEO by vBSEO 3.0.0