I'm using the .NET Compact Framework and would like to subclass a PictureBox control (in this case to remove the CS_DBLCLKS style from specific instances of the PictureBox control). The code below works on .NET standard, but not the Compact Framework:
using System;
using System.Windows.Forms;
namespace NoDblClick
{
public partial class NoDblClickPicControl : PictureBox
{
private const int CS_DBLCLKS = 0x008;
public NoDblClickPicControl()
{
}
protected override CreateParams CreateParams
{
get
{
// No compile, missing directive or assembly directive
CreateParams cp = base.CreateParams;
cp.ClassStyle &= ~CS_DBLCLKS;
return cp;
}
}
}
}
How do I get this to work on the Compact Framework? Perhaps I can PInvoke the functionality (from coredll.dll say)?
These styles are applied when the window class is created, and to my knowledge cannot be changed on the compact framework. Besides
CreateParams
, the full framework allows a window handle to be recreated, which also is not possible on the compact framework.You could manually filter the messages sent to the control, and convert the double click message back to a mouse down message: