method Element.Copy ([X as Variant], [Y as Variant])
Creates a new copy of the current element.

TypeDescription
X as Variant A long expression that defines the copy's x-coordinate or a string expression that defines the x-offset to show the copy of the element. If empty, the default x-coordinate is "16", which indicates the offset to show the copy relative to the source.
Y as Variant A long expression that defines the copy's y-coordinate or a string expression that defines the y-offset to show the copy of the element. If empty, the default y-coordinate is "16", which indicates the offset to show the copy relative to the source.
ReturnDescription
ElementAn Element object that indicates the newly created copy.
The Copy property copies the current element, and returns the newly created element. The Copy property copies almost all properties of the element. The Add method adds programmatically a new element to the surface. Use the InsertControl method to insert programmatically a child element that hosts an inner ActiveX control.

The following samples shows how you can create a copy of the element:

VBA (MS Access, Excell...)

With SwimLane1
	.Background(90) = RGB(255,255,255)
	.Elements.Add("Element 1",0,0).Copy().Caption = "Aka"
End With

VB6

With SwimLane1
	.Background(exElementBackColor) = RGB(255,255,255)
	.Elements.Add("Element 1",0,0).Copy().Caption = "Aka"
End With

VB.NET

With Exswimlane1
	.set_Background(exontrol.EXSWIMLANELib.BackgroundPartEnum.exElementBackColor,Color.FromArgb(255,255,255))
	.Elements.Add("Element 1",0,0).Copy().Caption = "Aka"
End With

VB.NET for /COM

With AxSwimLane1
	.set_Background(EXSWIMLANELib.BackgroundPartEnum.exElementBackColor,16777215)
	.Elements.Add("Element 1",0,0).Copy().Caption = "Aka"
End With

C++

/*
	Copy and paste the following directives to your header file as
	it defines the namespace 'EXSWIMLANELib' for the library: 'ExSwimLane 1.0 Control Library'

	#import <ExSwimLane.dll>
	using namespace EXSWIMLANELib;
*/
EXSWIMLANELib::ISwimLanePtr spSwimLane1 = GetDlgItem(IDC_SWIMLANE1)->GetControlUnknown();
spSwimLane1->PutBackground(EXSWIMLANELib::exElementBackColor,RGB(255,255,255));
spSwimLane1->GetElements()->Add("Element 1",long(0),long(0))->Copy(vtMissing,vtMissing)->PutCaption(L"Aka");

C++ Builder

SwimLane1->Background[Exswimlanelib_tlb::BackgroundPartEnum::exElementBackColor] = RGB(255,255,255);
SwimLane1->Elements->Add(TVariant("Element 1"),TVariant(0),TVariant(0))->Copy(TNoParam(),TNoParam())->Caption = L"Aka";

C#

exswimlane1.set_Background(exontrol.EXSWIMLANELib.BackgroundPartEnum.exElementBackColor,Color.FromArgb(255,255,255));
exswimlane1.Elements.Add("Element 1",0,0).Copy(null,null).Caption = "Aka";

JScript/JavaScript

<BODY onload="Init()">
<OBJECT CLASSID="clsid:AFA73FCE-6609-4062-AE6A-4BAD6D96A025" id="SwimLane1"></OBJECT>

<SCRIPT LANGUAGE="JScript">
function Init()
{
	SwimLane1.Background(90) = 16777215;
	SwimLane1.Elements.Add("Element 1",0,0).Copy(null,null).Caption = "Aka";
}
</SCRIPT>
</BODY>

VBScript

<BODY onload="Init()">
<OBJECT CLASSID="clsid:AFA73FCE-6609-4062-AE6A-4BAD6D96A025" id="SwimLane1"></OBJECT>

<SCRIPT LANGUAGE="VBScript">
Function Init()
	With SwimLane1
		.Background(90) = RGB(255,255,255)
		.Elements.Add("Element 1",0,0).Copy().Caption = "Aka"
	End With
End Function
</SCRIPT>
</BODY>

C# for /COM

axSwimLane1.set_Background(EXSWIMLANELib.BackgroundPartEnum.exElementBackColor,(uint)ColorTranslator.ToWin32(Color.FromArgb(255,255,255)));
axSwimLane1.Elements.Add("Element 1",0,0).Copy(null,null).Caption = "Aka";

X++ (Dynamics Ax 2009)

public void init()
{
	COM com_Element;
	anytype var_Element;
	;

	super();

	exswimlane1.Background(90/*exElementBackColor*/,WinApi::RGB2int(255,255,255));
	var_Element = COM::createFromObject(exswimlane1.Elements()).Add("Element 1",COMVariant::createFromInt(0),COMVariant::createFromInt(0)); com_Element = var_Element;
	var_Element = COM::createFromObject(com_Element).Copy(); com_Element = var_Element;
	com_Element.Caption("Aka");
}

