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

Resizing a column in GDBG

Thread ID:





8551 Nov 11,2003 02:48 PM UTC Nov 18,2003 08:11 PM UTC WinForms 6
Tags: GridControl
Administrator [Syncfusion]
Asked On November 11, 2003 02:48 PM UTC

Is there a way to get the same behaviour as in Excel when a column width is 0. In Excel, the mouse pointer changes to two small vertial lines if the col behind has a 0 width. One thing I found is to set the MinResizeColSize to 1, so there is a small grey line between the columns and the user would be able to resize the hidden column. Is there another way to do this? Regards Thomas

Administrator [Syncfusion]
Replied On November 11, 2003 04:58 PM UTC

To change the cursor you would either have to derive the grid and override OnSetCursor, or implement your own IMousecController class. The simplest way is to derive the grid, and override OnSetCursor. Here is a sample. You can add additional checks to narrow where you set the cursor. Another way is to implement IMouseController and fit directly into the grid's mosue controller architecture. You can create a class that implements the IMouseController interface which will also allow you to control the cursor. This takes a little more code but does not require that you derive the grid to use it. Here is a sample that changes the cursor over the top half of each cell. This means that anywhere else, the grid allows the other controllers a chance to handle the mouse actions. Your mouse controller must implement the IMouseController interface. The main method you have to handle is the HitTest method. Returning a non-zero hit value at that point indicates to the grid that your mousecontroller wants control of things at this point. It will then the use your controller for all messages as long as the hittest returns nonzero. This means your controller will provide the cursor, it will handle the mousedown etc. In the sample, the only functionality implemented is to change the cursor and to handle a left click. You would use as your hit test criteria for either of these samples being over a header cell border of a hidden column. It would take a little effort, but is doable I think.

Administrator [Syncfusion]
Replied On November 11, 2003 05:34 PM UTC

Thanks Clay, that would give me the ability to achieve the same behaviour as Excel. Regards Thomas

Jason Haag
Replied On November 17, 2003 07:22 PM UTC

Implementing this controller seems to disable all the normal mouse behaviors such as being able to select columns (single and multiple). Is it possible to use this method only in certain situations, such as when the form cursor is set to a WaitCursor. The actaul problem is when the form is busy and the user moves the mouse over the form, the cursor is set to the default cursor "fooling" the user that the form is ready for additional requests. j

Administrator [Syncfusion]
Replied On November 17, 2003 08:13 PM UTC

If your HitTest in your controller returns 0, then your controller would not affect other controllers at that point. So, when you want to pass on the mouse actions, make sure you return zero in your HitTest.

Jason Haag
Replied On November 18, 2003 07:09 PM UTC

ok, I will attempt to do that. what exactly does the hittest do, and why does it return 101 in the sample you provided.

Administrator [Syncfusion]
Replied On November 18, 2003 08:11 PM UTC

101 is not zero. That is reason. You could return different values if you want to indicate your mouse is over different things. But, whoever is calling this routine would have to be aware of your coding scheme. As fas as the grid goes, there are only 2 values, zero and nonzero.


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