Hello All,
I am working with Device Application( Compact framework) C#
I have a class which creates grid with numbers on it some thing like shown below
------------
| 1 | 2 | 3 |
------------
| 4 | 5 | 6 |
------------
| 7 | 8 | 9 |
------------
| 0 |
------------
Each cell is Rectangle object ( Rectangle array drawn on panel)
I just want to highlight only the key clicked (same effect as in windows calculator - On mouse down color should change and on mouse up normal color should be displayed)
For this i am doing something like this
bool pushed;
OnMouseDown()
{
pushed = true;
Invalidate();
}
OnMouseUp()
{
pushed = false;
Invalidate();
}
OnPaint(...)
{
....... /// some code
if(pushed)
{
Fill the selected/clicked rectangle with different color
}
.........// some code
}
Problem facing:
For some clicks, key highlight don't work in device application( compact frame work). But in windows application it works properly !!!
Usually when i click on a key, the order should MouseDown -> Onpaint - > MouseUp [ Onpaint calling in middle because of Invalidate in mouse down]
But some times, this order goes wrong in device application [compact framework] like MouseDown -> MouseUp [ OnPaint is missed] Because of this click highlight doesn't work.
Any help on this?
I am working with Device Application( Compact framework) C#
I have a class which creates grid with numbers on it some thing like shown below
------------
| 1 | 2 | 3 |
------------
| 4 | 5 | 6 |
------------
| 7 | 8 | 9 |
------------
| 0 |
------------
Each cell is Rectangle object ( Rectangle array drawn on panel)
I just want to highlight only the key clicked (same effect as in windows calculator - On mouse down color should change and on mouse up normal color should be displayed)
For this i am doing something like this
bool pushed;
OnMouseDown()
{
pushed = true;
Invalidate();
}
OnMouseUp()
{
pushed = false;
Invalidate();
}
OnPaint(...)
{
....... /// some code
if(pushed)
{
Fill the selected/clicked rectangle with different color
}
.........// some code
}
Problem facing:
For some clicks, key highlight don't work in device application( compact frame work). But in windows application it works properly !!!
Usually when i click on a key, the order should MouseDown -> Onpaint - > MouseUp [ Onpaint calling in middle because of Invalidate in mouse down]
But some times, this order goes wrong in device application [compact framework] like MouseDown -> MouseUp [ OnPaint is missed] Because of this click highlight doesn't work.
Any help on this?
Comment