Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Panel with DataGridView and a Button scrolling problem

Posted on 2010-11-27
4
Medium Priority
?
1,795 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 top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

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

This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
The core idea of this article is to make you acquainted with the best way in which you can export Exchange mailbox to PST format.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…

704 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