exgauge - sample code

How can I display a simple knob, to fit the control's client area?

VBA (MS Access, Excell...)

With Gauge1
	.PicturesPath = "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob 1"
	.PicturesName = "`Layer` + str(value + 1) + `.png`"
	.LayerAutoSize = -1
	.DefaultLayer(18) = "width MAX height"
	.DefaultLayer(19) = "width MAX height"
	.Layers.Count = 5
	With .Layers.Item(4)
		.OnDrag = 3
		.DefaultRotateAngle = -142
	End With
End With

VB6

With Gauge1
	.PicturesPath = "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob 1"
	.PicturesName = "`Layer` + str(value + 1) + `.png`"
	.LayerAutoSize = -1
	.DefaultLayer(exDefLayerWidth) = "width MAX height"
	.DefaultLayer(exDefLayerHeight) = "width MAX height"
	.Layers.Count = 5
	With .Layers.Item(4)
		.OnDrag = exDoRotamove
		.DefaultRotateAngle = -142
	End With
End With

VB.NET

With Exgauge1
	.PicturesPath = "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob 1"
	.PicturesName = "`Layer` + str(value + 1) + `.png`"
	.LayerAutoSize = -1
	.set_DefaultLayer(exontrol.EXGAUGELib.DefaultLayerPropertyEnum.exDefLayerWidth,"width MAX height")
	.set_DefaultLayer(exontrol.EXGAUGELib.DefaultLayerPropertyEnum.exDefLayerHeight,"width MAX height")
	.Layers.Count = 5
	With .Layers.Item(4)
		.OnDrag = exontrol.EXGAUGELib.OnDragLayerEnum.exDoRotamove
		.DefaultRotateAngle = -142
	End With
End With

VB.NET for /COM

With AxGauge1
	.PicturesPath = "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob 1"
	.PicturesName = "`Layer` + str(value + 1) + `.png`"
	.LayerAutoSize = -1
	.set_DefaultLayer(EXGAUGELib.DefaultLayerPropertyEnum.exDefLayerWidth,"width MAX height")
	.set_DefaultLayer(EXGAUGELib.DefaultLayerPropertyEnum.exDefLayerHeight,"width MAX height")
	.Layers.Count = 5
	With .Layers.Item(4)
		.OnDrag = EXGAUGELib.OnDragLayerEnum.exDoRotamove
		.DefaultRotateAngle = -142
	End With
End With

C++

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

	#import <ExGauge.dll>
	using namespace EXGAUGELib;
*/
EXGAUGELib::IGaugePtr spGauge1 = GetDlgItem(IDC_GAUGE1)->GetControlUnknown();
spGauge1->PutPicturesPath(L"C:\\Program Files\\Exontrol\\ExGauge\\Sample\\Design\\Circular\\Knob 1");
spGauge1->PutPicturesName(L"`Layer` + str(value + 1) + `.png`");
spGauge1->PutLayerAutoSize(-1);
spGauge1->PutDefaultLayer(EXGAUGELib::exDefLayerWidth,"width MAX height");
spGauge1->PutDefaultLayer(EXGAUGELib::exDefLayerHeight,"width MAX height");
spGauge1->GetLayers()->PutCount(5);
EXGAUGELib::ILayerPtr var_Layer = spGauge1->GetLayers()->GetItem(long(4));
	var_Layer->PutOnDrag(EXGAUGELib::exDoRotamove);
	var_Layer->PutDefaultRotateAngle(-142);

C++ Builder

Gauge1->PicturesPath = L"C:\\Program Files\\Exontrol\\ExGauge\\Sample\\Design\\Circular\\Knob 1";
Gauge1->PicturesName = L"`Layer` + str(value + 1) + `.png`";
Gauge1->LayerAutoSize = -1;
Gauge1->DefaultLayer[Exgaugelib_tlb::DefaultLayerPropertyEnum::exDefLayerWidth] = TVariant("width MAX height");
Gauge1->DefaultLayer[Exgaugelib_tlb::DefaultLayerPropertyEnum::exDefLayerHeight] = TVariant("width MAX height");
Gauge1->Layers->Count = 5;
Exgaugelib_tlb::ILayerPtr var_Layer = Gauge1->Layers->get_Item(TVariant(4));
	var_Layer->OnDrag = Exgaugelib_tlb::OnDragLayerEnum::exDoRotamove;
	var_Layer->DefaultRotateAngle = -142;

