Solved

Panel with DataGridView and a Button scrolling problem

Posted on 2010-11-27
4
1,783 Views
Last Modified: 2013-12-17
I have a panel with a dataGridView and a Delete Button, with the AutoScroll of the panel set to True,
and i need to make the button change its location to the left side of the row I select on the dataGridView, and im having trouble getting the button to work properly, the thing is that when my datagridView gets too many rows, i can't set the location of my button properly, so the button disappear if i select a row bigger then 15, which is the limit of the panel before the scroll starts to show up...
I tried using a VScrollBar instead of the panel's Autoscroll but still I can't get passed to this problem =(

0
Comment
Question by:marcinhU
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 13

Expert Comment

by:Naman Goel
ID: 34222943
you can use cutomautoscrollpanel available at following location

http://www.codeproject.com/KB/miscctrl/CustomAutoScrollPanel.aspx
0
 

Assisted Solution

by:marcinhU
marcinhU earned 0 total points
ID: 34222989
i dont see how that's useful for my need, how could a custom Autoscroll would be any different than a VScrollBar in my case?

My problem its with the dataGridView and the Button, which I can't set the location of the button to the right place, which is to the left side of a selected row of the dataGridView...
0
 

Accepted Solution

by:
marcinhU earned 0 total points
ID: 34223509
I found a solution to this problem after searching a little more...


System.Drawing.Rectangle recRow;
            recRow = dataGridView1.GetRowDisplayRectangle(dataGridView1.CurrentCell.RowIndex, false);
            buttonX.Top = recRow.Y + dataGridView1.Top - 4;
            // dataGridView1.Top - 4 so it will stay on the middle of the cell..

Open in new window

0
 

Author Closing Comment

by:marcinhU
ID: 34255770
I found it very easy to obtain the top, just get the rectangle of the cell and just set the top of that rectangle to the top of the button =)
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let’s list some of the technologies that enable smooth teleworking. 
The article will include the best Data Recovery Tools along with their Features, Capabilities, and their Download Links. Hope you’ll enjoy it and will choose the one as required by you.
This video will demonstrate how to find the puppet warp tool from the edit menu and where to put the points to edit.
XMind Plus helps organize all details/aspects of any project from large to small in an orderly and concise manner. If you are working on a complex project, use this micro tutorial to show you how to make a basic flow chart. The software is free when…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question