Solved

Panel with DataGridView and a Button scrolling problem

Posted on 2010-11-27
4
1,757 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Suggested Solutions

A high-level exploration of how our ever-increasing access to information has changed the way we do our jobs.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video demonstrates basic masking and how to edit the mask to reveal the desired image.
The viewer will learn common shortcuts with easy ways to remember them. The viewer will then learn where to find all of the keyboard shortcuts, how to create/change them, and how to speed up their workflow.

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now