C#

exgauge1.PicturesPath = "C:\\Program Files\\Exontrol\\ExGauge\\Sample\\Design\\Circular\\Knob 1";
exgauge1.PicturesName = "`Layer` + str(value + 1) + `.png`";
exgauge1.LayerAutoSize = -1;
exgauge1.set_DefaultLayer(exontrol.EXGAUGELib.DefaultLayerPropertyEnum.exDefLayerWidth,"width MAX height");
exgauge1.set_DefaultLayer(exontrol.EXGAUGELib.DefaultLayerPropertyEnum.exDefLayerHeight,"width MAX height");
exgauge1.Layers.Count = 5;
exontrol.EXGAUGELib.Layer var_Layer = exgauge1.Layers[4];
	var_Layer.OnDrag = exontrol.EXGAUGELib.OnDragLayerEnum.exDoRotamove;
	var_Layer.DefaultRotateAngle = -142;

JScript/JavaScript

<BODY onload="Init()">
<OBJECT CLASSID="clsid:91628F12-393C-44EF-A558-83ED1790AAD3" id="Gauge1"></OBJECT>

<SCRIPT LANGUAGE="JScript">
function Init()
{
	Gauge1.PicturesPath = "C:\\Program Files\\Exontrol\\ExGauge\\Sample\\Design\\Circular\\Knob 1";
	Gauge1.PicturesName = "`Layer` + str(value + 1) + `.png`";
	Gauge1.LayerAutoSize = -1;
	Gauge1.DefaultLayer(18) = "width MAX height";
	Gauge1.DefaultLayer(19) = "width MAX height";
	Gauge1.Layers.Count = 5;
	var var_Layer = Gauge1.Layers.Item(4);
		var_Layer.OnDrag = 3;
		var_Layer.DefaultRotateAngle = -142;
}
</SCRIPT>
</BODY>

VBScript

<BODY onload="Init()">
<OBJECT CLASSID="clsid:91628F12-393C-44EF-A558-83ED1790AAD3" id="Gauge1"></OBJECT>

<SCRIPT LANGUAGE="VBScript">
Function Init()
	With Gauge1
		.PicturesPath = "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob 1"
		.PicturesName = "`Layer` + str(value + 1) + `.png`"
		.LayerAutoSize = -1
		.DefaultLayer(18) = "width MAX height"
		.DefaultLayer(19) = "width MAX height"
		.Layers.Count = 5
		With .Layers.Item(4)
			.OnDrag = 3
			.DefaultRotateAngle = -142
		End With
	End With
End Function
</SCRIPT>
</BODY>

C# for /COM

axGauge1.PicturesPath = "C:\\Program Files\\Exontrol\\ExGauge\\Sample\\Design\\Circular\\Knob 1";
axGauge1.PicturesName = "`Layer` + str(value + 1) + `.png`";
axGauge1.LayerAutoSize = -1;
axGauge1.set_DefaultLayer(EXGAUGELib.DefaultLayerPropertyEnum.exDefLayerWidth,"width MAX height");
axGauge1.set_DefaultLayer(EXGAUGELib.DefaultLayerPropertyEnum.exDefLayerHeight,"width MAX height");
axGauge1.Layers.Count = 5;
EXGAUGELib.Layer var_Layer = axGauge1.Layers[4];
	var_Layer.OnDrag = EXGAUGELib.OnDragLayerEnum.exDoRotamove;
	var_Layer.DefaultRotateAngle = -142;

X++ (Dynamics Ax 2009)

