Print Page | Close Window

Column autosize

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=6093
Printed Date: 27 April 2024 at 1:05pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Column autosize
Posted By: @lin
Subject: Column autosize
Date Posted: 12 January 2007 at 6:15am
Hello

I want to have a column with autosize, but not in the way autosize works for this control. What I need is that the size of the column to be calculated so that every item to be visible. It is the same like doubleclicking the edge of the header. Can this be done via some funcions implemented in the control or do i have to calculate the size myself?

Thank you



Replies:
Posted By: sserge
Date Posted: 14 January 2007 at 10:38am
Hi,

There is a method Column.BestFit which adjusts a column size like you wish. 

Method which will adjust all columns size:

Private Sub AdjustAllColumns()
    Dim i As Integer
    For i = 0 To wndReportControl.Columns.Count - 1
        wndReportControl.Columns(i).BestFit
    Next i
End Sub


Call it from Form_Resize and disable regular column autosizing in Form_Load (.AutoColumnSizing = False)

--
WBR,
Serge


Posted By: @lin
Date Posted: 17 January 2007 at 3:42am
Thanx for your answer. Unfortunatelly it does not work. I have Xtreme Suite ActiveX Controls v10.3 and the method is unavailable for this version.


Posted By: @lin
Date Posted: 17 January 2007 at 3:44am
Also I want this only at first (when filling the grid) and not on resize. Like i said, i want something similar to dblclick on column edge but calable from the code.


Posted By: sserge
Date Posted: 17 January 2007 at 3:54pm
Hi,

What is not working? AFAIK method .BestFit was available since the very early versions of the control.

--
WBR,
Serge


Posted By: @lin
Date Posted: 18 January 2007 at 3:43am
For example this line:
wndReportControl.Columns(i).BestFit

Method BestFit is not recognized. It is not available in help also.



Posted By: sserge
Date Posted: 18 January 2007 at 4:35pm
Oops, sorry, BestFit() was added in version 10.4 only. I've mixed it up with MFC version, where it was available from the very beginning...

--
WBR,
Serge



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net