Sorry for the slow response, but I've been busy.
Because you are using the method on my site, most users may not even have
seen the error without further info. I happen to know what you're doing
because of a previous thread.
When Inheriting the shapedform class you need to make sure that the
CreateParams is not applied in DesignTime, so the CreateParams method should
be modified as below:
protected override System.Windows.Forms.CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
if (!this.DesignMode)
{
const int WS_CLIPCHILDREN = 0x2000000;
const int WS_MINIMIZEBOX = 0x20000;
//const int WS_MAXIMIZEBOX = 0x10000;
const int WS_SYSMENU = 0x80000;
const int CS_DBLCLKS = 0x8;
const int CS_DROPSHADOW = 0x20000;
int ClassFlags = CS_DBLCLKS;
int OSVER = Environment.OSVersion.Version.Major * 10;
OSVER += Environment.OSVersion.Version.Minor;
if (OSVER >= 51) ClassFlags = CS_DBLCLKS | CS_DROPSHADOW;
cp.Style = WS_CLIPCHILDREN | WS_MINIMIZEBOX | WS_SYSMENU;
cp.ClassStyle = ClassFlags;
}
return cp;
}
}
--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"ThunderMusic" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> ok... great I solved most of my problems... the only thing remaining is
> the fact that the form appears offset with the sizing anchors in the
> designer when I inherit from it.
>
> So let's say I have my CustomForm, then I create a form like this "public
> class MyForm : CustomForm"... Everytime I want to load MyForm in the
> designer, the anchors are offset... the form itself is in the right
> place, but the anchors are offset low and right and everything I place on
> the form is located at 0,0 and cannot be moved in the designer (cannot
> even be selected again after I select anything else at creation)... I can
> move them into the MyForm.designer.cs tought, and it works fine, but it's
> not the "normal" behavior of things... does anybody can point me to some
> possible causes for this problem?
>
> thanks
>
> ThunderMusic
>
> "ThunderMusic" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hi,
>> I have a custom form that works fine when I debug it or run it in release
>> mode but cannot be loaded in the designer... Actually, it can be loaded
>> in the designer when no control is on it, but the resizing tool (in the
>> designer) is offset both horizontally and vertically and when I put a
>> control on it, as soon as I save, the designer throws an exception (but
>> cannot be reproduced everytime) and the form cannot be loaded anymore
>> unless I remove all the controls from it... but the major problem is the
>> offset of the designer... also, I'm unable to move the newly added
>> controls on my form... I can resize them when I add them and after that
>> cannot even select them... this behavior happens when I want to use the
>> custom form (inherit forms of my projects from this form)...
>>
>> When I want to see the form in the designer (the CustomForm itself
>> inherited from system.windows.forms.form) I receive and exception too
>> (here it is)
>>
>> Events cannot be set on the object passed to the event binding service
>> because a site associated with the object could not be located.
>> Hide
>> at
>> System.ComponentModel.Design.EventBindingService.EventPropertyDescriptor.SetValue(Object
>> component, Object value)
>> at
>> System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeAttachEventStatement(IDesignerSerializationManager
>> manager, CodeAttachEventStatement statement)
>> at
>> System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager
>> manager, CodeStatement statement)
>>
>> Events cannot be set on the object passed to the event binding service
>> because a site associated with the object could not be located.
>> Hide
>> at
>> System.ComponentModel.Design.EventBindingService.EventPropertyDescriptor.SetValue(Object
>> component, Object value)
>> at
>> System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeAttachEventStatement(IDesignerSerializationManager
>> manager, CodeAttachEventStatement statement)
>> at
>> System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager
>> manager, CodeStatement statement)
>>
>> Method 'System.Windows.Forms.Form.SetStyle' not found.
>> Hide
>> at System.RuntimeType.InvokeMember(String name, BindingFlags
>> bindingFlags, Binder binder, Object target, Object[] providedArgs,
>> ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
>> at
>> System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager
>> manager, String name, CodeExpression expression)
>> at
>> System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager
>> manager, CodeStatement statement)
>>
>>
>> Does anybody know the solution to this kind of behavior? btw, it may be
>> relevant to say I'm using a custom message filter (IMessageFilter)
>>
>> Thanks
>>
>> ThunderMusic
>>
>>
>
>