A
Andrew Martin
I have implemented a custom DateTimePicker control with OpenNETCF
IMessageFilter:
public bool PreFilterMessage(ref Microsoft.WindowsCE.Forms.Message m)
{ // Add MsgWindowTest.PreFilterMessage implementation
if (m.Msg == (int)WinAPI.eWM.WM_LBUTTONDOWN)
{
// Get the low and high order words (X, Y coordinates)
int x = DateTimePicker.DateTimePicker.Get_X_LParam(m.LParam.ToInt32());
int y = DateTimePicker.DateTimePicker.Get_Y_LParam(m.LParam.ToInt32());
if (this.hourRectangle.Contains(x, y))
// The hour has focus
}
}
I then use a numericUpDown to increment the date part that has focus.
The issue is that I have 2 controls on my custom control - and m.Msg
returns the X,Y for whichever control is clicked (the DateTimePicker
which I want...and the NumericUpDown which I don't). Is there any way
to determine the control that the X,Y belongs to from this message?
Microsoft.WindowsCE.Forms.Message m
m.HWnd;
m.LParam;
m.Msg;
m.Result;
m.WParam;
Thanks for your help.
-a
IMessageFilter:
public bool PreFilterMessage(ref Microsoft.WindowsCE.Forms.Message m)
{ // Add MsgWindowTest.PreFilterMessage implementation
if (m.Msg == (int)WinAPI.eWM.WM_LBUTTONDOWN)
{
// Get the low and high order words (X, Y coordinates)
int x = DateTimePicker.DateTimePicker.Get_X_LParam(m.LParam.ToInt32());
int y = DateTimePicker.DateTimePicker.Get_Y_LParam(m.LParam.ToInt32());
if (this.hourRectangle.Contains(x, y))
// The hour has focus
}
}
I then use a numericUpDown to increment the date part that has focus.
The issue is that I have 2 controls on my custom control - and m.Msg
returns the X,Y for whichever control is clicked (the DateTimePicker
which I want...and the NumericUpDown which I don't). Is there any way
to determine the control that the X,Y belongs to from this message?
Microsoft.WindowsCE.Forms.Message m
m.HWnd;
m.LParam;
m.Msg;
m.Result;
m.WParam;
Thanks for your help.
-a