Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Panel with DataGridView and a Button scrolling problem

Posted on 2010-11-27
4
Medium Priority
?
1,801 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
  • 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Want to know how to use Exchange Server Eseutil command? Go through this article as it gives you the know-how.
There can be many situations demanding the conversion of Outlook OST files to PST format and as such, there is no shortage of automated tools to perform this conversion. However, what makes Stellar OST to PST converter stand above the rest? Let us e…
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
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…

926 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