public void init()
{
	COM com_Layer;
	anytype var_Layer;
	;

	super();

	exgauge1.PicturesPath("C:\\Program Files\\Exontrol\\ExGauge\\Sample\\Design\\Circular\\Knob 1");
	exgauge1.PicturesName("`Layer` + str(value + 1) + `.png`");
	exgauge1.LayerAutoSize(-1);
	exgauge1.DefaultLayer(18/*exDefLayerWidth*/,"width MAX height");
	exgauge1.DefaultLayer(19/*exDefLayerHeight*/,"width MAX height");
	exgauge1.Layers().Count(5);
	var_Layer = COM::createFromObject(exgauge1.Layers()).Item(COMVariant::createFromInt(4)); com_Layer = var_Layer;
		com_Layer.OnDrag(3/*exDoRotamove*/);
		com_Layer.DefaultRotateAngle(-142);
}

Delphi 8 (.NET only)

with AxGauge1 do
begin
	PicturesPath := 'C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob 1';
	PicturesName := '`Layer` + str(value + 1) + `.png`';
	LayerAutoSize := -1;
	set_DefaultLayer(EXGAUGELib.DefaultLayerPropertyEnum.exDefLayerWidth,'width MAX height');
	set_DefaultLayer(EXGAUGELib.DefaultLayerPropertyEnum.exDefLayerHeight,'width MAX height');
	Layers.Count := 5;
	with Layers.Item[TObject(4)] do
	begin
		OnDrag := EXGAUGELib.OnDragLayerEnum.exDoRotamove;
		DefaultRotateAngle := -142;
	end;
end

Delphi (standard)

with Gauge1 do
begin
	PicturesPath := 'C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob 1';
	PicturesName := '`Layer` + str(value + 1) + `.png`';
	LayerAutoSize := -1;
	DefaultLayer[EXGAUGELib_TLB.exDefLayerWidth] := 'width MAX height';
	DefaultLayer[EXGAUGELib_TLB.exDefLayerHeight] := 'width MAX height';
	Layers.Count := 5;
	with Layers.Item[OleVariant(4)] do
	begin
		OnDrag := EXGAUGELib_TLB.exDoRotamove;
		DefaultRotateAngle := -142;
	end;
end

VFP

with thisform.Gauge1
	.PicturesPath = "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob 1"
	.PicturesName = "`Layer` + str(value + 1) + `.png`"
	.LayerAutoSize = -1
	.Object.DefaultLayer(18) = "width MAX height"
	.Object.DefaultLayer(19) = "width MAX height"
	.Layers.Count = 5
	with .Layers.Item(4)
		.OnDrag = 3
		.DefaultRotateAngle = -142
	endwith
endwith

dBASE Plus

local oGauge,var_Layer

oGauge = form.EXGAUGEACTIVEXCONTROL1.nativeObject
oGauge.PicturesPath = "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob 1"
oGauge.PicturesName = "`Layer` + str(value + 1) + `.png`"
oGauge.LayerAutoSize = -1
oGauge.Template = [DefaultLayer(18) = "width MAX height"] // oGauge.DefaultLayer(18) = "width MAX height"
oGauge.Template = [DefaultLayer(19) = "width MAX height"] // oGauge.DefaultLayer(19) = "width MAX height"
oGauge.Layers.Count = 5
var_Layer = oGauge.Layers.Item(4)
	var_Layer.OnDrag = 3
	var_Layer.DefaultRotateAngle = -142

XBasic (Alpha Five)

Dim oGauge as P
Dim var_Layer as P

oGauge = topparent:CONTROL_ACTIVEX1.activex
oGauge.PicturesPath = "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob 1"
oGauge.PicturesName = "`Layer` + str(value + 1) + `.png`"
oGauge.LayerAutoSize = -1
oGauge.Template = "DefaultLayer(18) = `width MAX height`" // oGauge.DefaultLayer(18) = "width MAX height"
oGauge.Template = "DefaultLayer(19) = `width MAX height`" // oGauge.DefaultLayer(19) = "width MAX height"
oGauge.Layers.Count = 5
var_Layer = oGauge.Layers.Item(4)
	var_Layer.OnDrag = 3
	var_Layer.DefaultRotateAngle = -142

