Visual Designer Error

Posted by oedev on 27-Mar-2014 10:52

Hi All,

I'm trying to use a thumbnail control from a company called Accusoft on a ABL form. I've added the control to the toolbox, and can successfully drag it onto the form. However, when I then try to access the properties or view the source of the form, the following error is displayed;

"An error occurred while serializing the design surface"

Looking at the control, it inherits from System.Windows.Forms.UserControl. The class itself also only has one constructor.

Comparing this to other controls I've used,they all inherit from System.ComponentModel.Component and have a constructor which can takes a parameter of System.ComponentModel.IContainer.

I've tried to add the control programatically, which I can do, and all method and properties, but the control is not visualized at all.

DEFINE PRIVATE VARIABLE thumbnailXpress1 AS Accusoft.ThumbnailXpressSdk.ThumbnailXpress NO-UNDO.

THIS-OBJECT:thumbnailXpress1 = NEW Accusoft.ThumbnailXpressSdk.ThumbnailXpress().


THIS-OBJECT:thumbnailXpress1:Location = NEW System.Drawing.Point(100, 100).
THIS-OBJECT:thumbnailXpress1:Name = "thumbnailXpress1".
THIS-OBJECT:thumbnailXpress1:Size = NEW System.Drawing.Size(294, 194).

THIS-OBJECT:thumbnailXpress1:Visible = true.
THIS-OBJECT:thumbnailXpress1:Enabled = true.

 THIS-OBJECT:thumbnailXpress1:Items:AddItemsFromDirectory("C:\TEMP\output\scan\", 0).

 message THIS-OBJECT:thumbnailXpress1:Items:Count view-as alert-box.

The message indicates my images are present in the control, but are not shown at all.

Any idea where I am going wrong?


All Replies

Posted by Mike Fechner on 27-Mar-2014 13:19

Hi, the code looks indeed strange.

Let me start by clearing up the terms Control and Component.

A component is a class that can be used in the context of the Visual Designer. The minimum requirement for a Component is that it implements the IComponent Interface. Components are placed on the yellow space at the bottom of the Visual Deisgner. Typical components are the BindingSource, Timer, UltraToolbarController etc.. Components typically have two constructors, one with no parameters, one with the IContainer parameter. When the IContainer parameter constructor is present, the generated code, passes the Container to the component constructor.

A Control derives from System.Windows.Forms.Control (which your UserControl does). Controls are also components. But Controls appear on the design instance of the Form in the Visual Designer. Controls typically only have the Constructor with no parameter. Controls are added to the Controls Collection of the Form (or another ContainerContainer in the Form).

Your code looks strange as the thumbNailXpress1 instance has typical Control properties like Location, Name and Size

but it's not added to the Controls collection of the Form. You may try that yourself:

THIS-OBJECT:Controls:Add (THIS-OBJECT:thumbnailXpress1).

But the code should be created properly.

I'd report that to PSC tech support. It might help telling them, that the Control works on your system as expected in the MS Visual Studio.

Posted by oedev on 27-Mar-2014 14:01

Thanks for the explanation.

Added to the controls list for the form and the thumbnails appear.

Thanks again.

This thread is closed