We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Datagrid Column widths

Thread ID:





13746 May 9,2004 06:52 PM UTC May 17,2004 05:11 AM UTC WinForms 2
Tags: FAQ
Graham Jones
Asked On May 9, 2004 06:52 PM UTC

I have two datagrids that have related information. When I resize a column in one grid, I want to set the size of the corresponding column in the other datagrid to be the size of the resized column. This is where my problem starts. I have used a datagrid.HitTest(e.X, e.Y) in a mouse down event to see if it is a column resize event and then if it is to see which column has been resized. In the mouse down event I get the width of the resized column using: hti = dgClientWIP.HitTest(e.X, e.Y) x = hti.column datagrid.TableStyles(0).GridColumnStyles(x).Width When I drag the column to the new size and let the mouse up, I display the width of the column again. The size is the same as before I resized the column. It only seems to update the new column width after the mouseup event has completed. I cannot work out how to get the new value for the column width from any event that fires – I could set a timer to check to see if there has been a column resize event but that seems rather tacky code. Any ideas gratefully received. With thanks Graham Jones

Replied On May 11, 2004 08:21 AM UTC

I believe there is a WidthChanged event which you can subscribe to on the DataGridColumnStyle class. Cheers!

Graham Jones
Replied On May 17, 2004 05:11 AM UTC

Many thanks, that did the job nicely. Regards Gj


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon