Solved

Panel with DataGridView and a Button scrolling problem

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Workplace bullying has increased with the use of email and social media. Retain evidence of this with email archiving to protect your employees.
If your app took Google’s lash recently, here are the 5 most likely reasons.
The viewer will learn how to create multiple layers to apply various filters and how to delete areas from each layer’s filter.
This video demonstrates how to use each tool, their shortcuts, where and when to use them, and how to use the keyboard to improve workflow.

726 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