Does anyone have an example or idea on embedding a user control within the cell (not drop down editor button) of a cell?
Currently I'm instantiating the usercontrol at runtime from class inheriting EmbeddableEditorBase, but I can't seem to get
the control to paint within the cell. I am also new to the Embeddable Editor archtecture so if anyone knows any good reference
sites that would be helpful. Thanks!
Hi,
Thanks so much its working fine ..
You might want to use the ResolveAppearance method on the cell so that you can get the properties that you need. If you only want the ForeColor, you could do:
AppearancePropFlags requestedProps = AppearancePropFlags.ForeColor;AppearanceData appearance = new AppearanceData();cell.ResolveAppearance(ref appearance, requestedProps);SolidBrush sbrush = new SolidBrush(appearance.ForeColor != Color.Empty ? appearance.ForeColor : Color.Black);
-Matt
You could check the row.activated/cell.activated properties and set the sbrush.color based on that value.
Thanks very much for the reply. Its working perfectly alright. But i need to change the font color at runtime. Since i'm using drawstring, i wont be able to do that at cell level (like cell.Appearance.Forecolor = Color.White) or row level.
Say for example, I have three columns "COL1", "COL2", "COL3" and three rows in the UltrawinGrid. I have my custom maked edit box control at "COL1" and the values forecolor will be Color.Black because i'm using the below mentioned line
Now, I have applied columnstyle property of "COL2" as ColumnStyle.Edit. So, whenever i click on "COL2" i need to change the fore color of "COL1" to white because i'm selecting the entire row (i.e, it should resembles like CellClickAction.Cellselect). But since i'm using DrawString, i wont be able to do that at cell level or row level. That is reason why i asked for rendering the masked edit box? or else it will be really helpful if anyother possible solution for this?
Thanks
Not sure on the masked edit box thing. But in the draw foreground override you can render your own graphics using the Graphics object and the drawstring method.
eg.
EmbeddableUIElement embeddableElement = embeddableUIElement;
SolidBrush sbrush = new SolidBrush(Color.Black);
format.Alignment = StringAlignment.Near;
sbrush,
embeddableElement.EditArea.X,
embeddableElement.EditArea.Y),
format);