eXGauge - FAQ
Exontrol.COM Software - Frequently Asked Questions - ExGauge Component
1:
The control's release notes can be found on our web site, looking for the Release Notes column in the control's main page. Click here for direct link.
2:
One of the following properties points to some invalid paths:
  • PicturesPath property, specifies the path to load pictures from, so it may point to some invalid folder.
  • PicturesName property, indicates a value that's not a file into the PicturesPath property.
  • Name/Value property of the Background.Picture object, points to some invalid file.

The picture to be loaded by a layer, is determined by these properties, so make sure that all points to valid values.

The following VB sample shows how you can get the full name of the picture to be displayed by a layer, when user clicks the layer:

Private Sub Gauge1_Click()
    Dim l As Long
    l = Gauge1.LayerFromPoint(-1, -1)
    If l >= 0 Then
        With Gauge1
            Debug.Print "Path " & .PicturesPath
            Debug.Print "Name " & .Layers(l).Background.Picture.Name
        End With
    End If
End Sub
3:
"I would like to put the control on a form, then make the form transparent so the control appears on the desktop with just the images contained in the layers visible. For example, take a clock example and make the control background and the form transparent, and you have a working clock widget."

The control support transparent form, or in other words, displaying the control's itself without its form behind. 

 The following screen shot shows the control on a transparent form:

 The following screen shot shows the control on an opaque form:

 

In order to make your eXGauge control to display a widget, ( no form behind or form transparent ), you need to use the following properties:

  • LayerUpdate property of the control, indicates where the control's content is updated. By default, the LayerUpdate property property is exLayerUpdateControl, which indicates that the control's content is shown on the control itself ( no effect ). If the LayerUpdate property is exLayerUpdateScreeen, the entire control is shown individually on the screen, with no form behind.

The setup installs the C:\Program Files\Exontrol\ExGauge\Sample\VB\Widget or C:\Program Files\Exontrol\ExGauge\Sample\VC\Widget that shows all these working.

4:
"I would like to put the control on a form, then make the form transparent so the control appears on the desktop with just the images contained in the layers visible. For example, take a clock example and make the control background and the form transparent, and you have a working clock widget."

The control support transparent form, or in other words, displaying the control's itself without its form behind. 

 The following screen shot shows the control on a transparent form:

 The following screen shot shows the control on an opaque form:

 

In order to make your eXGauge control to display a widget, ( no form behind or form transparent ), you need to use the following properties:

  • LayerClipTo property of the control, specifies the index of the layer that clips the entire control to. By default, the LayerClipTo property is -1, which indicates that no clipping is supported. So, one of the layers that composes your widget must be specified as the widget's background, and so, the entire view of the control is clipped to region defined by the clipping layer (LayerClipTo). The LayerClipTo property may refer to any layer, visible or hidden, which includes a picture or a clipping object ( Clip property ).
  • Layer.LayerClipToAlpha property of the Layer object, returns or sets a value that indicates the value of the alpha channel to be included in the LayerClipTo region. By default, the LayerClipToAlpha property is 0, which indicates that only pixels of the layer that has 0 on the alpha channel (transparent pixels) defines the transparent region, and so the clipping region. In other words, the value from 0 to LayerClipToAlpha defines transparent pixels, and the rest defines the opaque pixels to be included in the clipping region. So based on the layer's picture, you can change the LayerClipToAlpha property for a better look of your widget.
  • LayerClipToParent property of the control, indicates if the LayerClipTo method clips the control itself, parent or the owner of the control. By default, the LayerClipToParent property is exLayerUpdateControl, which indicates that the control's itself is clipped relative to its form that hosts it. Change the LayerClipToParent property to exLayerUpdateScreen, or exLayerUpdateParent, and so the clipping region is applied to its form/dialog/parent window.

The following VB sample defines the control as a widget:

With Gauge1
    .LayerClipTo = 0
    .LayerClipToParent = exLayerUpdateScreen
End With

The sample defines the layer with the Index 0, as being the clipping layer. The setup installs the C:\Program Files\Exontrol\ExGauge\Sample\VB\Clock-Widget-Region that shows all these working.

5:
The following screen shot shows the transparent-control on a form:

In order to make your eXGauge library to display a transparent-control inside your form/dialog/window/child, you need to use the following properties:

  • LayerUpdate property of the control, indicates where the control's content is updated. By default, the LayerUpdate property property is exLayerUpdateControl, which indicates that the control's content is shown on the control itself ( no effect ). If the LayerUpdate property is exLayerUpdateParent, the control does not show its background on the form that hosts it.
  • You need to add <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>, to your manifest file as follows. The transparent-eXGauge as a child of your form, it is supported on Windows 8, and later.
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
    	<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> 
    		<application> 
    			<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
    		</application> 
    	</compatibility>
    </assembly>