Visual Objects

local var_Layer as ILayer

oDCOCX_Exontrol1:PicturesPath := "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob 1"
oDCOCX_Exontrol1:PicturesName := "`Layer` + str(value + 1) + `.png`"
oDCOCX_Exontrol1:LayerAutoSize := -1
oDCOCX_Exontrol1:[DefaultLayer,exDefLayerWidth] := "width MAX height"
oDCOCX_Exontrol1:[DefaultLayer,exDefLayerHeight] := "width MAX height"
oDCOCX_Exontrol1:Layers:Count := 5
var_Layer := oDCOCX_Exontrol1:Layers:[Item,4]
	var_Layer:OnDrag := exDoRotamove
	var_Layer:DefaultRotateAngle := -142

PowerBuilder

OleObject oGauge,var_Layer

oGauge = ole_1.Object
oGauge.PicturesPath = "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob 1"
oGauge.PicturesName = "`Layer` + str(value + 1) + `.png`"
oGauge.LayerAutoSize = -1
oGauge.DefaultLayer(18,"width MAX height")
oGauge.DefaultLayer(19,"width MAX height")
oGauge.Layers.Count = 5
var_Layer = oGauge.Layers.Item(4)
	var_Layer.OnDrag = 3
	var_Layer.DefaultRotateAngle = -142

Visual DataFlex

Procedure OnCreate
	Forward Send OnCreate
	Set ComPicturesPath to "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob 1"
	Set ComPicturesName to "`Layer` + str(value + 1) + `.png`"
	Set ComLayerAutoSize to -1
	Set ComDefaultLayer OLEexDefLayerWidth to "width MAX height"
	Set ComDefaultLayer OLEexDefLayerHeight to "width MAX height"
	Variant voLayers
	Get ComLayers to voLayers
	Handle hoLayers
	Get Create (RefClass(cComLayers)) to hoLayers
	Set pvComObject of hoLayers to voLayers
		Set ComCount of hoLayers to 5
	Send Destroy to hoLayers
	Variant voLayers1
	Get ComLayers to voLayers1
	Handle hoLayers1
	Get Create (RefClass(cComLayers)) to hoLayers1
	Set pvComObject of hoLayers1 to voLayers1
		Variant voLayer
		Get ComItem of hoLayers1 4 to voLayer
		Handle hoLayer
		Get Create (RefClass(cComLayer)) to hoLayer
		Set pvComObject of hoLayer to voLayer
			Set ComOnDrag of hoLayer to OLEexDoRotamove
			Set ComDefaultRotateAngle of hoLayer to -142
		Send Destroy to hoLayer
	Send Destroy to hoLayers1
End_Procedure

XBase++

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

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

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

	oGauge := XbpActiveXControl():new( oForm:drawingArea )
	oGauge:CLSID  := "Exontrol.Gauge.1" /*{91628F12-393C-44EF-A558-83ED1790AAD3}*/
	oGauge:create(,, {10,60},{610,370} )

		oGauge:PicturesPath := "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob 1"
		oGauge:PicturesName := "`Layer` + str(value + 1) + `.png`"
		oGauge:LayerAutoSize := -1
		oGauge:SetProperty("DefaultLayer",18/*exDefLayerWidth*/,"width MAX height")
		oGauge:SetProperty("DefaultLayer",19/*exDefLayerHeight*/,"width MAX height")
		oGauge:Layers():Count := 5
		oLayer := oGauge:Layers:Item(4)
			oLayer:OnDrag := 3/*exDoRotamove*/
			oLayer:DefaultRotateAngle := -142

	oForm:Show()
	DO WHILE nEvent != xbeP_Quit
		nEvent := AppEvent( @mp1, @mp2, @oXbp )
		oXbp:handleEvent( nEvent, mp1, mp2 )
	ENDDO 
RETURN
Copyright 1999-2017 Exontrol. All rights reserved.