Fast and Responsive Image Button For .NET Compact Framework
I am developing for the .NET Compact Framework 3.5 in C# for Windows Mobile.
I need a button that has the following characteristics:
- An Image property so I can customize the look of the button with an Image
- A pressed Image property so I can customize the pressed look of the button.
- Drawing must be fast. When the button is pressed, the look should change to the pressed look very quickly so that the user knows very quickly that the button is pressed and does not need to wait for the look to change. When the button is released the look should change back to the unpressed look very quickly.
- All button clicks must be registered. Even if you tap the same button very rapidly, the click event should be fired that many time开发者_StackOverflows.
- All button clicks must quickly fire the Click event. Even if you tap the same button very rapidly, the click event should be quickly fired that many times.
- I do NOT need alpha blending support, but I guess it would not hurt if the other requirements were still met.
I tried the following but nothing meets all these needs yet:
Overriding the standard Button control's OnPaint method has no effect in CF.
The PictureBox control does not meet requirement 4. When you rapidly press the same button, the number of Click events fired is less than the number of times you clicked the button. I have that exact same problem when I override the Control class with the smallest amount of code possible without even drawing images. What is strange is that the standard Button control does not have this problem.
The OpenNETCF 2.3 Button2 class does not meet requirement 4 since it has that same problem.
The AlphaMobileControls library does not meet requirements 3 and 5.
When the user clicks rapidly and repeatedly on a button, part of the events will be interpreted as double click events. This explans why you are seeing less than you expected. This is not specific for .net CF, but common to all windows flavors I am aware of.
精彩评论