The setup installs the  C:\Program Files\Exontrol\ExGauge\Sample\VC\Widget-Child sample that shows all these working.

6:
The control provides the AllowMoveOnClick property that allows using the form, once the user clicks a non-drag able object on the layers.

The trick is sending the WM_NCLBUTTONDOWN message to the form/dialog/window that hosts the control, when the MouseDown event of the control occurs.

In VB, you need to use a snippet of code as follows:

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Private Sub Gauge1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    SendMessage Me.hwnd, &HA1, 2, 0
End Sub

In C++, you can call:

::SendMessage( m_hWnd, WM_NCLBUTTONDOWN, HTCAPTION, NULL );

, when control's MouseDown event occurs, where the m_hWnd, is the handle of the dialog that hosts the eXGauge control, WM_NCLBUTTONDOWN is defined as 0x00A1, and the HTCAPTION as 2.

7:
You can use directly the SetLayeredWindowAttributes API function, or you can use the eXTransparent component:

In VB, you can use a code like follows:

Private Declare Function SetLayeredWindowAttributes Lib "user32.dll" (ByVal hwnd As Long, ByVal
crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Boolean  
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long,
ByVal nIndex As Long, ByVal dwNewLong As Long) As Long  
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long,
ByVal nIndex As Long) As Long  
Const LWA_ALPHA = 2  
Const GWL_EXSTYLE = (-20)  
Const WS_EX_LAYERED = &H80000  

Private Sub Form_Load()  
    SetWindowLong hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED  
    SetLayeredWindowAttributes hwnd, 0, 128, LWA_ALPHA  
End Sub  
8:
The most probably you get:

error BC31143: Method 'Private Sub Exgauge1_DragStart(sender As Object, DragInfo As wpf.exontrol.EXGAUGELib.DragInfo, Cancel As Boolean)' does not have a signature compatible with delegate 'Delegate Sub DragStartHandler(sender As Object, DragInfo As wpf.exontrol.EXGAUGELib.DragInfo, ByRef Cancel As Boolean)' 

when trying to add a handler for DragStart event of the control.

When adding a new event handler for the DragStart event, the Microsoft Visual Studio generates:

Private Sub Exgauge1_DragStart(ByVal sender As System.Object, ByVal DragInfo As wpf.exontrol.EXGAUGELib.DragInfo, ByVal Cancel As System.Boolean)
End Sub

while the correct syntax is:

Private Sub Exgauge1_DragStart(ByVal sender As System.Object, ByVal DragInfo As wpf.exontrol.EXGAUGELib.DragInfo, ByRef Cancel As System.Boolean)
End Sub

Replace the ByVal of Cancel parameter with the ByRef, and your event will compile just fine.

See Also: 'No overload for matches delegate ' compiler error

9:
For instance, having the files Layer1.png, Layer2.png, Layer3.png, Layer4.png and Layer5.png in the C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob 2 folder:

We can load them using the PicturesPath / PicturesName property and we get something like:

 

or if we decompose them, layer by layer we get:

 

The following properties can be used to load / import ( manually or automatically ) pictures to the layer's background:

  • PicturesPath property, specifies the path to load pictures from.
  • PicturesName property, specifies the expression that defines the name of the file from the PicturesPath folder to be loaded.
  • Picture.Name / Picture.Value property of the Background.Picture object, defines the name of the file to be loaded ( relative, absolute, encoded or Picture object )

The PicturesPath /  PicturesName properties can be used to automatically loads files from a specified folder to be displayed on the layer's background.  

For instance, 

PicturesPath = "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob", defines default folder to load pictures from.
PicturesName = "`Layer` + str(value + 1) + `.png`", defines the name of the picture file to be loaded by the layer with the index / value. It defines the names as: Layer1.png for the layer with the index 0, Layer2.png for the layer with the index 1, Layer3.png for the layer with the index 2, and so on.

The Picture.Name / Picture.Value property of the Picture object loads a picture / graphics to be displayed on the layer's background. 

The Name / Value property could be one of the following:

  • A String expression indicates:
    • a name of a picture file in the PicturePath folder. For instance, Name = "Layer1.png", loads the Layer1.png file if found in the PicturePath folder.
    • a picture file including its absolute path. For instance, Name = "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob\Layer1.png", loads the Layer1.png file from absolute path
    • a key of the HTML picture, previously loaded by the HTMLPicture method. For instance, Name = "pic1", loads the HTML picture with the key pic1, so the pic1 should be load previously with a HTMLPicture call like HTMLPicture("pic1") = "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob\Layer1.png"
    • an encode BASE64 string of a picture file. The Exontrol's ExImages Tool encode/decode BASE64 strings from/to pictures. In this case, the string starts with "gB..", "gC.." and so on.
  • A Picture object that indicates the picture to be displayed. For instance, Name = LoadPicture("picture.jpg")
How-To Questions
General Questions