Hello,
i have a Grid, in which a column shall display a bitmap. The Bitmap is being rendered on the fly, according to some bit mask in a hidden column of that grid.
The column also has a drop down editor control assigned to it, so that i can edit the bitmask for the bitmap.
But unfortunately i cant see a way that prevents the cell displaying the textbox in which one normaly enters text. I dont need to edit the cell directly - only via the drop down control.
How can i inhibit the textbox from being displayed and still being able to have the drop down buttons displayed?
this is the part of my sourcecode that handles those settings:
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { if (!e.Layout.Bands[0].Columns.Exists("GrafikSpalte")) { e.Layout.Bands[0].Columns.Add("GrafikSpalte"); e.Layout.Bands[0].Columns["GrafikSpalte"].DataType = typeof(Image); } EditorWithText ewt = new EditorWithText(); DropDownEditorButton ddew = new DropDownEditorButton("Kanaele"); ewt.ButtonsRight.Add(ddew); // this is the user control that needs to displayed after dropdown ddew.Control = kanalauswahl1; e.Layout.Bands[0].Columns["GrafikSpalte"].Editor = ewt; } private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e) { e.Row.Cells["GrafikSpalte"].Appearance.ImageBackground = KanalBitmapErzeugen(Convert.ToUInt32(e.Row.Cells["Spalte 1"].Value)); e.Row.Cells["GrafikSpalte"].Appearance.ImageBackgroundStyle = ImageBackgroundStyle.Stretched; //e.Row.Cells["GrafikSpalte"].Value = KanalBitmapErzeugen(Convert.ToUInt32(e.Row.Cells["Spalte 1"].Value)); }
in initializeRow i can either set the cells value or the cells imagebackground to display the desired image.
Greetings Wolfgang
Hi Wolfgang,
Use an EditorWithCombo instead of EditorWithText. Then set the Style on the cell to DropDownList.
Hello Mike,
that works :-)
but i am helplessly trying to drop down my user control when the cell gets activated :-(
i dont want the user to have to double click the cell or to press the drop down button
Hi,
You have to get the dropdown button in the cell. Here's how you do it:
private void ultraGrid1_AfterCellActivate(object sender, EventArgs e) { UltraGrid grid = (UltraGrid)sender; UltraGridCell cell = grid.ActiveCell; EmbeddableEditorButtonBase embeddableEditorButtonBase = cell.EditorResolved as embeddableEditorButtonBase; DropDownEditorButton dropdownEditorButton = embeddableEditorButtonBase.ButtonsRight[0] as DropDownEditorButton; dropdownEditorButton.DropDown(); }
i now solved all the problems with the dropdown buttons.
but it seems that i have some problems with the image that is being displayed in the cell.
How can i manage to display a dynamic bitmap, that represents the contents of another hidden cell?
using "e.Row.Cells["Kanäle zum Synchronisieren"].Appearance.Image = ..." i can assign an image to the cell (either appearance.image or appearance.imagebackground).
I want to have the image size equal to the size of the cell so that no resizing has to be done when the cell is being resized (DrawFilter helps me there).
But even with
"e.Layout.Bands[0].Columns["Kanäle zum Synchronisieren"].Layout.Appearance.ImageBackgroundStyle = ImageBackgroundStyle.Default;"
it seems not to be possible to prevent the image from being stretched.
I limit the size of my image in both directions to a min and a max size.
A form file isn't really very useful, since I can't run it. Can you provide a sample project so I can run it and see what's going on?
i added my form as an attachment.
perhaps you can reproduce it with this source code.
I didnt include the sourcecode for the drop down Control. but i think, that doesnt matter?
Greetings wolfgang
Hi WolfGang,
I tried this out and assigned an image to a cell using the cell.Appearance.Image and my images are not stretched in any way.
I tried it with ImageBackground, too, and there is no stretching occurring.
Are you using Image or ImageBackground?
What is your DrawFilter doing?