I've created my custom, datetimepicker control and it acts really weird, so I have a few question.
First of all, what have i done:
public partial class MyDateTimePicker : Gizmox.WebGUI.Forms.DateTimePicker
{
public MyDateTimePicker()
{
InitializeComponent();
this.ShowCheckBox = true;
this.Checked = false;
this.CustomFormat = " ";
this.Format = DateTimePickerFormat.Custom;
this.Height = 20;
this.Width = 185;
this.Update();
}
protected override void OnCheckedChanged(EventArgs objEventArgs)
{
if (this.Checked)
{
this.Format = DateTimePickerFormat.Short;
}
else
{
this.CustomFormat = " ";
this.Format = DateTimePickerFormat.Custom;
}
this.Update();
base.OnCheckedChanged(objEventArgs);
}
}
the scenario is:
1. After creating MyDateTimePicker, rebuild solution, create new form, Drag and drop my control into the new form.
Questions:
a) Control MyDateTimePicker dropped into my form in fact has showcheckbox on true, checked on false customformat and format set. Do not have width and height set. Why ?
b) After compile and run control has these four first prop. set like in the constructor (so the field is empty), but as I said in a) - widht and height are not... and OnCheckedChanged event don't work too. Why?
2. So... back to the code: But... After compile, There is no event control anymore, and even by double-click I can't add "OnClick" event to my control. Here is the screen after compile and run:

c) Why?
3. But I'm not giving up. I delete this control and drag and drop new one. Initial properties width and height still are wrong, but I have icon event. I add event OnCheckedChanged and leave it empty. Compile and run.
d) Everything is the same as in b), but OnCheckedChanged event. This event works fine as in overrided code. So.. is it a rule, that I have to add empty event when I ovrrided it ? this is my fourth question...
4. So, basiclly it works. Control is blank when check box is unchecked, and the date is shown when is checked. But! Now I want to change location and size manually in propeties. Back to code, change, move... compile and run. No changes.. Control is the same as I've created few minutes ago. I simply can't change size and location (I checked only these two properties).
e) so.. After setting size, location and adding event, after run the application... control is simply dead... For sure I can't change location of it anymore.. Why ?
5. Ok. Another try: Delete all from this Form and.. drag and drop my control. Set location and width first, then add empty event OnCheckedChanged, compile and run. And now finally it works.. control is right size, location, behavior. But ONLY, when I do this in right order.
6. Now I add second MyDateTimePicker. And I forgot to set size, location and events. Click compile and run... First control works great.. second not. So, I want to back to the code and correct this. Fail.. I can't add event now, and what's more interesting - there is no event control in my first MyDateTimePicker control. In runtime event works, but can't edit it or add new one. Double click on my first control (which has empty OnCheckedChanged event, and works good) - just doeasn't work.. I can't and "onClick" event.
f) this is really really wierd... could you explain my this one ?
7. And the last one. I add MyDateTimePicker control. Set size, location.. add event, run, close etc etc... Now, I want to detele it from my form. Click on it. Detele. It's gone, but in Designer class there is still:
Controls.MyDateTimePicker myDateTimePicker1;
g) So, after delete I have to open Designer and detele it manually.
So.. I will be really really glad if somebody explain me some of these 7 questions ? Cause right now.. I think, creating custom controls in VWG is just mission impossible.
Thanks,
private