Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
540
Setting grid properties
posted

Hi

How can I set following grid properties via code? I did a search in grid properties but am not clear which properties apply.

a. Hide horizontal lines;

b. Make vertical lines of styles ‘dotted’.

c .Set row height to 18.

d. Set columns values so if they don’t’ fit in the column they show dots, at present my grid simply trims values that do not fit without any indication that there is more info in the column field.

Thanks

Regards

  • 69832
    Offline posted

    a) & b) You can change cell borders via the UltraGrid.DisplayLayout.BorderStyleCell property, but this changes all borders, that is, it affects the horizontal and vertical borders. To solve your problem you would have to set this property to 'Dotted', and then use the IUIElementCreationFilter or IUIElementDrawFilter interface to remove the horizontal borders. The IUIElementCreationFilter approach would involve something like replacing the CellUIElement instances that we add with a derived class that overrides the BorderSides property to return only the top and bottom.

    c) Set the UltraGridRow.Height property. Note that you might have to set the UltraGrid.DisplayLayout.Override.RowSizing property to 'Free' or 'AutoFree' for this to work.

    d) See UltraGrid.DisplayLayout.CellAppearance.TextTrimming