473,396 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to get _true_ client area of datagrid

I need to get the actual client area of the datagrid.

DataGrid.ClientSize doesn't seem to take into account: borders and scrollbars
(if visible).

What I need is a way to get the visible width, excluding borders and
scrollbars.

Any clues?
Nov 16 '05 #1
1 2543
Jax
The only thing I can suggest is to take a screen capture (from some graphics package) of the datagrid scrollbar and measure it, as the scrollbar is always the same size, then add a pixel or two for the border and set up the rectangle like that

eg.

Rectangle rect = new Rectangle(this.dataGrid.ClientRectangle.X-1, this.dataGrid.ClientRectange.Y-1, this.datagrid.ClientRectangle.Width + widthOfScrollbar + 2, this.dataGrid.ClientRectangle.Height + scrollbar + 2)

the + 2 is to make up for the pixel lost when you set the location more to the left above and you'll have to add another to get the border on the other side. If the scrollbar is sometimes visible and sometimes not, you might want to run some code to find out how many rows are in the grid and if that exceeds the maximum visible and will therefore result in the scrollbars being visible

It's not a great solution but it'll work
Hope that helps in some way

jax
Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: subash | last post by:
Hi All how to create controls in non-client area of forms or usercontrol.Can any one help in getting information on this or solution for this. regards subash
3
by: Patrick Blackman | last post by:
How do you access the non-client area of a control for painting or resizing the client area. Thanks any help would do.
2
by: cedced | last post by:
Hello, is it possible to access client files in VB.NET? What? I have doing that but it isn't good (VB.NET take file on pc server and not on pc client): (thanks) Dim fichier As StreamReader ...
4
by: Sue | last post by:
ASP.NET web application, data grid with several fields (Labels), table below the datagrid with several textboxes and dropdown lookup tables. When a user clicks on the "Select" button in datagrid,...
1
by: strout | last post by:
I know it's dumb ... sometimes frustrating I want the text and a dropdownlist align with both side of a table cell, i.e. text align left and dropdownlist align right. I cannot add more cells to...
10
by: Woody Splawn | last post by:
I have been developing a ClientServer application on one machine at my office but the time has come to transfer it to the customer. The customer is running a Windows 2000 local area network. I...
0
by: Mike | last post by:
Hi,I was wondering if it is possible to change the way a datagrid scrolls. I would really like to be able to do the following: 1) remove the vertical scrollbar / prevent one from appearing. 2)...
2
by: Frank Lehmann | last post by:
Hi newsgroup, Is it possible to scroll a System.Web.UI.WebControls.DataGrid by code so that a certain row shows up in the visible area? As yet I have only managed to select a certain row...
3
by: Harry_Crow | last post by:
I wanted to change the Non client area height. This was not possible in the existing Form TitleBar. So I set the FormBorderStyle= None and I calculated and introduced the Non Client area myself. So...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.