Currency Cell and ForeColor
I''ve been able to change the Forecolor in a Currency Cell when the Cell Value is different than Zero (using OnDraw).
When the Cell Value is Zero the Forecolor does not change. Why?
Any ideas or suggestions will be appreciated.
TIA,
Jose
SIGN IN To post a reply.
5 Replies
AD
Administrator
Syncfusion Team
January 16, 2004 02:34 PM UTC
The CurrencyEdit control from our tools (which the grid''s cell control is based on) does have a Zero color property, but this was not exposed in the grid version. We will have to change that.
As far as a work around until there is a release that handles this, maybe you can do what you want with PrepareViewStyleInfo.
private void gridControl1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
if(e.ColIndex > 0 && e.RowIndex > 0 && e.Style.CellType == "Currency")
{
double d = 0;
try
{
d = double.Parse(e.Style.Text, e.Style.CurrencyEdit.NumberFormatInfoObject);
}
catch{}
if( d == 0)
{
e.Style.CurrencyEdit.PositiveColor = Color.Purple;
}
}
}
AD
Administrator
Syncfusion Team
January 16, 2004 04:31 PM UTC
>The CurrencyEdit control from our tools (which the grid''s cell control is based on) does have a Zero color property, but this was not exposed in the grid version. We will have to change that.
>
>As far as a work around until there is a release that handles this, maybe you can do what you want with PrepareViewStyleInfo.
>
>private void gridControl1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
>{
> if(e.ColIndex > 0 && e.RowIndex > 0 && e.Style.CellType == "Currency")
> {
> double d = 0;
> try
> {
> d = double.Parse(e.Style.Text, e.Style.CurrencyEdit.NumberFormatInfoObject);
> }
> catch{}
> if( d == 0)
> {
> e.Style.CurrencyEdit.PositiveColor = Color.Purple;
> }
> }
>}
>
It did not work like you suggested.
Everytime you set a Color either Positive, Negative or ForeColor there is a call to a SetControlColor() method in Tools.NumberTextBoxBase
resetting the ZeroColor propety always to "Color [ControlText]".
AD
Administrator
Syncfusion Team
January 16, 2004 08:03 PM UTC
It seems to work in this sample. What am I missing?
CS-Currency_8248.zip
AD
Administrator
Syncfusion Team
January 17, 2004 01:04 PM UTC
Attached is a screen shot, no pink color anywhere.
Notice although that I was not able to compile the example. I have to comment these two lines:
//gridControl1.VScrollPixel = true;
//gridControl1.HScrollPixel = true;
I''m using Syncfusion 1.6.1.8 and VS 2003, how about you?
currency_4660.zip
AD
Administrator
Syncfusion Team
January 17, 2004 07:24 PM UTC
I am using the 2020 beta which is why you had to remove those two properties. In 2020, I can see the color sepecified in PrepareViewStyleInfo
SIGN IN To post a reply.
- 5 Replies
- 1 Participant
-
AD Administrator
- Jan 16, 2004 09:44 AM UTC
- Jan 17, 2004 07:24 PM UTC