CB
Clay Burch
Syncfusion Team
August 20, 2002 09:03 PM UTC
Currently, there is no way to do this without deriving a cell control. The attached sample shows one way to go about this.
RY
Rachel York
August 21, 2002 11:15 AM UTC
> Currently, there is no way to do this without deriving a cell control. The attached sample shows one way to go about this.
The zip file posted does not contain Form1.resx file. Can you please post this also? Thanks!
CB
Clay Burch
Syncfusion Team
August 21, 2002 01:03 PM UTC
You can let VS.NET regenerate that resx file (this way it will use the proper references on your system).
At the top of Solutions Explorer, click the Show all Files button. Then open the Form1 node to see the resx file. Then right click the resx file, and delete it. Then if you open the form in the designer and make a change, this file will be regenerated.
Let me know if this does not work, and I'll post one, but I think letting the VS regenerate it is best.
RY
Rachel York
August 21, 2002 04:04 PM UTC
> You can let VS.NET regenerate that resx file (this way it will use the proper references on your system).
>
> At the top of Solutions Explorer, click the Show all Files button. Then open the Form1 node to see the resx file. Then right click the resx file, and delete it. Then if you open the form in the designer and make a change, this file will be regenerated.
>
> Let me know if this does not work, and I'll post one, but I think letting the VS regenerate it is best.
I got the DropDownGridCell class that was posted for to work to display custom grids in the popup window. Now I have a question about sizing the popup grid that appears. I see in the DropDownGridCell code where
this.dropdownContainer.PopupHost.Size = new Size(350, 200);
sets the size of the popup window. I would like that popup window to be the size of the grid. Seems simple enough - just replace the above line with
this.dropdownContainer.PopupHost.Size = grid.Size;
However, I am resizing the popup grid on the CellButtonClicked event of the original grid control. So, when the button is clicked in the original grid I custom size the popupgrid. Then the DropDownGridCell.DropDownContainerShowingDropDown() event is called. However, when i get in this event the popup grid's size has now reverted back to the default size - losing the sizing changes made on the CellButtonClicked event. Any ideas?
CB
Clay Burch
Syncfusion Team
August 21, 2002 07:27 PM UTC
You can make the size of the dropdown a public property of the renderer class, and use this property in the DropDownContainerShowingDropDown to set the size of the dropdown.
Then in the CellButtonClicked event, you can set this public property to the size you want it to be. To get at the renderer object in your CellButtonClicked handler, use code such as:
DropDownGridCellRenderer renderer = (DropDownGridCellRenderer)this.gridControl1.CellRenderers["GridADropCell"];
Or, you could get at try to get the renderer through the CurrentCell.
DropDownGridCellRenderer renderer = (DropDownGridCellRenderer)this.gridControl1.CurrentCell.Renderer;
Maybe something like this would work for you...
RY
Rachel York
August 22, 2002 02:55 PM UTC
Thanks for the help so far. I have another question...
When I click on the drop down button in my cell, the drop down grid opens but the text that is in that cell disappears. Then, once the drop down grid is closed the text is still gone. It does not reappear until I click into another cell...
RY
Rachel York
August 22, 2002 05:44 PM UTC
I'm having a problem with unwanted/unnecessary scroll bars appearing in my drop down grid. I used the techniques that were suggested about to size the popup window to the same size as my grid. It worked great however there is one slight problem that i am having. The first time i click on the drop down button and i am dropping down a grid with more than 1 line scroll bars appear. The next time i click on the button the scroll bars are not there. However both times the popup window and the grid are sized perfectly. Oddly enough the drop down grid works fine when popping up a custom sized grid with a rowcount of 1.
public override void DropDownContainerShowingDropDown(object sender, CancelEventArgs e)
{
this.dropdownContainer.AutoScroll = false;
this.dropdownContainer.PopupHost.AutoScroll = false;
this.dropdownContainer.Size = _PopupSize;
this.dropdownContainer.PopupHost.Size = _PopupSize;
this.dropdownContainer.PopupHost.FormBorderStyle = FormBorderStyle.FixedSingle;
this.dropdownContainer.Parent.Size = _PopupSize;
this.dropdownContainer.Dock = DockStyle.Fill;
this.dropdownContainer.IgnoreDialogKey = true;
if (grid == null)
{
grid = Grid.CreateNewControl(this.dropdownContainer, 0, 0) as GridControlBase;
grid.Dock = DockStyle.Fill;
}
grid.VScroll = false;
grid.HScroll = false;
grid.HScrollBar.Enabled = false;
grid.VScrollBar.Enabled = false;
grid.Parent = this.dropdownContainer;
grid.Visible = true;
this.dropdownContainer.Controls.Add(grid);
base.DropDownContainerShowingDropDown(sender, e);
}
As you can see i have tried as much as i can think of to stop the scroll bars from appearing. Please help!
Thanks in advance!
CB
Clay Burch
Syncfusion Team
August 22, 2002 09:51 PM UTC
Without seeing a working sample to debug, I am just throwing out ideas for you to try.
You might just enlarge your dropdown by 50 pixels in each dimension to see if you are off by a pixel or two causing the scrollbars to appear. If the larger dropdown works, then you might be missing borders or something.
You can also call GridControl.UpdateScrollBars from your code to force the scrollbars to be updated say after the call to base.DropDownContainerShowingDropDown (or maybe before it).
CB
Clay Burch
Syncfusion Team
August 23, 2002 11:09 AM UTC
I looked at trying to set the size of the dropdown based on the grid size in CellButtonClick.
There is a recursive type problem in trying to do this: First, you have to actually set the grid.Size to what you want it to be when you create the grid (the code was not doing this) so you can use this grid.Size to set the dropdown size in CellButtonClick. But then, the dropdown takes this size and sizes itself. Then, since the grid is dock.Filled inside the dropdown, this caused the grid.Size to be changed. Thus the next time you hit CellButtonClick, we have a slightly smaller grid to work with, and so on.
One solution is not to use grid.size in your CellButtonClick, but instead use some added property that was initially set using the gridsize you want, but then is no longer dependent upon the gridsize (so it avoids the recursion).