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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Setting Multicolumn combobox''s header size

Thread ID:

Created:

Updated:

Platform:

Replies:

41721 Mar 9,2006 05:16 PM UTC Mar 17,2006 02:27 PM UTC WinForms 5
loading
Tags: Tools
Chin Wye Jin
Asked On March 9, 2006 05:16 PM UTC

Hi, I have to 3 columns (Column A,B,C), column C is hidden. I hope to set the width of Column A and B to fit the maximum dropdownwidth of the multicolumn combobox. while hiding the column C. I''ve tried some approach but didn''t seem to work. I''ve attached the codes that i use together with the screen shots on how the result are. Thanks in advance...

Anupama Roy [Syncfusion]
Replied On March 10, 2006 08:51 AM UTC

Hi Jin, Could you please upload your files once again? Thanks , Anu.

Chin Wye Jin
Replied On March 17, 2006 04:04 AM UTC

Hi, i''m sorry for seeing this so late... Here is the screenshot...that is suppose to be with my first post

MCCB0.zip

Chin Wye Jin
Replied On March 17, 2006 06:30 AM UTC

hi Anupama Roy, I''ve actually solve the previous post, but now i got a new problem. i''ve attached 3 pictures of the problem... The first picture is taken when my combo box drop down for the first time. Second picture is when i mouse over my mouse on the drop down grid. which the columns width only change to what i set. The last picture is what i really want my columns to be like. i''m using the codes below to do it: ------------------------------------------------ GridListControl gcontrolShift = this.mcolShiftCode.ListControl as GridListControl; gcontrolShift.Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(ShiftGrid_PrepareViewStyleInfo); void ShiftGrid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e) { if (e.RowIndex > 0 && e.ColIndex > 1) { e.Style.Format = "t"; } if (e.RowIndex == 0) { GridFontInfo fontinfo = new GridFontInfo(); fontinfo.FontStyle = FontStyle.Regular; fontinfo.Bold = false; fontinfo.Size = 8.25F; fontinfo.Unit = GraphicsUnit.Point; e.Style.Font = fontinfo; switch (e.ColIndex) { case 1: e.Style.Text = UIResx.ShopflowDataTracking.ShiftID; e.Style.CellModel.Grid.ColWidths.SetSize(e.ColIndex, 100); break; case 2: e.Style.Text = UIResx.ShopflowDataTracking.ShiftCode; e.Style.CellModel.Grid.ColWidths.SetSize(e.ColIndex, 100); break; case 3: e.Style.Text = UIResx.ShopflowDataTracking.StartTime; e.Style.CellModel.Grid.ColWidths.SetSize(e.ColIndex, 100); break; case 4: e.Style.Text = UIResx.ShopflowDataTracking.EndTime; e.Style.CellModel.Grid.ColWidths.SetSize(e.ColIndex, 100); break; } } } ------------------------------------------------ This problem only occurs when i have more than 2 columns in my dropdown grid. I hope the information tha i provide you sufficient... Thanks in advance.. :)

Shift.zip

Administrator [Syncfusion]
Replied On March 17, 2006 12:20 PM UTC

Hi Jin, Calling the this.mcolShiftCode.ListBox.Grid.Invalidate(); after setting the cell column widths will solve the issue. Below is a code snippet. Lets us know if this helps. void ShiftGrid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e) { if (e.RowIndex > 0 && e.ColIndex > 1) { e.Style.Format = "t"; } if (e.RowIndex == 0) { GridFontInfo fontinfo = new GridFontInfo(); fontinfo.FontStyle = FontStyle.Regular; fontinfo.Bold = false; fontinfo.Size = 8.25F; fontinfo.Unit = GraphicsUnit.Point; e.Style.Font = fontinfo; switch (e.ColIndex) { case 1: e.Style.Text = UIResx.ShopflowDataTracking.ShiftID; e.Style.CellModel.Grid.ColWidths.SetSize(e.ColIndex, 100); break; case 2: e.Style.Text = UIResx.ShopflowDataTracking.ShiftCode; e.Style.CellModel.Grid.ColWidths.SetSize(e.ColIndex, 100); break; case 3: e.Style.Text = UIResx.ShopflowDataTracking.StartTime; e.Style.CellModel.Grid.ColWidths.SetSize(e.ColIndex, 100); break; case 4: e.Style.Text = UIResx.ShopflowDataTracking.EndTime; e.Style.CellModel.Grid.ColWidths.SetSize(e.ColIndex, 100); break; } this.mcolShiftCode.ListBox.Grid.Invalidate(); } } Regards, Calvin.

Chin Wye Jin
Replied On March 17, 2006 02:27 PM UTC

Thanks a lot Calvin!! It works!! :)

CONFIRMATION

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.

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

;