Hi Srdjan,
Issue 1:
You can handle the ListBoxPart.DrawItem event and draw the substituted values to the dropdown listbox control. Before handling the DrawItem event, you should set the ListBoxPart.DrawMode property to DrawMode.OwnerDrawFixed in TableControlCurrentCellShowingDropDown event. Here is a sample code snippet.
int savedIndex = -1;
string SelectedText = string.Empty;
private void ListBoxPart_DrawItem(object sender, DrawItemEventArgs e)
{
//Declare the SavedIndex as the Class Member.....
ListBox list = sender as ListBox;
StringFormat format = new StringFormat();
format.LineAlignment = StringAlignment.Center;
format.Alignment = StringAlignment.Center;
RectangleF rect = new RectangleF(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height);
///// dText is the drawing text of the DropDown listBox
//// dText is the DisplayText of the DropDown listBox
//// you can assign any of the text to dText here
////--------------------------------------------------------------------------------------------------------////
string dText = list.Items[e.Index].ToString();
if (e.Index > 2)
dText = currency.Rows[e.Index - 3]["Currency"].ToString();
////--------------------------------------------------------------------------------------------------------////
if (list.SelectedIndex == e.Index)
{
if (savedIndex != -1 && savedIndex != list.SelectedIndex)
list.Invalidate(list.GetItemRectangle(savedIndex));
savedIndex = list.SelectedIndex;
e.Graphics.FillRectangle(Brushes.Gold, e.Bounds);
e.Graphics.DrawString(dText, list.Font, new SolidBrush(list.BackColor), rect, format);
SelectedText = dText;
}
else
{
e.Graphics.FillRectangle(Brushes.LightGoldenrodYellow, e.Bounds);
e.Graphics.DrawString(dText, list.Font, new SolidBrush(list.ForeColor), rect, format);
}
}
Issue 2:
One way you can do this by handling the QueryCellInfo event to set the CellType to "TextBox" in a filterbar cell and also you can handle the TableControlCurrentCellKeyPress event for adding the RecordFilters in a grid.
Modified sample :
ExampleGrid0.zipBest regards,
Haneef