OpenCFNET forms question

  • Thread starter Thread starter Balint Toth
  • Start date Start date
Bálint,

Do you mean something like
listBoxEx1.Items[listBoxEx1.SelectedIndex].ToString()
 
A new problem has raised:

changing the foreground the foreground of the existing items do not change:

myListBoxEx.ForeColor = Color.Violet;
myListBoxEx.RefreshItems();

Doesn't work. Additionally if I add a new item, than it's color is violet.

Maybe this is a bug in OpenNETCF?

Regards,
Bálint
 
If you want to change the foreground of the existing items, you can use this
code snippet:

foreach (OpenNETCF.Windows.Forms.ListItem li in listBoxEx1.Items)

{

li.ForeColor = Color.Violet;

}


--
Regards,

Maarten Struys, eMVP
PTS Software bv

www.opennetcf.org | www.dotnetfordevices.com
 
Just tested this myself. It makes sense, if you think about it. When a new
item is added to the Items collection, its foreground color is set to the
listboxex's foreground color. If you want to change the foreground color of
an item that was previously added, you have to change it explicitly.

Paul T.
 
Exactly!

The foreground color of the control itself is just a guidance for the new
items.
I don't think it makes sense to change the color of all the existing items
when the forecolor of the control's changed. You might have the items of a
different color already added...
 
Back
Top