Delphi 8 (.NET only)

with AxSwimLane1 do
begin
	set_Background(EXSWIMLANELib.BackgroundPartEnum.exElementBackColor,$ffffff);
	Elements.Add('Element 1',TObject(0),TObject(0)).Copy(Nil,Nil).Caption := 'Aka';
end

Delphi (standard)

with SwimLane1 do
begin
	Background[EXSWIMLANELib_TLB.exElementBackColor] := $ffffff;
	Elements.Add('Element 1',OleVariant(0),OleVariant(0)).Copy(Null,Null).Caption := 'Aka';
end

VFP

with thisform.SwimLane1
	.Object.Background(90) = RGB(255,255,255)
	.Elements.Add("Element 1",0,0).Copy().Caption = "Aka"
endwith

dBASE Plus

local oSwimLane,var_Element

oSwimLane = form.EXSWIMLANEACTIVEXCONTROL1.nativeObject
oSwimLane.Template = [Background(90) = 16777215] // oSwimLane.Background(90) = 0xffffff
// oSwimLane.Elements.Add("Element 1",0,0).Copy().Caption = "Aka"
var_Element = oSwimLane.Elements.Add("Element 1",0,0).Copy()
with (oSwimLane)
	TemplateDef = [dim var_Element]
	TemplateDef = var_Element
	Template = [var_Element.Caption = "Aka"]
endwith

XBasic (Alpha Five)

Dim oSwimLane as P
Dim var_Element as local

oSwimLane = topparent:CONTROL_ACTIVEX1.activex
oSwimLane.Template = "Background(90) = 16777215" // oSwimLane.Background(90) = 16777215
' oSwimLane.Elements.Add("Element 1",0,0).Copy().Caption = "Aka"
var_Element = oSwimLane.Elements.Add("Element 1",0,0).Copy()
oSwimLane.TemplateDef = "dim var_Element"
oSwimLane.TemplateDef = var_Element
oSwimLane.Template = "var_Element.Caption = `Aka`"


Visual Objects


oDCOCX_Exontrol1:[Background,exElementBackColor] := RGB(255,255,255)
oDCOCX_Exontrol1:Elements:Add("Element 1",0,0):Copy(nil,nil):Caption := "Aka"

PowerBuilder

OleObject oSwimLane

oSwimLane = ole_1.Object
oSwimLane.Background(90,RGB(255,255,255))
oSwimLane.Elements.Add("Element 1",0,0).Copy().Caption = "Aka"

Visual DataFlex

Procedure OnCreate
	Forward Send OnCreate
	Set ComBackground OLEexElementBackColor to (RGB(255,255,255))
	Variant voElements
	Get ComElements to voElements
	Handle hoElements
	Get Create (RefClass(cComElements)) to hoElements
	Set pvComObject of hoElements to voElements
		Variant voElement
		Get ComAdd of hoElements "Element 1" 0 0 to voElement
		Handle hoElement
		Get Create (RefClass(cComElement)) to hoElement
		Set pvComObject of hoElement to voElement
			Variant voElement1
			Get ComCopy of hoElement Nothing Nothing to voElement1
			Handle hoElement1
			Get Create (RefClass(cComElement)) to hoElement1
			Set pvComObject of hoElement1 to voElement1
				Set ComCaption of hoElement1 to "Aka"
			Send Destroy to hoElement1
		Send Destroy to hoElement
	Send Destroy to hoElements
End_Procedure

XBase++

#include "AppEvent.ch"
#include "ActiveX.ch"

PROCEDURE Main
 	LOCAL oForm
	LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
	LOCAL oSwimLane

	oForm := XbpDialog():new( AppDesktop() )
	oForm:drawingArea:clipChildren := .T.
	oForm:create( ,,{100,100}, {640,480},, .F. )
	oForm:close  := {|| PostAppEvent( xbeP_Quit )}

	oSwimLane := XbpActiveXControl():new( oForm:drawingArea )
	oSwimLane:CLSID  := "Exontrol.SwimLane.1" /*{AFA73FCE-6609-4062-AE6A-4BAD6D96A025}*/
	oSwimLane:create(,, {10,60},{610,370} )

		oSwimLane:SetProperty("Background",90/*exElementBackColor*/,AutomationTranslateColor( GraMakeRGBColor  ( { 255,255,255 } )  , .F. ))
		oSwimLane:Elements():Add("Element 1",0,0):CallMethod("Copy",):Caption := "Aka"

	oForm:Show()
	DO WHILE nEvent != xbeP_Quit
		nEvent := AppEvent( @mp1, @mp2, @oXbp )
		oXbp:handleEvent( nEvent, mp1, mp2 )
	ENDDO 
RETURN