64 |
ImageSize property on 32 (specifies the size of the control' icons)
|
63 |
ImageSize property on 16 (default) (specifies the size of the control' icons)
|
62 |
I found that the control's needle/knob is too small to touch, is it possible somehow to make it working
|
61 |
How can I rotate/move multiple layers once the user drags the layer
|
60 |
How can I show a layer as disabled
#include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oLayer,oLayer1,oLayer2 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:BeginUpdate() oGauge:PicturesPath := "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob 1" oLayer := oGauge:Layers():Add("original") oLayer:OnDrag := 1/*exDoMove*/ oLayer:Background():Picture():Name := "Layer2.png" oLayer:DefaultOffsetY := -164 oLayer:Grayscale := 0 oLayer1 := oGauge:Layers():Add("grayscale 50%") oLayer1:Background():Picture():Name := "Layer2.png" oLayer1:Grayscale := 50 oLayer1:DefaultOffsetY := -82 oLayer2 := oGauge:Layers():Add("grayscale 100%") oLayer2:Background():Picture():Name := "Layer2.png" oLayer2:Grayscale := 100 oGauge:EndUpdate() oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
59 |
Is it possible to stretch all layers
|
58 |
Tic Tac Toe Game
PROCEDURE OnMouseDown(oGauge,Button,Shift,X,Y) /*Left = Me.Layers(l).Left*/ /*Top = Me.Layers(l).Top*/ /*Width = Me.Layers(l).Width*/ /*Height = Me.Layers(l).Height*/ LOCAL oPicture LOCAL oLayer LOCAL oLayers LOCAL l l := oGauge:LayerFromPoint(-1,-1) oLayers := oGauge:Layers() oLayer := oLayers:Add(oGauge:Layers():Count()) oPicture := oLayer:Background():Picture() oPicture:Left := "8" oPicture:Width := "width - 2 * 8" oPicture:Top := "8" oPicture:Height := "height - 2 * 8" oPicture:Name := oGauge:FormatABC("A mod 2 = 0 ? `x` : `o`",oGauge:Layers():Count()) oLayer:Transparency := 0 RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oLayer,oLayer1,oLayer2,oLayer3,oLayer4,oLayer5,oLayer6,oLayer7,oLayer8 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:MouseDown := {|Button,Shift,X,Y| OnMouseDown(oGauge,Button,Shift,X,Y)} /*Occurs when the user presses a mouse button.*/ oGauge:BeginUpdate() oGauge:VisualAppearance():Add(1,"gBFLBCJwBAEHhEJAAEhABS0IQAAYAQGKIYBkAKBQAGaAoDDcMQ5QwAAyDGKEEwsACEIrjKCRShyCYZRhGcTALD8EhhECTZKkAZAEiWIovRbHMBzFIMYRFFCcIRGSaYDiCNovTRNE7TfBMIhkGoSaKpCIRVDCSYJUzTc6wS79KgAASiJjjao6ZhaSpSABRYiyXRlHSxLiuYyoGTrJACEQxDhEEIjGLAazLMadJItCzabqGbJ8Ro6cQwTAIgI=") oGauge:SetProperty("DefaultLayer",18/*exDefLayerWidth*/,"width/3") oGauge:SetProperty("DefaultLayer",19/*exDefLayerHeight*/,"height/3") oGauge:SetProperty("HTMLPicture","x","C:\Program Files\Exontrol\ExGauge\Sample\Design\Pictures\x.png") oGauge:SetProperty("HTMLPicture","o","C:\Program Files\Exontrol\ExGauge\Sample\Design\Pictures\o.png") oGauge:LayerAutoSize := -1 oGauge:Layers():Count := 9 oLayer := oGauge:Layers:Item(0) oLayer:Background():Color():SetProperty("Value",0x1000000) oLayer1 := oGauge:Layers:Item(1) oLayer1:Left := " width/3 - 4" oLayer1:Background():Color():SetProperty("Value",0x1000000) oLayer2 := oGauge:Layers:Item(2) oLayer2:Left := "2 * (width/3 - 4) - 4" oLayer2:Background():Color():SetProperty("Value",0x1000000) oLayer3 := oGauge:Layers:Item(3) oLayer3:Top := "height/3 - 4" oLayer3:Background():Color():SetProperty("Value",0x1000000) oLayer4 := oGauge:Layers:Item(4) oLayer4:Top := "height/3 - 4" oLayer4:Left := " width/3 - 4" oLayer4:Background():Color():SetProperty("Value",0x1000000) oLayer5 := oGauge:Layers:Item(5) oLayer5:Top := "height/3 - 4" oLayer5:Left := "2 * (width/3 - 4) - 4" oLayer5:Background():Color():SetProperty("Value",0x1000000) oLayer6 := oGauge:Layers:Item(6) oLayer6:Top := "2 * (height/3 - 4) " oLayer6:Background():Color():SetProperty("Value",0x1000000) oLayer7 := oGauge:Layers:Item(7) oLayer7:Top := "2 * (height/3 - 4) " oLayer7:Left := " width/3 - 4" oLayer7:Background():Color():SetProperty("Value",0x1000000) oLayer8 := oGauge:Layers:Item(8) oLayer8:Top := "2 * (height/3 - 4) " oLayer8:Left := "2 * (width/3 - 4) - 4" oLayer8:Background():Color():SetProperty("Value",0x1000000) oGauge:SetProperty("DefaultLayer",22/*exDefLayerTransparency*/,99) oGauge:EndUpdate() oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
57 |
What's the difference Rotate vs Rotamove
PROCEDURE OnDragStart(oGauge,DragInfo,Cancel) /*DragInfo.Debug = 227*/ RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oForeground,oForeground1 LOCAL oPicture,oPicture1 LOCAL oLayer,oLayer1,oLayer2 LOCAL oLayers 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:DragStart := {|DragInfo,Cancel| OnDragStart(oGauge,DragInfo,Cancel)} /*Occurs once the user starts dragging a layer.*/ oGauge:AllowSmoothChange := 0/*exSmoothChangeless*/ oGauge:PicturesPath := "C:\Program Files\Exontrol\ExGauge\Sample\Design\Linear\Button with LEDs" oLayers := oGauge:Layers() oLayer := oLayers:Add("base") oLayer1 := oLayers:Add("rotate") oLayer1:ToolTip := Transform(oLayer1:Key(),"") oPicture := oLayer1:Background():Picture() oPicture:Name := "Example Button Up.png" oPicture:Left := "width/2" oPicture:Top := "height/2" oPicture:Width := Transform(128,"") oPicture:Height := Transform(64,"") oForeground := oLayer1:Foreground() oForeground:SetProperty("Caption",0/*exLayerCaption*/,"<font ;14><sha ;;0>Rotate") oForeground:SetProperty("Caption",4/*exLayerCaptionLeft*/,"width/2 + 32") oForeground:SetProperty("Caption",5/*exLayerCaptionTop*/,"height/2 + 16") oLayer1:SetProperty("Brightness",1/*exRedChannel*/,100) oLayer1:OnDrag := 2/*exDoRotate*/ oLayer1:RotateAngle := 45 oLayer2 := oLayers:Add("rotamove") oLayer2:ToolTip := Transform(oLayer2:Key(),"") oPicture1 := oLayer2:Background():Picture() oPicture1:Name := "Example Button Up.png" oPicture1:Left := "width/2" oPicture1:Top := "height/2" oPicture1:Width := Transform(128,"") oPicture1:Height := Transform(64,"") oForeground1 := oLayer2:Foreground() oForeground1:SetProperty("Caption",0/*exLayerCaption*/,"<font ;14><sha ;;0>Rotamove") oForeground1:SetProperty("Caption",4/*exLayerCaptionLeft*/,"width/2 + 24") oForeground1:SetProperty("Caption",5/*exLayerCaptionTop*/,"height/2 + 16") oLayer2:SetProperty("Brightness",2/*exGreenChannel*/,100) oLayer2:RotateAngle := 45 oLayer2:Transparency := 25 oLayer2:OnDrag := 3/*exDoRotamove*/ oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
56 |
How do I display a tooltip, when cursor hovers the layer
PROCEDURE OnMouseIn(oGauge,Layer) oGauge:Layers:Item(9):ToolTip := Transform(oGauge:FormatABC("`The current value is: <br><c><b>` + ((100 - A) format ``)",oGauge:Value()),"") RETURN #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:MouseIn := {|Layer| OnMouseIn(oGauge,Layer)} /*Notifies that the cursor enters the layer.*/ oGauge:BeginUpdate() oGauge:PicturesPath := "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob" oGauge:PicturesName := "`Layer` + str(value + 1) + `.png`" oGauge:Layers():Count := 10 oLayer := oGauge:Layers:Item(9) oLayer:DefaultRotateAngle := -126 oLayer:OnDrag := 3/*exDoRotamove*/ oLayer:RotateAngleToValue := "100 - value / 360 * 100" oLayer:ValueToRotateAngle := "(value)/100 * 360" oGauge:Layers:Item(3):Visible := .F. oGauge:Layers:Item(4):Visible := .F. oGauge:Layers:Item(9):Value := 25 oGauge:EndUpdate() oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
55 |
I've noticed that the OnDrag can move the layer itself, but how about moving the clipping region
PROCEDURE OnDrag(oGauge,DragInfo) /*Layers(DragInfo.Layer).Clip.Ellipse*/ RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oClipEllipse 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:Drag := {|DragInfo| OnDrag(oGauge,DragInfo)} /*Notifies that the user drags the layer.*/ oGauge:BeginUpdate() oGauge:SetProperty("BackColor",AutomationTranslateColor( GraMakeRGBColor ( { 217,217,217 } ) , .F. )) oGauge:PicturesPath := "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Guage" oLayer := oGauge:Layers():Add("background") oLayer:Background():Picture():Name := "Guage_Background.png" oClipEllipse := oLayer:Clip():Ellipse() oClipEllipse:RadiusX := "width/3" oClipEllipse:RadiusY := "height/3" oGauge:Layers():Add("needle"):Background():Picture():Name := "Guage_Needle.png" oGauge:EndUpdate() oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
54 |
How do I show a portion of layer with a different color (sample 2)
PROCEDURE OnChange(oGauge,Layer) LOCAL oLayer oGauge:Layers:Item("Color"):Clip():Value := oGauge:Layers:Item("Thumb"):RotateAngle() oLayer := oGauge:Layers:Item("Color") oLayer:SetProperty("Brightness",3/*exBlueChannel*/,oLayer:RotateAngle()) oGauge:Layers:Item("Thumb"):SetProperty("Brightness",3/*exBlueChannel*/,oGauge:Layers:Item("Color"):RotateAngle()) RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oClipEllipse LOCAL oLayer,oLayer1 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:Change := {|Layer| OnChange(oGauge,Layer)} /*Occurs when the layer's value is changed.*/ oGauge:BeginUpdate() oGauge:PicturesPath := "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob 1" oGauge:PicturesName := "`Layer` + int(value + 1) + `.png`" oGauge:Layers():Count := 5 oGauge:Layers:Item(1):Visible := .F. oLayer := oGauge:Layers:Item(4) oLayer:Key := "Thumb" oLayer:DefaultRotateAngle := -141 oLayer:OnDrag := 2/*exDoRotate*/ oLayer:RotateType := 2/*exRotateBilinearInterpolation*/ oLayer:SetProperty("Brightness",0/*exAllChannels*/,0) oLayer:SetProperty("Brightness",1/*exRedChannel*/,100) oLayer1 := oGauge:Layers():Add("Color") oLayer1:OnDrag := 2/*exDoRotate*/ oLayer1:Position := 3 oLayer1:SetProperty("Brightness",0/*exAllChannels*/,0) oLayer1:SetProperty("Brightness",1/*exRedChannel*/,100) oLayer1:Background():Picture():Name := "Layer3.png" oLayer1:Clip():Pie():SweepAngle := "value" oClipEllipse := oLayer1:Clip():Ellipse() oClipEllipse:RadiusX := "150" oClipEllipse:RadiusY := "150" oClipEllipse:InverseClip := .T. oGauge:Layers:Item("Thumb"):RotateAngle := 135 oGauge:EndUpdate() oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
53 |
How do I show a portion of layer with a different color (sample 1)
PROCEDURE OnChange(oGauge,Layer) LOCAL oLayer oGauge:Layers:Item("Color"):Clip():Value := oGauge:Layers:Item("Thumb"):RotateAngle() oLayer := oGauge:Layers:Item("Color") oLayer:SetProperty("Brightness",3/*exBlueChannel*/,oLayer:RotateAngle()) oGauge:Layers:Item("Thumb"):SetProperty("Brightness",3/*exBlueChannel*/,oGauge:Layers:Item("Color"):RotateAngle()) RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oLayer,oLayer1 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:Change := {|Layer| OnChange(oGauge,Layer)} /*Occurs when the layer's value is changed.*/ oGauge:BeginUpdate() oGauge:PicturesPath := "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob 1" oGauge:PicturesName := "`Layer` + int(value + 1) + `.png`" oGauge:Layers():Count := 5 oGauge:Layers:Item(1):Visible := .F. oLayer := oGauge:Layers:Item(4) oLayer:Key := "Thumb" oLayer:DefaultRotateAngle := -141 oLayer:OnDrag := 2/*exDoRotate*/ oLayer:RotateType := 2/*exRotateBilinearInterpolation*/ oLayer:SetProperty("Brightness",0/*exAllChannels*/,0) oLayer:SetProperty("Brightness",2/*exGreenChannel*/,100) oLayer1 := oGauge:Layers():Add("Color") oLayer1:OnDrag := 2/*exDoRotate*/ oLayer1:Position := 3 oLayer1:SetProperty("Brightness",0/*exAllChannels*/,0) oLayer1:SetProperty("Brightness",2/*exGreenChannel*/,100) oLayer1:Background():Picture():Name := "Layer3.png" oLayer1:Clip():Pie():SweepAngle := "value" oGauge:Layers:Item("Thumb"):RotateAngle := 135 oGauge:EndUpdate() oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
52 |
How can I display / clip a picture with no transparency
#include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oClipPicture LOCAL oLayer,oLayer1 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:BeginUpdate() oGauge:PicturesPath := "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob 1" oLayer := oGauge:Layers():Add("default") oLayer:OnDrag := 1/*exDoMove*/ oLayer:Background():Picture():Name := "Layer2.png" oLayer:DefaultOffsetY := -164 oLayer1 := oGauge:Layers():Add("notransparency") oLayer1:OnDrag := 1/*exDoMove*/ oLayer1:Background():Picture():Name := "Layer2.png" oClipPicture := oLayer1:Clip():Picture() oClipPicture:Name := oGauge:Layers:Item("notransparency"):Background():Picture():Name() oClipPicture:AlphaTo := "128" oLayer1:Grayscale := 100 oGauge:EndUpdate() oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
51 |
How can I resize all layers
#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:BeginUpdate() oGauge:PicturesPath := "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob 2" oGauge:PicturesName := "`Layer` + int(value + 1) + `.png`" oGauge:Layers():Count := 5 oLayer := oGauge:Layers():Add("autosize") oLayer:Visible := .F. oLayer:Width := Transform(164,"") oLayer:Height := Transform(128,"") oGauge:LayerAutoSize := oGauge:Layers:Item("autosize"):Index() oGauge:EndUpdate() oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
50 |
How can I start moving any layer when user clicks it
|
49 |
How can I prevent dragging the layers when user right click it
|
48 |
Is your control DPI-Aware
#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" oGauge:PicturesName := "`Layer` + str(value + 1) + `.png`" oGauge:SetProperty("DefaultLayer",185/*exDefLayerRotateType*/,2) oGauge:Layers():Count := 11 oGauge:Layers:Item(3):Grayscale := 100 oGauge:Layers:Item(4):Grayscale := 100 oLayer := oGauge:Layers:Item(10) oLayer:Width := "128 * dpix" oLayer:Height := "128 * dpiy" oGauge:Layers:Item(9):OnDrag := 2/*exDoRotate*/ oGauge:LayerAutoSize := 10 oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
47 |
Is it possible to make the control transparent, 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
|
46 |
How can I show the layers on perspective
|
45 |
Is it possible to resize all layers after they are loaded (method 2)
#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" oGauge:PicturesName := "`Layer` + str(value + 1) + `.png`" oGauge:SetProperty("DefaultLayer",185/*exDefLayerRotateType*/,2) oGauge:Layers():Count := 11 oGauge:Layers:Item(3):Grayscale := 100 oGauge:Layers:Item(4):Grayscale := 100 oGauge:Layers:Item(9):OnDrag := 2/*exDoRotate*/ oLayer := oGauge:Layers:Item(10) oLayer:Width := Transform(128,"") oLayer:Height := Transform(128,"") oGauge:LayerAutoSize := 10 oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
44 |
Is it possible to resize all layers after they are loaded (method 1)
|
43 |
Is it possible to load images for different layers from different folders
#include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oPicture 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" oGauge:PicturesName := "`Layer` + str(value + 1) + `.png`" oGauge:Layers():Count := 12 oGauge:Layers:Item(0):Background():Picture():Name := "\..\Clock\vista_clock.png" oGauge:Layers:Item(9):Background():Picture():Name := "\..\Knob 2\Layer3.png" oGauge:Layers:Item(10):Background():Picture():Name := "C:\Program Files\Exontrol\ExGauge\Sample\Design\Led\Speed\noBack.png" oLayer := oGauge:Layers:Item(11) oLayer:DefaultOffsetX := 64 oLayer:DefaultOffsetY := -36 oPicture := oLayer:Background():Picture() oPicture:Name := "gCJKBOI4NBQaBQAhQNJJIIhShQAEEREAIA0ROZ6PT0hQEX5JIhBKhYQrFSxNNhUKoUY7/c6+R6+a7pPg0UAjaISTQwCzMEgtWQ2IyDBJJMYiNJCJgTVJuMghNTcSgFAxlNZiMinYKNRQ2NxMBhWNQkSRUAQkRRNEhYEBhMogMADOwGfY6N7eXb3DgXeamZgMGbQIStE55RZ7c7ce7/XpzZycOaBf7ZNAlZwiGQIMAnQBnAL4ACKAACABXADMAY4BLgHYiXS6VQAESyDbAHYAGwvea9E4BXhPIgXD4KQCZD4FeAJzqWFLcNQf1KkSgyFYGMDmVoAEwAHjxQDiOo7AbgKqlaj8WQBRgxDYBfmabpDRTXdumF5ZSwVboXIBrToAhgBIwHWFREvoNZtlsb42G6Kg2g4b59AeYgAnAMpWnqBZWk2JoIkQcY8AGQAvgAPBWkcScUnceh6FoLYWAsepsGwLBsCcMIMh8C4AHYOAODOVIUHaYwviKMgvh2eIxmO" +; "RxcnHJ5MjYExBlmM5nBAVgqGodY9nuFxXGoA5al8WIJmAe5OgAIxtD6bJUimU5uC4GxFiOaxXkOc59lwOh0kkFYREWFZ6iSdhiiMQBSg0VArFWAZ0CgepijEKJdlcBZnnuaJ2n2PBZCgaAHnESZsHmRpFlKBBECQY5hA2DoOgaYYYCoC4zjObpAkCAJ+mVGgQBEFZ7CSVgbgYYYGk8c4ugODRFFgKRUnYAZ4C8E5ECqWwOl8d5/gcGgjmALQRjiUBQmg9oVDWBAIFoAZ8DmBoAlcWoBlwWAjHEK5pnSehpDALR9A2U1+FWAB3B2X4rmCJwaBcLQNmiG4AG8do6FkLRWjEOw7GsEwRBQUogCIEBRH0LJEAQeR8h4c55jyXwDmAK9TlMLIoBcS4pgAZwBGwaB3FIGIDBHopsmWS4Xh2HpUgoPhvkOcYcWANBWiCIh5GicJhnKUOvCcJp0CIGxNg6doEIUUopHSGoAA+OhhFeKgVBoGIYnCfo7HcTgdhuG4" +; "zkWBB68GdJmkKQQPcSVx6Hue47l0foMAAZ5yjkXJTBoW5ekgSglFKZ4AAYO5BDwIAdkgZZykcWg3G8OoPlgNpDicT4fH6AwZk+M4zDEMwZGMVB9GGZgqGeO51kmfAbnyGQZjSVofmeepzB8Nojmqah+gQEAzCsKfvgoI5oniYOvCCZaghiWfeiWNY2mOOJ2CMKJyDUVpOhwR38EcDpWlq/4Ox6xLAxCMIkRAShQCoC4C4D42RaCpH+BAGY1wDiDFoGgbwFQIjbHuH0Y48x+BUCeE8O47h0DRBeN8FwFAFC7ESMgJ4AAOARFyCsOQSgIhbEsK0FoywZC2DaOsFAig3DOGYMwPguAzjPE8G8QZFT1ghEA5IG4QhaHIB4M8JragUitDqK5jIrhvj2HoLYU49hHjvA+NsWQZRligHWLoDwRAkAaGcBICIExIshBwAgQQ8ojjMCeAcB4Hh8DiGMI0X4rhiixEyNcLQBwRASAEIgKAKxjB7CMEAfIfhbjrB0E4" +; "JQGxOgWEiF4CIzhFjgDi+gfQdh2jaBqLQPo+x7CNHSEwYwfwWCfHeA5WYXgsBYAQG4bougag/B6P0eYHwpg/A4D8F4pBXArGQJwRI9RviGHyDYQARQAAVAAPoTwAACCQGoCADgrxljzF0KwVwbgDBnGIJIDgGxnCxHgDoGInAxhmC+O4agjwUCQBMEIVAiA3ALCiMkRAKgAhcGsHEKgTg3BFikGoEQ3hqCkE0DsMILQbgCGADgVwGwsiOCKCYGQBBAgREiKoRABIkATGYK4AAThJAGBCEACYEAEhRGKBAFoCAmBgEYAkSQCQthtEuPsWwAAkgUCIAARzUgnD3HoHAS46xMDFWgDUbQLAlDMgiKsFwIw2AzGwEoUQJXQjXCIGIAwQhUh9DiJQBAxwQAwFID0IA2wjCkCQBEBYUw3g2AWMsKwNAvgqFWLQJIOwbAcBOEIMgLwxDRGkNACw7gAAwDUPkRokwYBrCKKQLo1xKhIDWGEMYOhnCGD+AETIaBOC" +; "ABEEYVY0yI1SCKE4IgrghBgEEQEA=" oPicture:Width := Transform(64,"") oPicture:Height := Transform(64,"") oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
42 |
How can I specify whether an object can be selected or not
PROCEDURE OnMouseMove(oGauge,Button,Shift,X,Y) DevOut( Transform(oGauge:LayerFromPoint(-1,-1),"") ) RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oForeground,oForeground1 LOCAL oPicture,oPicture1 LOCAL oLayer,oLayer1 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:MouseMove := {|Button,Shift,X,Y| OnMouseMove(oGauge,Button,Shift,X,Y)} /*Occurs when the user moves the mouse.*/ oGauge:BeginUpdate() oGauge:PicturesPath := "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob" oGauge:PicturesName := "`Layer` + str(value + 1) + `.png`" oGauge:Layers():Count := 12 oLayer := oGauge:Layers:Item(10) oLayer:RotateType := 2/*exRotateBilinearInterpolation*/ oLayer:OnDrag := 2/*exDoRotate*/ oPicture := oLayer:Background():ExtraPicture("extra1") oPicture:Name := "Layer1.png" oPicture:Left := "32" oPicture:Top := "32" oPicture:Width := Transform(64,"") oPicture:Height := Transform(64,"") oForeground := oLayer:Foreground() oForeground:SetProperty("Caption",0/*exLayerCaption*/,"<sha ;;0>selectable") oForeground:SetProperty("Caption",4/*exLayerCaptionLeft*/,38) oForeground:SetProperty("Caption",5/*exLayerCaptionTop*/,-5) oLayer1 := oGauge:Layers:Item(11) oPicture1 := oLayer1:Background():ExtraPicture("extra2") oPicture1:Name := "Layer1.png" oPicture1:Left := "width-64" oPicture1:Top := "height-84 - 32" oPicture1:Width := Transform(64,"") oPicture1:Height := Transform(64,"") oPicture1:Selectable := .F. oLayer1:SetProperty("Brightness",0/*exAllChannels*/,25) oForeground1 := oLayer1:Foreground() oForeground1:SetProperty("Caption",0/*exLayerCaption*/,"<sha ;;0>not selectable") oForeground1:SetProperty("Caption",3/*exLayerCaptionAnchor*/,8) oForeground1:SetProperty("Caption",5/*exLayerCaptionTop*/,"height-theight/4") oGauge:EndUpdate() oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
41 |
How do I get the layer/object/picture from the cursor
PROCEDURE OnMouseMove(oGauge,Button,Shift,X,Y) DevOut( Transform(oGauge:LayerFromPoint(-1,-1),"") ) RETURN #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:MouseMove := {|Button,Shift,X,Y| OnMouseMove(oGauge,Button,Shift,X,Y)} /*Occurs when the user moves the mouse.*/ oGauge:PicturesPath := "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob" oGauge:PicturesName := "`Layer` + str(value + 1) + `.png`" oGauge:Layers():Count := 10 oLayer := oGauge:Layers:Item(9) oLayer:RotateType := 2/*exRotateBilinearInterpolation*/ oLayer:OnDrag := 2/*exDoRotate*/ oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
40 |
How can I display a speedometer
PROCEDURE OnChange(oGauge,Layer) oGauge:Layers:Item("arc"):Clip():Value := oGauge:Value() oGauge:Layers:Item("noDigit"):Background():ExtraPicture("80"):Name := oGauge:FormatABC("`no` + int((value MIN 0 MAX 99)/10) + `.png`",oGauge:Value()) oGauge:Layers:Item("noDigit"):Background():ExtraPicture("08"):Name := oGauge:FormatABC("`no` + int((value MIN 0 MAX 99) mod 10) + `.png`",oGauge:Value()) RETURN PROCEDURE OnMouseWheel(oGauge,Delta) oGauge:Value := oGauge:FormatABC("value + B",oGauge:Value(),Delta) RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oClipPie,oClipPie1 LOCAL oPicture,oPicture1,oPicture2,oPicture3 LOCAL oLayer,oLayer1,oLayer2,oLayer3,oLayer4,oLayer5 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:Change := {|Layer| OnChange(oGauge,Layer)} /*Occurs when the layer's value is changed.*/ oGauge:MouseWheel := {|Delta| OnMouseWheel(oGauge,Delta)} /*Occurs when the mouse wheel moves while the control has focus*/ oGauge:BeginUpdate() oGauge:SetProperty("BackColor",AutomationTranslateColor( GraMakeRGBColor ( { 40,40,40 } ) , .F. )) oGauge:AllowSmoothChange := 0/*exSmoothChangeless*/ oGauge:PicturesPath := "C:\Program Files\Exontrol\ExGauge\Sample\Design\Led\Speed" oGauge:Layers():Count := 6 oLayer := oGauge:Layers:Item(0) oLayer:Key := "arcBack" oLayer:Background():Picture():Name := "noArcBack.png" oClipPie := oLayer:Clip():Pie() oClipPie:StartAngle := Transform(240,"") oClipPie:SweepAngle := Transform(240,"") oLayer1 := oGauge:Layers:Item(1) oLayer1:Key := "arc" oLayer1:Background():Picture():Name := "noArc.png" oClipPie1 := oLayer1:Clip():Pie() oClipPie1:StartAngle := Transform(240,"") oClipPie1:SweepAngle := "value/100 * 240" oLayer2 := oGauge:Layers:Item(2) oLayer2:RotateType := 2/*exRotateBilinearInterpolation*/ oLayer2:Key := "pointer" oLayer2:Background():Picture():Name := "noLine.png" oLayer2:DefaultRotateAngle := 240 oLayer2:RotateAngleToValue := "value/240 * 100" oLayer2:ValueToRotateAngle := "value / 100 * 240" oLayer2:RotateAngleValid := "value > 240 ? (value > 300 ? 0 : 240) : value" oLayer2:OnDrag := 2/*exDoRotate*/ oLayer3 := oGauge:Layers:Item(3) oLayer3:Key := "noBack" oLayer3:Left := "(width - 55 * 2)/2" oLayer3:Top := "(height - 94 * 1)/2" oLayer3:Width := "2 * 45 + 8" oLayer3:Height := "1 * 94" oLayer3:Transparency := 90 oPicture := oLayer3:Background():ExtraPicture("80") oPicture:Name := "noBack.png" oPicture:Left := "-4" oPicture:Width := "70" oPicture1 := oLayer3:Background():ExtraPicture("08") oPicture1:Name := "noBack.png" oPicture1:Left := "36" oPicture1:Width := Transform(70,"") oLayer4 := oGauge:Layers:Item(4) oLayer4:Key := "noDigit" oLayer4:Left := "(width - 55 * 2)/2" oLayer4:Top := "(height - 94 * 1)/2" oLayer4:Width := "2 * 45 + 8" oLayer4:Height := "1 * 94" oPicture2 := oLayer4:Background():ExtraPicture("80") oPicture2:Name := "no1.png" oPicture2:Left := "-4" oPicture2:Width := "70" oPicture3 := oLayer4:Background():ExtraPicture("08") oPicture3:Name := "no2.png" oPicture3:Left := "36" oPicture3:Width := Transform(70,"") oLayer5 := oGauge:Layers:Item(5) oLayer5:Key := "noCap" oLayer5:Background():Picture():Name := "noCap.png" oLayer5:Transparency := 45 oGauge:Layers:Item("pointer"):Position := oGauge:Layers:Item("noCap"):Position() oGauge:LayerOfValue := oGauge:Layers:Item("pointer"):Index() oGauge:Value := 56 oGauge:EndUpdate() oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
39 |
How can I display LED-numbers
PROCEDURE OnChange(oGauge,Layer) oGauge:Value := oGauge:FormatABC("value MIN 0 MAX 99",:Value()) oGauge:Layers:Item("noDigit"):Background():ExtraPicture("80"):Name := oGauge:FormatABC("`no` + int((value MIN 0 MAX 99)/10) + `.png`",oGauge:Value()) oGauge:Layers:Item("noDigit"):Background():ExtraPicture("08"):Name := oGauge:FormatABC("`no` + int((value MIN 0 MAX 99) mod 10) + `.png`",oGauge:Value()) RETURN PROCEDURE OnMouseWheel(oGauge,Delta) oGauge:Value := oGauge:FormatABC("value + B",oGauge:Layers:Item("noDigit"):Value(),Delta) RETURN PROCEDURE OnTimer(oGauge,TickCount) oGauge:Value := oGauge:FormatABC("value = 99 ? 0 : ( value + B )",oGauge:Value(),1) RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oPicture,oPicture1,oPicture2,oPicture3 LOCAL oLayer,oLayer1 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:Change := {|Layer| OnChange(oGauge,Layer)} /*Occurs when the layer's value is changed.*/ oGauge:MouseWheel := {|Delta| OnMouseWheel(oGauge,Delta)} /*Occurs when the mouse wheel moves while the control has focus*/ oGauge:Timer := {|TickCount| OnTimer(oGauge,TickCount)} /*Occurs when the interval elapses.*/ oGauge:BeginUpdate() oGauge:AllowSmoothChange := 0/*exSmoothChangeless*/ oGauge:PicturesPath := "C:\Program Files\Exontrol\ExGauge\Sample\Design\Led\Speed" oGauge:Layers():Count := 3 oLayer := oGauge:Layers:Item(1) oLayer:Key := "noBack" oLayer:Left := "(width - 55 * 2)/2" oLayer:Top := "(height - 94 * 1)/2" oLayer:Width := "2 * 45 + 8" oLayer:Height := "1 * 94" oLayer:Transparency := 90 oPicture := oLayer:Background():ExtraPicture("80") oPicture:Name := "noBack.png" oPicture:Left := "-4" oPicture:Width := "70" oPicture1 := oLayer:Background():ExtraPicture("08") oPicture1:Name := "noBack.png" oPicture1:Left := "36" oPicture1:Width := Transform(70,"") oLayer1 := oGauge:Layers:Item(2) oLayer1:Key := "noDigit" oLayer1:Left := "(width - 55 * 2)/2" oLayer1:Top := "(height - 94 * 1)/2" oLayer1:Width := "2 * 45 + 8" oLayer1:Height := "1 * 94" oPicture2 := oLayer1:Background():ExtraPicture("80") oPicture2:Name := "no1.png" oPicture2:Left := "-4" oPicture2:Width := "70" oPicture3 := oLayer1:Background():ExtraPicture("08") oPicture3:Name := "no2.png" oPicture3:Left := "36" oPicture3:Width := Transform(70,"") oGauge:LayerOfValue := oGauge:Layers:Item("noDigit"):Index() oGauge:Value := 73 oGauge:TimerInterval := 100 oGauge:EndUpdate() oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
38 |
How can I display a simple knob, to fit the control's client area
|
37 |
How can I display a switch
PROCEDURE OnClick(oGauge) oGauge:Value := oGauge:FormatABC("(value + 1) mod 2",:Value()) RETURN PROCEDURE OnDragEnd(oGauge,DragInfo,Cancel) oGauge:Value := oGauge:FormatABC("(value < 24 ? 0 : 1)",oGauge:Layers:Item("knob"):OffsetX()) RETURN PROCEDURE OnDragStart(oGauge,DragInfo,Cancel) RETURN PROCEDURE OnMouseWheel(oGauge,Delta) oGauge:Value := oGauge:FormatABC("value > 0 ? 1 : 0",Delta) RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oPicture,oPicture1,oPicture2 LOCAL oLayer,oLayer1,oLayer2 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:Click := {|| OnClick(oGauge)} /*Occurs when the user presses and then releases the left mouse button over the control.*/ oGauge:DragEnd := {|DragInfo,Cancel| OnDragEnd(oGauge,DragInfo,Cancel)} /*Occurs once the user ends dragging a layer.*/ oGauge:DragStart := {|DragInfo,Cancel| OnDragStart(oGauge,DragInfo,Cancel)} /*Occurs once the user starts dragging a layer.*/ oGauge:MouseWheel := {|Delta| OnMouseWheel(oGauge,Delta)} /*Occurs when the mouse wheel moves while the control has focus*/ oGauge:PicturesPath := "C:\Program Files\Exontrol\ExGauge\Sample\Design\Linear\Switch" oGauge:Layers():Count := 4 oGauge:Layers:Item(0):Background():Picture():Name := "background.png" oLayer := oGauge:Layers:Item(1) oPicture := oLayer:Background():Picture() oPicture:Name := "Indicator_ON.png" oPicture:DisplayAs := 16/*MiddleLeft*/ oLayer:OffsetXValid := Transform(48,"") oLayer:OffsetYValid := Transform(0,"") oLayer1 := oGauge:Layers:Item(2) oPicture1 := oLayer1:Background():Picture() oPicture1:Name := "Indicator_OFF.png" oPicture1:DisplayAs := 18/*MiddleRight*/ oLayer1:OffsetXValid := Transform(-12,"") oLayer1:OffsetYValid := Transform(0,"") oLayer2 := oGauge:Layers:Item(3) oLayer2:OnDrag := 1/*exDoMove*/ oLayer2:Key := "knob" oPicture2 := oLayer2:Background():Picture() oPicture2:Name := "knob.png" oPicture2:DisplayAs := 17/*MiddleCenter*/ oLayer2:DefaultOffsetY := "9" oLayer2:DefaultOffsetX := "-5" oLayer2:OffsetYValid := "0" oLayer2:ValueToOffsetX := "value = 0 ? 0 : 48" oLayer2:OffsetToValue := "value = 0 ? 0 : 1" oLayer2:OffsetXValid := "(value MIN 0 MAX 48)" oGauge:LayerOfValue := oGauge:Layers:Item("knob"):Index() oGauge:Value := 1 oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
36 |
How can I colorize the layer
PROCEDURE OnChange(oGauge,Layer) oGauge:SetProperty("Caption",0/*exLayerCaption*/,oGauge:FormatABC("` Value: <b>` + (value format ``)",oGauge:Layers:Item(4):Value())) RETURN PROCEDURE OnClick(oGauge) LOCAL oObject oObject := oGauge:Layers:Item(oGauge:LayerFromPoint(-1,-1)) RETURN PROCEDURE OnMouseIn(oGauge,Layer) LOCAL oLayer oLayer := oGauge:Layers:Item(Layer) oLayer:SetProperty("Brightness",1/*exRedChannel*/,100) oLayer:SetProperty("Brightness",2/*exGreenChannel*/,0) oLayer:SetProperty("Brightness",3/*exBlueChannel*/,0) RETURN PROCEDURE OnMouseOut(oGauge,Layer) LOCAL oLayer oLayer := oGauge:Layers:Item(Layer) oLayer:SetProperty("Brightness",1/*exRedChannel*/,oGauge:DefaultLayer(128/*exDefLayerBrightness*/)) oLayer:SetProperty("Brightness",2/*exGreenChannel*/,oGauge:DefaultLayer(128/*exDefLayerBrightness*/)) oLayer:SetProperty("Brightness",3/*exBlueChannel*/,oGauge:DefaultLayer(128/*exDefLayerBrightness*/)) RETURN PROCEDURE OnMouseWheel(oGauge,Delta) oGauge:Value := oGauge:FormatABC("A - B",:Value(),Delta) RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oLayer,oLayer1 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:Change := {|Layer| OnChange(oGauge,Layer)} /*Occurs when the layer's value is changed.*/ oGauge:Click := {|| OnClick(oGauge)} /*Occurs when the user presses and then releases the left mouse button over the control.*/ oGauge:MouseIn := {|Layer| OnMouseIn(oGauge,Layer)} /*Notifies that the cursor enters the layer.*/ oGauge:MouseOut := {|Layer| OnMouseOut(oGauge,Layer)} /*Notifies that the cursor exits the layer.*/ oGauge:MouseWheel := {|Delta| OnMouseWheel(oGauge,Delta)} /*Occurs when the mouse wheel moves while the control has focus*/ oGauge:BeginUpdate() oGauge:SetProperty("DefaultLayer",128/*exDefLayerBrightness*/,51) oGauge:PicturesPath := "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob 2" oGauge:PicturesName := "`Layer` + str(value + 1) + `.png`" oGauge:Layers():Count := 6 oLayer := oGauge:Layers:Item(0) oLayer:RotateCenterX := "lwidth/2-3" oLayer:RotateCenterY := "lheight/2+23" oLayer1 := oGauge:Layers:Item(4) oLayer1:DefaultRotateAngle := -132 oLayer1:OnDrag := 3/*exDoRotamove*/ oLayer1:RotateAngleValid := "value < 0 ? 0 : (value > 236 ? (value > 300 ? 0 : 236 ) : value)" oLayer1:ValueToRotateAngle := "value < 20 ? (value /20 * 86) : (value - 20) / (90-20) * (236-86) + 86" oLayer1:RotateAngleToValue := "value < 86 ? value / 86 * 20: ( 20 + ( value -86 ) / (236-86) * 70 )" oGauge:Value := 45 oGauge:EndUpdate() oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
35 |
How can I imitate the rotating angle on an unequal scale
PROCEDURE OnChange(oGauge,Layer) oGauge:SetProperty("Caption",0/*exLayerCaption*/,oGauge:FormatABC("` Value: <b>` + (value format ``)",oGauge:Layers:Item(4):Value())) RETURN PROCEDURE OnMouseWheel(oGauge,Delta) oGauge:Value := oGauge:FormatABC("A - B",:Value(),Delta) RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oLayer,oLayer1 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:Change := {|Layer| OnChange(oGauge,Layer)} /*Occurs when the layer's value is changed.*/ oGauge:MouseWheel := {|Delta| OnMouseWheel(oGauge,Delta)} /*Occurs when the mouse wheel moves while the control has focus*/ oGauge:BeginUpdate() oGauge:PicturesPath := "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob 2" oGauge:PicturesName := "`Layer` + str(value + 1) + `.png`" oGauge:Layers():Count := 6 oLayer := oGauge:Layers:Item(0) oLayer:RotateCenterX := "lwidth/2-3" oLayer:RotateCenterY := "lheight/2+23" oLayer1 := oGauge:Layers:Item(4) oLayer1:DefaultRotateAngle := -132 oLayer1:OnDrag := 3/*exDoRotamove*/ oLayer1:RotateAngleValid := "value < 0 ? 0 : (value > 236 ? (value > 300 ? 0 : 236 ) : value)" oLayer1:ValueToRotateAngle := "value < 20 ? (value /20 * 86) : (value - 20) / (90-20) * (236-86) + 86" oLayer1:RotateAngleToValue := "value < 86 ? value / 86 * 20: ( 20 + ( value -86 ) / (236-86) * 70 )" oGauge:Value := 45 oGauge:EndUpdate() oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
34 |
How can I rotate more knobs at once
PROCEDURE OnChange(oGauge,Layer) oGauge:SetProperty("Caption",0/*exLayerCaption*/,oGauge:FormatABC("` Value: <b>` + (value format ``)",oGauge:Layers:Item(4):Value())) oGauge:Layers:Item(2):RotateAngle := oGauge:Layers:Item(4):RotateAngle() RETURN PROCEDURE OnMouseWheel(oGauge,Delta) oGauge:Layers:Item(4):RotateAngle := oGauge:FormatABC("A - B",oGauge:Layers:Item(4):RotateAngle(),Delta) RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oLayer,oLayer1 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:Change := {|Layer| OnChange(oGauge,Layer)} /*Occurs when the layer's value is changed.*/ oGauge:MouseWheel := {|Delta| OnMouseWheel(oGauge,Delta)} /*Occurs when the mouse wheel moves while the control has focus*/ oGauge:PicturesPath := "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob 1" oGauge:PicturesName := "`Layer` + str(value + 1) + `.png`" oGauge:Layers():Count := 5 oLayer := oGauge:Layers:Item(4) oLayer:OnDrag := 3/*exDoRotamove*/ oLayer:DefaultRotateAngle := -142 oLayer1 := oGauge:Layers:Item(2) oLayer1:OnDrag := 2/*exDoRotate*/ oLayer1:RotateType := 2/*exRotateBilinearInterpolation*/ oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
33 |
How can I clip one layer while other is rotating
PROCEDURE OnChange(oGauge,Layer) oGauge:SetProperty("Caption",0/*exLayerCaption*/,oGauge:FormatABC("` Value: <b>` + (value format ``)",oGauge:Layers:Item(9):Value())) oGauge:SetProperty("ExtraCaption","RotateAngle",0/*exLayerCaption*/,oGauge:FormatABC("` RotateAngle: <b>` + ( A format `` ) + `°`",oGauge:Layers:Item(9):RotateAngle())) oGauge:SetProperty("ExtraCaption","RotateAngle",5/*exLayerCaptionTop*/,18) oGauge:SetProperty("ExtraCaption","RotamoveCenter",0/*exLayerCaption*/,oGauge:FormatABC("` RotamoveCenter: <b> (` + A + `,` + B + `)`",oGauge:Layers:Item(9):RotamoveCenterX(),oGauge:Layers:Item(9):RotamoveCenterY())) oGauge:SetProperty("ExtraCaption","RotamoveCenter",5/*exLayerCaptionTop*/,36) oGauge:SetProperty("ExtraCaption","RotamoveOffset",0/*exLayerCaption*/,oGauge:FormatABC("` RotamoveOffset: <b> (` + A + `,` + B + `)`",oGauge:Layers:Item(9):RotamoveOffsetX(),oGauge:Layers:Item(9):RotamoveOffsetY())) oGauge:SetProperty("ExtraCaption","RotamoveOffset",5/*exLayerCaptionTop*/,54) oGauge:SetProperty("ExtraCaption","Offset",0/*exLayerCaption*/,oGauge:FormatABC("` Offset: <b> (` + A + `,` + B + `)`",oGauge:Layers:Item(9):OffsetX(),oGauge:Layers:Item(9):OffsetY())) oGauge:SetProperty("ExtraCaption","Offset",5/*exLayerCaptionTop*/,72) oGauge:SetProperty("ExtraCaption","Client",0/*exLayerCaption*/,oGauge:FormatABC("`<sha ;;0><font ;12><b>` + ((100 - value) format ``)",oGauge:Value())) oGauge:SetProperty("ExtraCaption","Client",4/*exLayerCaptionLeft*/,oGauge:FormatABC("value - 12",:Item(9):LayerToClientX(oGauge:Layers:RotamoveCenterX(),:RotamoveCenterY()))) oGauge:SetProperty("ExtraCaption","Client",5/*exLayerCaptionTop*/,oGauge:FormatABC("value - 36",:Item(9):LayerToClientY(oGauge:Layers:RotamoveCenterX(),:RotamoveCenterY()))) oGauge:Layers:Item(3):Clip():Value := oGauge:Layers:Item(9):RotateAngle() oGauge:Layers:Item(4):Clip():Value := oGauge:Layers:Item(3):Clip():Value() RETURN PROCEDURE OnDragStart(oGauge,DragInfo,Cancel) /*DragInfo.RotateAngleValid = "value < 0 ? 0 : ( value >= 360 ? 359.999 : value )"*/ RETURN PROCEDURE OnMouseWheel(oGauge,Delta) oGauge:Value := oGauge:FormatABC("100 - value - B",oGauge:Value(),Delta) RETURN #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:Change := {|Layer| OnChange(oGauge,Layer)} /*Occurs when the layer's value is changed.*/ oGauge:DragStart := {|DragInfo,Cancel| OnDragStart(oGauge,DragInfo,Cancel)} /*Occurs once the user starts dragging a layer.*/ oGauge:MouseWheel := {|Delta| OnMouseWheel(oGauge,Delta)} /*Occurs when the mouse wheel moves while the control has focus*/ oGauge:BeginUpdate() oGauge:PicturesPath := "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob" oGauge:PicturesName := "`Layer` + str(value + 1) + `.png`" oGauge:Layers():Count := 11 oGauge:AllowSmoothChange := 0/*exSmoothChangeless*/ oLayer := oGauge:Layers:Item(9) oLayer:DefaultRotateAngle := -126 oLayer:OnDrag := 3/*exDoRotamove*/ oLayer:RotateAngleToValue := "100 - value / 360 * 100" oLayer:ValueToRotateAngle := "(value)/100 * 360" oGauge:Layers:Item(3):Clip():Pie():SweepAngle := "value" oGauge:Layers:Item(4):Clip():Pie():SweepAngle := oGauge:Layers:Item(3):Clip():Pie():SweepAngle() oGauge:Layers:Item(9):Value := 25 oGauge:EndUpdate() oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
32 |
Can I move one or more layers at once
PROCEDURE OnChange(oGauge,Layer) oGauge:Layers:Item(3):SetProperty("Brightness",1/*exRedChannel*/,oGauge:FormatABC("100 - value ",oGauge:Value())) oGauge:Layers:Item(4):SetProperty("Brightness",1/*exRedChannel*/,oGauge:Layers:Item(3):Brightness(1/*exRedChannel*/)) oGauge:SetProperty("Caption",0/*exLayerCaption*/,oGauge:FormatABC("` Value: <b>` + (100 - value format ``)",oGauge:Layers:Item(9):Value())) oGauge:SetProperty("ExtraCaption","RotateAngle",0/*exLayerCaption*/,oGauge:FormatABC("` RotateAngle: <b>` + ( A format `` ) + `°`",oGauge:Layers:Item(9):RotateAngle())) oGauge:SetProperty("ExtraCaption","RotateAngle",5/*exLayerCaptionTop*/,18) oGauge:SetProperty("ExtraCaption","RotamoveCenter",0/*exLayerCaption*/,oGauge:FormatABC("` RotamoveCenter: <b> (` + A + `,` + B + `)`",oGauge:Layers:Item(9):RotamoveCenterX(),oGauge:Layers:Item(9):RotamoveCenterY())) oGauge:SetProperty("ExtraCaption","RotamoveCenter",5/*exLayerCaptionTop*/,36) oGauge:SetProperty("ExtraCaption","RotamoveOffset",0/*exLayerCaption*/,oGauge:FormatABC("` RotamoveOffset: <b> (` + A + `,` + B + `)`",oGauge:Layers:Item(9):RotamoveOffsetX(),oGauge:Layers:Item(9):RotamoveOffsetY())) oGauge:SetProperty("ExtraCaption","RotamoveOffset",5/*exLayerCaptionTop*/,54) oGauge:SetProperty("ExtraCaption","Offset",0/*exLayerCaption*/,oGauge:FormatABC("` Offset: <b> (` + A + `,` + B + `)`",oGauge:Layers:Item(9):OffsetX(),oGauge:Layers:Item(9):OffsetY())) oGauge:SetProperty("ExtraCaption","Offset",5/*exLayerCaptionTop*/,72) oGauge:Layers:Item(10):RotateAngle := oGauge:Layers:Item(9):RotateAngle() RETURN PROCEDURE OnDblClick(oGauge,Shift,X,Y) oGauge:Value := 0 RETURN PROCEDURE OnDrag(oGauge,DragInfo) /*ExtraCaption("Clockwise",0) = FormatABC( "` Clockwise: <b>` + ( value != 0 ? `Yes` : `No`) ", DragInfo.Clockwise )*/ /*ExtraCaption("Cumulative",0) = FormatABC( "` CumulativeRotateAngle: <b>` + ( value format `` ) + `°` ", DragInfo.CumulativeRotateAngle )*/ DevOut( Transform(DragInfo,"") ) oGauge:SetProperty("ExtraCaption","Clockwise",5/*exLayerCaptionTop*/,90) oGauge:SetProperty("ExtraCaption","Cumulative",5/*exLayerCaptionTop*/,108) RETURN PROCEDURE OnDragEnd(oGauge,DragInfo,Cancel) oGauge:SetProperty("ExtraCaption","Clockwise",0/*exLayerCaption*/,"") RETURN PROCEDURE OnDragStart(oGauge,DragInfo,Cancel) /*DragInfo.Debug = 227*/ /*DragInfo.RotateAngleValid = "value < 0 ? 0 : (value > 360 ? 359.999999 : value)"*/ oGauge:SetProperty("ExtraCaption","Clockwise",0/*exLayerCaption*/,"") oGauge:SetProperty("ExtraCaption","Cumulative",0/*exLayerCaption*/,"") RETURN PROCEDURE OnMouseWheel(oGauge,Delta) oGauge:Value := oGauge:FormatABC("100 - A - B",oGauge:Value(),Delta) RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oLayer,oLayer1,oLayer2,oLayer3 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:Change := {|Layer| OnChange(oGauge,Layer)} /*Occurs when the layer's value is changed.*/ oGauge:DblClick := {|Shift,X,Y| OnDblClick(oGauge,Shift,X,Y)} /*Occurs when the user dblclk the left mouse button over an object.*/ oGauge:Drag := {|DragInfo| OnDrag(oGauge,DragInfo)} /*Notifies that the user drags the layer.*/ oGauge:DragEnd := {|DragInfo,Cancel| OnDragEnd(oGauge,DragInfo,Cancel)} /*Occurs once the user ends dragging a layer.*/ oGauge:DragStart := {|DragInfo,Cancel| OnDragStart(oGauge,DragInfo,Cancel)} /*Occurs once the user starts dragging a layer.*/ oGauge:MouseWheel := {|Delta| OnMouseWheel(oGauge,Delta)} /*Occurs when the mouse wheel moves while the control has focus*/ oGauge:BeginUpdate() oGauge:PicturesPath := "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob" oGauge:PicturesName := "`Layer` + str(value + 1) + `.png`" oGauge:SetProperty("DefaultLayer",185/*exDefLayerRotateType*/,2) oGauge:Layers():Count := 11 oGauge:AllowSmoothChange := 0/*exSmoothChangeless*/ oLayer := oGauge:Layers:Item(9) oLayer:OnDrag := 3/*exDoRotamove*/ oLayer:DefaultRotateAngle := -126 oLayer:RotateAngleToValue := "100 - (value ) / 360 * 100" oLayer:ValueToRotateAngle := "(value)/100 * 360" oLayer1 := oGauge:Layers:Item(10) oLayer1:Grayscale := 100 oLayer1:Transparency := 25 oLayer1:DefaultRotateAngle := -69.5 oLayer1:RotateAngleToValue := "100 - (value ) / 360 * 100" oLayer1:ValueToRotateAngle := "(value 1)/100 * 360" oLayer1:Background():Picture():Value := "Highlighted_Layer4.png" oLayer2 := oGauge:Layers:Item(3) oLayer2:SetProperty("Brightness",0/*exAllChannels*/,0) oLayer2:SetProperty("Brightness",1/*exRedChannel*/,0) oLayer3 := oGauge:Layers:Item(4) oLayer3:SetProperty("Brightness",0/*exAllChannels*/,0) oLayer3:SetProperty("Brightness",1/*exRedChannel*/,0) oGauge:LayerOfValue := 9 oGauge:Value := 5 oGauge:EndUpdate() oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
31 |
How can I rotate a knob by moving ( rotamove )
PROCEDURE OnChange(oGauge,Layer) oGauge:Layers:Item(3):Transparency := oGauge:Value() oGauge:Layers:Item(4):Transparency := oGauge:Value() oGauge:SetProperty("Caption",0/*exLayerCaption*/,oGauge:FormatABC("` Value: <b>` + (100 - value format ``)",oGauge:Layers:Item(9):Value())) oGauge:SetProperty("ExtraCaption","RotateAngle",0/*exLayerCaption*/,oGauge:FormatABC("` RotateAngle: <b>` + ( A format `` ) + `°`",oGauge:Layers:Item(9):RotateAngle())) oGauge:SetProperty("ExtraCaption","RotateAngle",5/*exLayerCaptionTop*/,18) oGauge:SetProperty("ExtraCaption","RotamoveCenter",0/*exLayerCaption*/,oGauge:FormatABC("` RotamoveCenter: <b> (` + A + `,` + B + `)`",oGauge:Layers:Item(9):RotamoveCenterX(),oGauge:Layers:Item(9):RotamoveCenterY())) oGauge:SetProperty("ExtraCaption","RotamoveCenter",5/*exLayerCaptionTop*/,36) oGauge:SetProperty("ExtraCaption","RotamoveOffset",0/*exLayerCaption*/,oGauge:FormatABC("` RotamoveOffset: <b> (` + A + `,` + B + `)`",oGauge:Layers:Item(9):RotamoveOffsetX(),oGauge:Layers:Item(9):RotamoveOffsetY())) oGauge:SetProperty("ExtraCaption","RotamoveOffset",5/*exLayerCaptionTop*/,54) oGauge:SetProperty("ExtraCaption","Offset",0/*exLayerCaption*/,oGauge:FormatABC("` Offset: <b> (` + A + `,` + B + `)`",oGauge:Layers:Item(9):OffsetX(),oGauge:Layers:Item(9):OffsetY())) oGauge:SetProperty("ExtraCaption","Offset",5/*exLayerCaptionTop*/,72) RETURN PROCEDURE OnDblClick(oGauge,Shift,X,Y) oGauge:Value := 0 RETURN PROCEDURE OnDragStart(oGauge,DragInfo,Cancel) /*DragInfo.RotateAngleValid = "value < 0 ? 0 : (value > 360 ? 359.999999 : value)"*/ RETURN PROCEDURE OnMouseWheel(oGauge,Delta) oGauge:Value := oGauge:FormatABC("100 - A - B",oGauge:Value(),Delta) RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oLayer,oLayer1,oLayer2 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:Change := {|Layer| OnChange(oGauge,Layer)} /*Occurs when the layer's value is changed.*/ oGauge:DblClick := {|Shift,X,Y| OnDblClick(oGauge,Shift,X,Y)} /*Occurs when the user dblclk the left mouse button over an object.*/ oGauge:DragStart := {|DragInfo,Cancel| OnDragStart(oGauge,DragInfo,Cancel)} /*Occurs once the user starts dragging a layer.*/ oGauge:MouseWheel := {|Delta| OnMouseWheel(oGauge,Delta)} /*Occurs when the mouse wheel moves while the control has focus*/ oGauge:BeginUpdate() oGauge:PicturesPath := "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob" oGauge:PicturesName := "`Layer` + str(value + 1) + `.png`" oGauge:Layers():Count := 11 oGauge:AllowSmoothChange := 0/*exSmoothChangeless*/ oLayer := oGauge:Layers:Item(9) oLayer:OnDrag := 3/*exDoRotamove*/ oLayer:DefaultRotateAngle := -126 oLayer:RotateAngleToValue := "100 - value / 360 * 100" oLayer:ValueToRotateAngle := "(value)/100 * 360" oLayer:Background():ExtraPicture("Aka"):Value := "Highlighted_Layer4.png" oLayer1 := oGauge:Layers:Item(3) oLayer1:SetProperty("Brightness",0/*exAllChannels*/,0) oLayer1:SetProperty("Brightness",1/*exRedChannel*/,100) oLayer2 := oGauge:Layers:Item(4) oLayer2:OnDrag := 3/*exDoRotamove*/ oLayer2:SetProperty("Brightness",0/*exAllChannels*/,0) oLayer2:SetProperty("Brightness",1/*exRedChannel*/,100) oGauge:Value := 15 oGauge:EndUpdate() oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
30 |
How can I display a knob, and displays the current value on it
PROCEDURE OnChange(oGauge,Layer) oGauge:SetProperty("Caption",0/*exLayerCaption*/,oGauge:FormatABC("` Value: <b>` + (100 - value format ``)",oGauge:Layers:Item(9):Value())) oGauge:SetProperty("ExtraCaption","RotateAngle",0/*exLayerCaption*/,oGauge:FormatABC("` RotateAngle: <b>` + ( A format `` ) + `°`",oGauge:Layers:Item(9):RotateAngle())) oGauge:SetProperty("ExtraCaption","RotateAngle",5/*exLayerCaptionTop*/,18) oGauge:SetProperty("ExtraCaption","RotamoveCenter",0/*exLayerCaption*/,oGauge:FormatABC("` RotamoveCenter: <b> (` + A + `,` + B + `)`",oGauge:Layers:Item(9):RotamoveCenterX(),oGauge:Layers:Item(9):RotamoveCenterY())) oGauge:SetProperty("ExtraCaption","RotamoveCenter",5/*exLayerCaptionTop*/,36) oGauge:SetProperty("ExtraCaption","RotamoveOffset",0/*exLayerCaption*/,oGauge:FormatABC("` RotamoveOffset: <b> (` + A + `,` + B + `)`",oGauge:Layers:Item(9):RotamoveOffsetX(),oGauge:Layers:Item(9):RotamoveOffsetY())) oGauge:SetProperty("ExtraCaption","RotamoveOffset",5/*exLayerCaptionTop*/,54) oGauge:SetProperty("ExtraCaption","Offset",0/*exLayerCaption*/,oGauge:FormatABC("` Offset: <b> (` + A + `,` + B + `)`",oGauge:Layers:Item(9):OffsetX(),oGauge:Layers:Item(9):OffsetY())) oGauge:SetProperty("ExtraCaption","Offset",5/*exLayerCaptionTop*/,72) oGauge:SetProperty("ExtraCaption","Client",0/*exLayerCaption*/,oGauge:FormatABC("`<sha ;;0><font ;12><b>` + (100 - value format `0`)",oGauge:Value())) oGauge:SetProperty("ExtraCaption","Client",4/*exLayerCaptionLeft*/,oGauge:FormatABC("value - 8",oGauge:Layers:Item(9):LayerToClientX(oGauge:Layers:Item(9):RotamoveCenterX(),oGauge:Layers:Item(9):RotamoveCenterY()))) oGauge:SetProperty("ExtraCaption","Client",5/*exLayerCaptionTop*/,oGauge:FormatABC("value - 26",oGauge:Layers:Item(9):LayerToClientY(oGauge:Layers:Item(9):RotamoveCenterX(),oGauge:Layers:Item(9):RotamoveCenterY()))) oGauge:Layers:Item(7):RotateAngle := oGauge:Layers:Item(0):RotateAngle() RETURN PROCEDURE OnMouseWheel(oGauge,Delta) oGauge:Value := oGauge:FormatABC("100 - A - B",oGauge:Value(),Delta) RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oLayer,oLayer1,oLayer2 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:Change := {|Layer| OnChange(oGauge,Layer)} /*Occurs when the layer's value is changed.*/ oGauge:MouseWheel := {|Delta| OnMouseWheel(oGauge,Delta)} /*Occurs when the mouse wheel moves while the control has focus*/ oGauge:BeginUpdate() oGauge:PicturesPath := "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob" oGauge:PicturesName := "`Layer` + str(value + 1) + `.png`" oGauge:Layers():Count := 11 oGauge:AllowSmoothChange := 0/*exSmoothChangeless*/ oLayer := oGauge:Layers:Item(9) oLayer:DefaultRotateAngle := -126 oLayer:OnDrag := 3/*exDoRotamove*/ oLayer:RotateAngleToValue := "100 - (value / 360 * 100)" oLayer:ValueToRotateAngle := "(value)/100 * 360" oLayer:ValueToOffsetX := "value" oLayer:OffsetToValue := "value" oLayer:RotateAngleValid := "int(value / 360 * 100)/100 * 360" oGauge:Layers:Item(3):Visible := .F. oGauge:Layers:Item(4):Visible := .F. oLayer1 := oGauge:Layers:Item(0) oLayer1:OnDrag := 2/*exDoRotate*/ oLayer1:RotateType := 2/*exRotateBilinearInterpolation*/ oLayer2 := oGauge:Layers:Item(7) oLayer2:OnDrag := 2/*exDoRotate*/ oLayer2:RotateType := 2/*exRotateBilinearInterpolation*/ oGauge:Value := 25 oGauge:EndUpdate() oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
29 |
How can I display an indicator
PROCEDURE OnMouseWheel(oGauge,Delta) oGauge:Layers:Item(1):Clip():Value := oGauge:FormatABC("(value + B) MIN 0 MAX 100",:Layers:Item(1):Clip():Value(),Delta) RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oClip LOCAL oClipRectangle LOCAL oLayer,oLayer1 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:MouseWheel := {|Delta| OnMouseWheel(oGauge,Delta)} /*Occurs when the mouse wheel moves while the control has focus*/ oGauge:PicturesPath := "C:\Program Files\Exontrol\ExGauge\Sample\Design\Linear\Indicator" oGauge:Layers():Count := 3 oGauge:Layers:Item(0):Background():Picture():Name := "Background.png" oLayer := oGauge:Layers:Item(1) oLayer:Background():Picture():Name := "Green_Lights.png" oClip := oLayer:Clip() oClipRectangle := oClip:Rectangle() oClipRectangle:Height := "(100 - value)/100 * height" oClipRectangle:InverseClip := .T. oClip:Value := 50 oLayer1 := oGauge:Layers:Item(2) oLayer1:Visible := .F. oLayer1:Background():Picture():Name := "overlay_top_layer.png" oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
28 |
How can I display a gauge
PROCEDURE OnChange(oGauge,Layer) oGauge:Layers:Item(1):SetProperty("Brightness",2/*exGreenChannel*/,oGauge:Value()) RETURN PROCEDURE OnDragStart(oGauge,DragInfo,Cancel) RETURN PROCEDURE OnMouseWheel(oGauge,Delta) oGauge:Value := oGauge:FormatABC("A - B",oGauge:Value(),Delta) RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oLayer,oLayer1 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:Change := {|Layer| OnChange(oGauge,Layer)} /*Occurs when the layer's value is changed.*/ oGauge:DragStart := {|DragInfo,Cancel| OnDragStart(oGauge,DragInfo,Cancel)} /*Occurs once the user starts dragging a layer.*/ oGauge:MouseWheel := {|Delta| OnMouseWheel(oGauge,Delta)} /*Occurs when the mouse wheel moves while the control has focus*/ oGauge:BeginUpdate() oGauge:SetProperty("BackColor",AutomationTranslateColor( GraMakeRGBColor ( { 217,217,217 } ) , .F. )) oGauge:PicturesPath := "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Guage" oGauge:Layers():Count := 2 oGauge:AllowSmoothChange := 0/*exSmoothChangeless*/ oLayer := oGauge:Layers:Item(0) oLayer:RotateCenterY := "lheight/2 + 78" oLayer:Background():Picture():Name := "Guage_Background.png" oLayer1 := oGauge:Layers:Item(1) oLayer1:OnDrag := 2/*exDoRotate*/ oLayer1:Background():Picture():Name := "Guage_Needle.png" oLayer1:RotateAngleValid := "value < 90 ? value : (value < 180 ? 90 : ( value < 270 ? 270 : value ))" oLayer1:RotateAngleToValue := "value >= 270 ? (value - 270)/90*50 : (value/90)*50 + 50" oLayer1:ValueToRotateAngle := "value < 50 ? (270 + value/50*90) : (value - 50)/50 * 90" oLayer1:RotateType := 2/*exRotateBilinearInterpolation*/ oLayer1:SetProperty("Brightness",0/*exAllChannels*/,0) oGauge:Value := 78 oGauge:EndUpdate() oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
27 |
How can I display a clock (rotate,wolf)
PROCEDURE OnChange(oGauge,Layer) oGauge:Layers:Item("sec"):Value := oGauge:Value() oGauge:Layers:Item("min"):Value := oGauge:Value() oGauge:Layers:Item("hour"):Value := oGauge:Value() oGauge:Layers:Item("range"):Clip():Value := oGauge:Layers:Item("pointer"):Value() RETURN PROCEDURE OnDragStart(oGauge,DragInfo,Cancel) /*DragInfo.Debug = -1*/ RETURN PROCEDURE OnMouseWheel(oGauge,Delta) oGauge:Layers:Item("pointer"):Value := oGauge:FormatABC("A - B",oGauge:Layers:Item("pointer"):Value(),Delta) RETURN PROCEDURE OnTimer(oGauge,TickCount) oGauge:Value := oGauge:FormatABC(" date(`now`)") oGauge:Layers:Item("pointer"):Value := oGauge:FormatABC("sin((value/100 mod 100)/100 * 2 * asin(1)) * 100",TickCount) oGauge:Layers:Item("range"):Clip():Value := oGauge:Layers:Item("pointer"):Value() RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oClipPie LOCAL oPicture,oPicture1,oPicture2 LOCAL oLayer,oLayer1,oLayer2,oLayer3,oLayer4,oLayer5,oLayer6,oLayer7,oLayer8 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:Change := {|Layer| OnChange(oGauge,Layer)} /*Occurs when the layer's value is changed.*/ oGauge:DragStart := {|DragInfo,Cancel| OnDragStart(oGauge,DragInfo,Cancel)} /*Occurs once the user starts dragging a layer.*/ oGauge:MouseWheel := {|Delta| OnMouseWheel(oGauge,Delta)} /*Occurs when the mouse wheel moves while the control has focus*/ oGauge:Timer := {|TickCount| OnTimer(oGauge,TickCount)} /*Occurs when the interval elapses.*/ oGauge:PicturesPath := "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Clock - Wolf" oGauge:SetProperty("DefaultLayer",185/*exDefLayerRotateType*/,2) oGauge:Layers():Count := 9 oLayer := oGauge:Layers:Item(0) oLayer:Left := "(width-512)/2" oLayer:Top := "(height-512)/2" oLayer:Height := Transform(512,"") oLayer:Width := Transform(512,"") oLayer:Background():Picture():Name := "Back.png" oLayer1 := oGauge:Layers:Item(1) oLayer1:Key := "scale" oLayer1:DefaultOffsetX := -90 oLayer1:DefaultOffsetY := -150 oLayer1:Background():Picture():Name := "Scale.png" oLayer1:RotateCenterLayer := 1 oLayer1:RotateCenterX := "(lwidth+181)/2" oLayer1:RotateCenterY := "(lheight+232)/2" oLayer2 := oGauge:Layers:Item(2) oLayer2:Key := "range" oLayer2:DefaultOffsetX := oGauge:Layers:Item("scale"):DefaultOffsetX() oLayer2:DefaultOffsetY := oGauge:Layers:Item("scale"):DefaultOffsetY() oLayer2:RotateCenterLayer := oGauge:Layers:Item("scale"):Index() oPicture := oLayer2:Background():Picture() oPicture:Name := "ScalePointerArc.png" oLayer2:RotateCenterLayer := oGauge:Layers:Item("scale"):Index() oClipPie := oLayer2:Clip():Pie() oClipPie:RadiusX := Transform(100,"") oClipPie:RadiusY := Transform(100,"") oClipPie:CenterX := oGauge:Layers:Item("scale"):RotateCenterX() oClipPie:CenterY := oGauge:Layers:Item("scale"):RotateCenterY() oClipPie:StartAngle := Transform(-148,"") oClipPie:SweepAngle := "value/100 * 300" oLayer3 := oGauge:Layers:Item(3) oLayer3:Key := "pointer" oLayer3:DefaultOffsetX := oGauge:Layers:Item("scale"):DefaultOffsetX() oLayer3:DefaultOffsetY := oGauge:Layers:Item("scale"):DefaultOffsetY() oPicture1 := oLayer3:Background():Picture() oPicture1:Name := "ScalePointer.png" oLayer3:RotateCenterLayer := oGauge:Layers:Item("scale"):Index() oLayer3:OnDrag := 2/*exDoRotate*/ oLayer3:DefaultRotateAngle := -148 oLayer3:RotateAngleValid := "value > 300 ? (value > 330 ? 0 : 300) : value" oLayer3:RotateAngleToValue := "value / 300 * 100" oLayer3:ValueToRotateAngle := "value /100 * 300" oLayer4 := oGauge:Layers:Item(4) oLayer4:Key := "bolt" oLayer4:DefaultOffsetX := oGauge:Layers:Item("scale"):DefaultOffsetX() oLayer4:DefaultOffsetY := oGauge:Layers:Item("scale"):DefaultOffsetY() oPicture2 := oLayer4:Background():Picture() oPicture2:Name := "Bolt.png" oLayer5 := oGauge:Layers:Item(5) oLayer5:Left := "(width-512)/2" oLayer5:Top := "(height-512)/2" oLayer5:Height := Transform(512,"") oLayer5:Width := Transform(512,"") oLayer5:Key := "sec" oLayer5:OnDrag := 2/*exDoRotate*/ oLayer5:Selectable := .F. oLayer5:Background():Picture():Name := "second-hand.png" oLayer5:ValueToRotateAngle := "((2:=(((1:=( ( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)) ) * 24 )) - floor(=:1)) * 60 )) - floor(=:2) ) * 360" oLayer5:RotateAngleToValue := "value / 360 / 24 / 60" oLayer6 := oGauge:Layers:Item(6) oLayer6:Left := "(width-512)/2" oLayer6:Top := "(height-512)/2" oLayer6:Height := Transform(512,"") oLayer6:Width := Transform(512,"") oLayer6:Key := "min" oLayer6:OnDrag := 2/*exDoRotate*/ oLayer6:Selectable := .F. oLayer6:Background():Picture():Name := "Minute.png" oLayer6:ValueToRotateAngle := "((1:=( ( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)) ) * 24 )) - floor(=:1)) * 360" oLayer6:RotateAngleToValue := "value / 360 / 24 / 60" oLayer7 := oGauge:Layers:Item(7) oLayer7:Left := "(width-512)/2" oLayer7:Top := "(height-512)/2" oLayer7:Height := Transform(512,"") oLayer7:Width := Transform(512,"") oLayer7:Key := "hour" oLayer7:OnDrag := 2/*exDoRotate*/ oLayer7:Background():Picture():Name := "Hour.png" oLayer7:ValueToRotateAngle := "2 * 360 * ( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)) )" oLayer7:RotateAngleToValue := "value / 360 * 0.5" oLayer8 := oGauge:Layers:Item(8) oLayer8:Left := "(width-512)/2" oLayer8:Top := "(height-512)/2" oLayer8:Height := Transform(512,"") oLayer8:Width := Transform(512,"") oLayer8:Key := "front" oLayer8:OnDrag := 2/*exDoRotate*/ oLayer8:Background():Picture():Name := "front.png" oGauge:LayerOfValue := oGauge:Layers:Item("hour"):Index() oGauge:Value := oGauge:FormatABC("date(`now`)") oGauge:TimerInterval := 100 oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
26 |
How can I display a clock (rotate,vintage)
PROCEDURE OnChange(oGauge,Layer) oGauge:Layers:Item("sec"):Value := oGauge:Value() oGauge:Layers:Item("min"):Value := oGauge:Value() oGauge:Layers:Item("hour"):Value := oGauge:Value() RETURN PROCEDURE OnDragStart(oGauge,DragInfo,Cancel) RETURN PROCEDURE OnMouseWheel(oGauge,Delta) oGauge:Value := oGauge:FormatABC("A - 1/24/60/60*B",oGauge:Value(),Delta) RETURN PROCEDURE OnTimer(oGauge,TickCount) oGauge:Value := oGauge:FormatABC("value + 1/24/60/60",oGauge:Value()) RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oLayer,oLayer1,oLayer2,oLayer3,oLayer4 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:Change := {|Layer| OnChange(oGauge,Layer)} /*Occurs when the layer's value is changed.*/ oGauge:DragStart := {|DragInfo,Cancel| OnDragStart(oGauge,DragInfo,Cancel)} /*Occurs once the user starts dragging a layer.*/ oGauge:MouseWheel := {|Delta| OnMouseWheel(oGauge,Delta)} /*Occurs when the mouse wheel moves while the control has focus*/ oGauge:Timer := {|TickCount| OnTimer(oGauge,TickCount)} /*Occurs when the interval elapses.*/ oGauge:PicturesPath := "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Clock - Vintage" oGauge:SetProperty("DefaultLayer",185/*exDefLayerRotateType*/,2) oGauge:Layers():Count := 5 oLayer := oGauge:Layers:Item(0) oLayer:Left := "(width-512)/2" oLayer:Top := "(height-512)/2" oLayer:Height := Transform(512,"") oLayer:Width := Transform(512,"") oLayer:Background():Picture():Name := "Back.png" oLayer1 := oGauge:Layers:Item(1) oLayer1:Position := 3 oLayer1:Left := "(width-512)/2" oLayer1:Top := "(height-512)/2" oLayer1:Height := Transform(512,"") oLayer1:Width := Transform(512,"") oLayer1:Key := "sec" oLayer1:OnDrag := 2/*exDoRotate*/ oLayer1:Selectable := .F. oLayer1:Background():Picture():Name := "second-hand.png" oLayer1:ValueToRotateAngle := "((2:=(((1:=( ( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)) ) * 24 )) - floor(=:1)) * 60 )) - floor(=:2) ) * 360" oLayer1:RotateAngleToValue := "value / 360 / 24 / 60" oLayer2 := oGauge:Layers:Item(2) oLayer2:Left := "(width-512)/2" oLayer2:Top := "(height-512)/2" oLayer2:Height := Transform(512,"") oLayer2:Width := Transform(512,"") oLayer2:Position := 2 oLayer2:Key := "min" oLayer2:OnDrag := 2/*exDoRotate*/ oLayer2:Selectable := .F. oLayer2:Background():Picture():Name := "Minute.png" oLayer2:ValueToRotateAngle := "((1:=( ( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)) ) * 24 )) - floor(=:1)) * 360" oLayer2:RotateAngleToValue := "value / 360 / 24 / 60" oLayer3 := oGauge:Layers:Item(3) oLayer3:Left := "(width-512)/2" oLayer3:Top := "(height-512)/2" oLayer3:Height := Transform(512,"") oLayer3:Width := Transform(512,"") oLayer3:Position := 1 oLayer3:Key := "hour" oLayer3:OnDrag := 2/*exDoRotate*/ oLayer3:Background():Picture():Name := "Hour.png" oLayer3:ValueToRotateAngle := "2 * 360 * ( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)) )" oLayer3:RotateAngleToValue := "value / 360 * 0.5" oLayer4 := oGauge:Layers:Item(4) oLayer4:Left := "(width-512)/2" oLayer4:Top := "(height-512)/2" oLayer4:Height := Transform(512,"") oLayer4:Width := Transform(512,"") oLayer4:Position := 1 oLayer4:Key := "front" oLayer4:OnDrag := 2/*exDoRotate*/ oLayer4:Background():Picture():Name := "front.png" oLayer4:ValueToRotateAngle := "2 * 360 * ( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)) )" oLayer4:RotateAngleToValue := "value / 360 * 0.5" oGauge:LayerOfValue := 3 oGauge:Value := oGauge:FormatABC("date(`now`)") oGauge:TimerInterval := 1000 oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
25 |
How can I display a clock (rotate,london)
PROCEDURE OnChange(oGauge,Layer) oGauge:Layers:Item("sec"):Value := oGauge:Value() oGauge:Layers:Item("min"):Value := oGauge:Value() oGauge:Layers:Item("hour"):Value := oGauge:Value() RETURN PROCEDURE OnDragStart(oGauge,DragInfo,Cancel) RETURN PROCEDURE OnMouseWheel(oGauge,Delta) oGauge:Value := oGauge:FormatABC("A - 1/24/60/60*B",oGauge:Value(),Delta) RETURN PROCEDURE OnTimer(oGauge,TickCount) oGauge:Value := oGauge:FormatABC("value + 1/24/60/60",:Value()) RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oLayer,oLayer1,oLayer2,oLayer3,oLayer4,oLayer5 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:Change := {|Layer| OnChange(oGauge,Layer)} /*Occurs when the layer's value is changed.*/ oGauge:DragStart := {|DragInfo,Cancel| OnDragStart(oGauge,DragInfo,Cancel)} /*Occurs once the user starts dragging a layer.*/ oGauge:MouseWheel := {|Delta| OnMouseWheel(oGauge,Delta)} /*Occurs when the mouse wheel moves while the control has focus*/ oGauge:Timer := {|TickCount| OnTimer(oGauge,TickCount)} /*Occurs when the interval elapses.*/ oGauge:PicturesPath := "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Clock - London" oGauge:SetProperty("DefaultLayer",185/*exDefLayerRotateType*/,2) oGauge:Layers():Count := 6 oLayer := oGauge:Layers:Item(0) oLayer:Left := "(width-512)/2" oLayer:Top := "(height-512)/2" oLayer:Height := Transform(512,"") oLayer:Width := Transform(512,"") oLayer:Background():Picture():Name := "Back.png" oLayer1 := oGauge:Layers:Item(1) oLayer1:Position := 3 oLayer1:Left := "(width-512)/2" oLayer1:Top := "(height-512)/2" oLayer1:Height := Transform(512,"") oLayer1:Width := Transform(512,"") oLayer1:Key := "sec" oLayer1:OnDrag := 2/*exDoRotate*/ oLayer1:Selectable := .F. oLayer1:RotateCenterLayer := 1 oLayer1:Background():Picture():Name := "second-hand.png" oLayer1:ValueToRotateAngle := "((2:=(((1:=( ( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)) ) * 24 )) - floor(=:1)) * 60 )) - floor(=:2) ) * 360" oLayer1:RotateAngleToValue := "value / 360 / 24 / 60" oLayer2 := oGauge:Layers:Item(2) oLayer2:Left := "(width-512)/2" oLayer2:Top := "(height-512)/2" oLayer2:Height := Transform(512,"") oLayer2:Width := Transform(512,"") oLayer2:Position := 2 oLayer2:RotateCenterLayer := 2 oLayer2:Key := "min" oLayer2:OnDrag := 2/*exDoRotate*/ oLayer2:Selectable := .F. oLayer2:Background():Picture():Name := "Minute.png" oLayer2:ValueToRotateAngle := "((1:=( ( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)) ) * 24 )) - floor(=:1)) * 360" oLayer2:RotateAngleToValue := "value / 360 / 24 / 60" oLayer3 := oGauge:Layers:Item(3) oLayer3:Left := "(width-512)/2" oLayer3:Top := "(height-512)/2" oLayer3:Height := Transform(512,"") oLayer3:Width := Transform(512,"") oLayer3:Position := 1 oLayer3:Key := "hour" oLayer3:RotateCenterLayer := 3 oLayer3:OnDrag := 2/*exDoRotate*/ oLayer3:Background():Picture():Name := "Hour.png" oLayer3:ValueToRotateAngle := "2 * 360 * ( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)) )" oLayer3:RotateAngleToValue := "value / 360 * 0.5" oLayer4 := oGauge:Layers:Item(4) oLayer4:Left := "(width-512)/2" oLayer4:Top := "(height-512)/2" oLayer4:Height := Transform(512,"") oLayer4:Width := Transform(512,"") oLayer4:Position := 1 oLayer4:Key := "front" oLayer4:RotateCenterLayer := 4 oLayer4:OnDrag := 2/*exDoRotate*/ oLayer4:Background():Picture():Name := "front.png" oLayer4:ValueToRotateAngle := "2 * 360 * ( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)) )" oLayer4:RotateAngleToValue := "value / 360 * 0.5" oLayer5 := oGauge:Layers:Item(5) oLayer5:Left := "(width-512)/2" oLayer5:Top := "(height-512)/2" oLayer5:Height := Transform(512,"") oLayer5:Width := Transform(512,"") oLayer5:Key := "bolt" oLayer5:RotateCenterLayer := 5 oLayer5:Background():Picture():Name := "Bolt.png" oGauge:LayerOfValue := oGauge:Layers:Item("hour"):Index() oGauge:Value := oGauge:FormatABC("date(`now`)") oGauge:TimerInterval := 1000 oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
24 |
How can I display a clock (rotate)
PROCEDURE OnChange(oGauge,Layer) oGauge:Layers:Item("sec"):Value := oGauge:Value() oGauge:Layers:Item("min"):Value := oGauge:Value() oGauge:Layers:Item("hour"):Value := oGauge:Value() RETURN PROCEDURE OnDragStart(oGauge,DragInfo,Cancel) RETURN PROCEDURE OnMouseWheel(oGauge,Delta) oGauge:Value := oGauge:FormatABC("A - 1/24/60/60*B",oGauge:Value(),Delta) RETURN PROCEDURE OnTimer(oGauge,TickCount) oGauge:Value := oGauge:FormatABC("value + 1/24/60/60",oGauge:Value()) RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oLayer,oLayer1,oLayer2,oLayer3 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:Change := {|Layer| OnChange(oGauge,Layer)} /*Occurs when the layer's value is changed.*/ oGauge:DragStart := {|DragInfo,Cancel| OnDragStart(oGauge,DragInfo,Cancel)} /*Occurs once the user starts dragging a layer.*/ oGauge:MouseWheel := {|Delta| OnMouseWheel(oGauge,Delta)} /*Occurs when the mouse wheel moves while the control has focus*/ oGauge:Timer := {|TickCount| OnTimer(oGauge,TickCount)} /*Occurs when the interval elapses.*/ oGauge:PicturesPath := "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Clock" oGauge:SetProperty("DefaultLayer",185/*exDefLayerRotateType*/,2) oGauge:Layers():Count := 4 oLayer := oGauge:Layers:Item(0) oLayer:Background():Picture():Name := "vista_clock.png" oLayer1 := oGauge:Layers:Item(1) oLayer1:Position := 3 oLayer1:Key := "sec" oLayer1:OnDrag := 2/*exDoRotate*/ oLayer1:Selectable := .F. oLayer1:Background():Picture():Name := "second-hand.png" oLayer1:ValueToRotateAngle := "((2:=(((1:=( ( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)) ) * 24 )) - floor(=:1)) * 60 )) - floor(=:2) ) * 360" oLayer1:RotateAngleToValue := "value / 360 / 24 / 60" oLayer2 := oGauge:Layers:Item(2) oLayer2:Position := 2 oLayer2:Key := "min" oLayer2:OnDrag := 2/*exDoRotate*/ oLayer2:Selectable := .F. oLayer2:Background():Picture():Name := "Minute.png" oLayer2:ValueToRotateAngle := "((1:=( ( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)) ) * 24 )) - floor(=:1)) * 360" oLayer2:RotateAngleToValue := "value / 360 / 24 / 60" oLayer3 := oGauge:Layers:Item(3) oLayer3:Position := 1 oLayer3:Key := "hour" oLayer3:OnDrag := 2/*exDoRotate*/ oLayer3:Background():Picture():Name := "Hour.png" oLayer3:ValueToRotateAngle := "2 * 360 * ( (0:=(value < 0 ? floor(value) + 1 - value : value - floor(value))) < 0.5 ? =:0 : (0:= (=:0 - 0.5)) )" oLayer3:RotateAngleToValue := "value / 360 * 0.5" oGauge:LayerOfValue := 3 oGauge:Value := oGauge:FormatABC("date(`now`)") oGauge:TimerInterval := 1000 oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
23 |
How can I clip as a triangle
PROCEDURE OnDrag(oGauge,DragInfo) /*Me.Layers(0).Clip.Value = Me.FormatABC("(value + B) MIN 0 MAX 100", Me.Layers(0).UserData, DragInfo.DeltaY )*/ RETURN PROCEDURE OnDragStart(oGauge,DragInfo,Cancel) /*DragInfo.Debug= 287*/ LOCAL oLayer oLayer := oGauge:Layers:Item(0) oLayer:UserData := oLayer:Clip:Value() RETURN PROCEDURE OnMouseWheel(oGauge,Delta) oGauge:Layers:Item(0):Clip():Value := oGauge:FormatABC("(value + B) MIN 0 MAX 100",oGauge:Layers:Item(0):Clip():Value(),Delta) RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oClip LOCAL oClipPolygon 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:Drag := {|DragInfo| OnDrag(oGauge,DragInfo)} /*Notifies that the user drags the layer.*/ oGauge:DragStart := {|DragInfo,Cancel| OnDragStart(oGauge,DragInfo,Cancel)} /*Occurs once the user starts dragging a layer.*/ oGauge:MouseWheel := {|Delta| OnMouseWheel(oGauge,Delta)} /*Occurs when the mouse wheel moves while the control has focus*/ oGauge:Layers():Count := 1 oLayer := oGauge:Layers:Item(0) oLayer:Background():Picture():Value := "c:\exontrol\images\card.png" oClip := oLayer:Clip() oClipPolygon := oClip:Polygon() oClipPolygon:Points := 3 oClipPolygon:SetProperty("X",0,Transform(0,"")) oClipPolygon:SetProperty("Y",0,"height") oClipPolygon:SetProperty("X",1,"width/2") oClipPolygon:SetProperty("Y",1,"value/100*width") oClipPolygon:SetProperty("X",2,"width") oClipPolygon:SetProperty("Y",2,"height") oClipPolygon:InverseClip := .T. oClip:Value := 50 oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
22 |
How can I limit the rotation from 0 to 360 degree, while dragging
|
21 |
How can I clip as a pie
PROCEDURE OnDrag(oGauge,DragInfo) /*Me.Layers(0).Clip.Value = Me.FormatABC("value + B/360 * 100", Me.Layers(0).UserData, DragInfo.DeltaAngle )*/ RETURN PROCEDURE OnDragStart(oGauge,DragInfo,Cancel) /*DragInfo.Debug = -1*/ LOCAL oLayer oLayer := oGauge:Layers:Item(0) oLayer:UserData := oLayer:Clip:Value() RETURN PROCEDURE OnMouseWheel(oGauge,Delta) oGauge:Layers:Item(0):Clip():Value := oGauge:FormatABC("(value + B) MIN 0 MAX 100",oGauge:Layers:Item(0):Clip():Value(),Delta) RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oClip LOCAL oClipPie 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:Drag := {|DragInfo| OnDrag(oGauge,DragInfo)} /*Notifies that the user drags the layer.*/ oGauge:DragStart := {|DragInfo,Cancel| OnDragStart(oGauge,DragInfo,Cancel)} /*Occurs once the user starts dragging a layer.*/ oGauge:MouseWheel := {|Delta| OnMouseWheel(oGauge,Delta)} /*Occurs when the mouse wheel moves while the control has focus*/ oGauge:Layers():Count := 1 oLayer := oGauge:Layers:Item(0) oLayer:Left := "(width-128)/2" oLayer:Top := "(height-128)/2" oLayer:Height := Transform(128,"") oLayer:Width := Transform(128,"") oLayer:Background():Color():SetProperty("Value",AutomationTranslateColor( GraMakeRGBColor ( { 0,255,0 } ) , .F. )) oClip := oLayer:Clip() oClipPie := oClip:Pie() oClipPie:InverseClip := .T. oClipPie:StartAngle := Transform(0,"") oClipPie:SweepAngle := "value/100*360" oClip:Value := 15 oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
20 |
How can I use a picture to clip the layer
PROCEDURE OnChange(oGauge,Layer) oGauge:Layers:Item("Clip"):Clip():Value := oGauge:Layers:Item("Thumb"):RotateAngle() RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oClip LOCAL oClipPicture LOCAL oLayer,oLayer1 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:Change := {|Layer| OnChange(oGauge,Layer)} /*Occurs when the layer's value is changed.*/ oGauge:BeginUpdate() oGauge:PicturesPath := "C:\Program Files\Exontrol\ExGauge\Sample\Design\Circular\Knob 1" oGauge:PicturesName := "`Layer` + int(value + 1) + `.png`" oGauge:Layers():Count := 5 oLayer := oGauge:Layers:Item(4) oLayer:Key := "Thumb" oLayer:DefaultRotateAngle := -141 oLayer:OnDrag := 2/*exDoRotate*/ oLayer:RotateType := 2/*exRotateBilinearInterpolation*/ oLayer1 := oGauge:Layers:Item(1) oLayer1:Key := "Clip" oClip := oLayer1:Clip() oClip:Pie():SweepAngle := "value" oClipPicture := oClip:Picture() oClipPicture:Name := oGauge:Layers:Item("Clip"):Background():Picture():Name() oClipPicture:AlphaTo := "128" oGauge:Layers:Item("Thumb"):RotateAngle := 90 oGauge:EndUpdate() oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
19 |
How do I clip a circle/ellipse
PROCEDURE OnDrag(oGauge,DragInfo) /*Me.Layers(0).Clip.Value = Me.FormatABC("(value + B) MIN 0 MAX 100", Me.Layers(0).UserData, DragInfo.DeltaX )*/ RETURN PROCEDURE OnDragStart(oGauge,DragInfo,Cancel) /*DragInfo.Debug= 287*/ LOCAL oLayer oLayer := oGauge:Layers:Item(0) oLayer:UserData := oLayer:Clip:Value() RETURN PROCEDURE OnMouseWheel(oGauge,Delta) oGauge:Layers:Item(0):Clip():Value := oGauge:FormatABC("(value + B) MIN 0 MAX 100",oGauge:Layers:Item(0):Clip():Value(),Delta) RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oClip 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:Drag := {|DragInfo| OnDrag(oGauge,DragInfo)} /*Notifies that the user drags the layer.*/ oGauge:DragStart := {|DragInfo,Cancel| OnDragStart(oGauge,DragInfo,Cancel)} /*Occurs once the user starts dragging a layer.*/ oGauge:MouseWheel := {|Delta| OnMouseWheel(oGauge,Delta)} /*Occurs when the mouse wheel moves while the control has focus*/ oGauge:Layers():Count := 1 oLayer := oGauge:Layers:Item(0) oLayer:Left := "(width-128)/2" oLayer:Top := "(height-128)/2" oLayer:Height := Transform(128,"") oLayer:Width := Transform(128,"") oLayer:Background():Color():SetProperty("Value",AutomationTranslateColor( GraMakeRGBColor ( { 0,255,0 } ) , .F. )) oClip := oLayer:Clip() oClip:Ellipse():RadiusX := "value/100 * width" oClip:Value := 25 oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
18 |
What InverseClip does
PROCEDURE OnDrag(oGauge,DragInfo) /*Me.Layers(0).Clip.Value = Me.FormatABC("(value + B) MIN 0 MAX 100", Me.Layers(0).UserData, DragInfo.DeltaX )*/ RETURN PROCEDURE OnDragStart(oGauge,DragInfo,Cancel) /*DragInfo.Debug= 287*/ LOCAL oLayer oLayer := oGauge:Layers:Item(0) oLayer:UserData := oLayer:Clip:Value() RETURN PROCEDURE OnMouseWheel(oGauge,Delta) oGauge:Layers:Item(0):Clip():Value := oGauge:FormatABC("(value + B) MIN 0 MAX 100",oGauge:Layers:Item(0):Clip():Value(),Delta) RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oClip LOCAL oClipRoundRectangle 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:Drag := {|DragInfo| OnDrag(oGauge,DragInfo)} /*Notifies that the user drags the layer.*/ oGauge:DragStart := {|DragInfo,Cancel| OnDragStart(oGauge,DragInfo,Cancel)} /*Occurs once the user starts dragging a layer.*/ oGauge:MouseWheel := {|Delta| OnMouseWheel(oGauge,Delta)} /*Occurs when the mouse wheel moves while the control has focus*/ oGauge:Layers():Count := 1 oLayer := oGauge:Layers:Item(0) oLayer:Left := "(width-128)/2" oLayer:Top := "(height-128)/2" oLayer:Height := Transform(128,"") oLayer:Width := Transform(128,"") oLayer:Background():Color():SetProperty("Value",AutomationTranslateColor( GraMakeRGBColor ( { 0,255,0 } ) , .F. )) oClip := oLayer:Clip() oClipRoundRectangle := oClip:RoundRectangle() oClipRoundRectangle:Width := "value/100 * width" oClipRoundRectangle:RoundRadiusX := "width/8" oClipRoundRectangle:RoundRadiusY := "height/8" oClipRoundRectangle:InverseClip := .T. oClip:Value := 50 oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
17 |
How do I clip as rectangle (round), from left to right
PROCEDURE OnDrag(oGauge,DragInfo) /*Me.Layers(0).Clip.Value = Me.FormatABC("(value + B) MIN 0 MAX 100", Me.Layers(0).UserData, DragInfo.DeltaX )*/ RETURN PROCEDURE OnDragStart(oGauge,DragInfo,Cancel) /*DragInfo.Debug= 287*/ LOCAL oLayer oLayer := oGauge:Layers:Item(0) oLayer:UserData := oLayer:Clip:Value() RETURN PROCEDURE OnMouseWheel(oGauge,Delta) oGauge:Layers:Item(0):Clip():Value := oGauge:FormatABC("(value + B) MIN 0 MAX 100",oGauge:Layers:Item(0):Clip():Value(),Delta) RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oClip LOCAL oClipRoundRectangle 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:Drag := {|DragInfo| OnDrag(oGauge,DragInfo)} /*Notifies that the user drags the layer.*/ oGauge:DragStart := {|DragInfo,Cancel| OnDragStart(oGauge,DragInfo,Cancel)} /*Occurs once the user starts dragging a layer.*/ oGauge:MouseWheel := {|Delta| OnMouseWheel(oGauge,Delta)} /*Occurs when the mouse wheel moves while the control has focus*/ oGauge:Layers():Count := 1 oLayer := oGauge:Layers:Item(0) oLayer:Left := "(width-128)/2" oLayer:Top := "(height-128)/2" oLayer:Height := Transform(128,"") oLayer:Width := Transform(128,"") oLayer:Background():Color():SetProperty("Value",AutomationTranslateColor( GraMakeRGBColor ( { 0,255,0 } ) , .F. )) oClip := oLayer:Clip() oClipRoundRectangle := oClip:RoundRectangle() oClipRoundRectangle:Width := "value/100 * width" oClipRoundRectangle:RoundRadiusX := "width/8" oClipRoundRectangle:RoundRadiusY := "height/8" oClip:Value := 50 oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
16 |
How do I clip as rectangle, from bottom to top
PROCEDURE OnDrag(oGauge,DragInfo) /*Me.Layers(0).Clip.Value = Me.FormatABC("(value + B) MIN 0 MAX 100", Me.Layers(0).UserData, DragInfo.DeltaY )*/ RETURN PROCEDURE OnDragStart(oGauge,DragInfo,Cancel) /*DragInfo.Debug= 287*/ LOCAL oLayer oLayer := oGauge:Layers:Item(0) oLayer:UserData := oLayer:Clip:Value() RETURN PROCEDURE OnMouseWheel(oGauge,Delta) oGauge:Layers:Item(0):Clip():Value := oGauge:FormatABC("(value + B) MIN 0 MAX 100",oGauge:Layers:Item(0):Clip():Value(),Delta) RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oClip LOCAL oClipRectangle 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:Drag := {|DragInfo| OnDrag(oGauge,DragInfo)} /*Notifies that the user drags the layer.*/ oGauge:DragStart := {|DragInfo,Cancel| OnDragStart(oGauge,DragInfo,Cancel)} /*Occurs once the user starts dragging a layer.*/ oGauge:MouseWheel := {|Delta| OnMouseWheel(oGauge,Delta)} /*Occurs when the mouse wheel moves while the control has focus*/ oGauge:Layers():Count := 1 oLayer := oGauge:Layers:Item(0) oLayer:Background():Picture():Value := "c:\exontrol\images\card.png" oClip := oLayer:Clip() oClipRectangle := oClip:Rectangle() oClipRectangle:Height := "value/100 * height" oClipRectangle:InverseClip := .T. oClip:Value := 50 oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
15 |
How do I clip as rectangle, from top to bottom
PROCEDURE OnDrag(oGauge,DragInfo) /*Me.Layers(0).Clip.Value = Me.FormatABC("(value + B) MIN 0 MAX 100", Me.Layers(0).UserData, DragInfo.DeltaY )*/ RETURN PROCEDURE OnDragStart(oGauge,DragInfo,Cancel) /*DragInfo.Debug= 287*/ LOCAL oLayer oLayer := oGauge:Layers:Item(0) oLayer:UserData := oLayer:Clip:Value() RETURN PROCEDURE OnMouseWheel(oGauge,Delta) oGauge:Layers:Item(0):Clip():Value := oGauge:FormatABC("(value + B) MIN 0 MAX 100",oGauge:Layers:Item(0):Clip():Value(),Delta) RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oClip 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:Drag := {|DragInfo| OnDrag(oGauge,DragInfo)} /*Notifies that the user drags the layer.*/ oGauge:DragStart := {|DragInfo,Cancel| OnDragStart(oGauge,DragInfo,Cancel)} /*Occurs once the user starts dragging a layer.*/ oGauge:MouseWheel := {|Delta| OnMouseWheel(oGauge,Delta)} /*Occurs when the mouse wheel moves while the control has focus*/ oGauge:Layers():Count := 1 oLayer := oGauge:Layers:Item(0) oLayer:Background():Picture():Value := "c:\exontrol\images\card.png" oClip := oLayer:Clip() oClip:Rectangle():Height := "value/100 * height" oClip:Value := 50 oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
14 |
How do I clip as rectangle, from right to left
PROCEDURE OnDrag(oGauge,DragInfo) /*Me.Layers(0).Clip.Value = Me.FormatABC("(value + B) MIN 0 MAX 100", Me.Layers(0).UserData, DragInfo.DeltaX )*/ RETURN PROCEDURE OnDragStart(oGauge,DragInfo,Cancel) /*DragInfo.Debug= 287*/ LOCAL oLayer oLayer := oGauge:Layers:Item(0) oLayer:UserData := oLayer:Clip:Value() RETURN PROCEDURE OnMouseWheel(oGauge,Delta) oGauge:Layers:Item(0):Clip():Value := oGauge:FormatABC("(value + B) MIN 0 MAX 100",oGauge:Layers:Item(0):Clip():Value(),Delta) RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oClip LOCAL oClipRectangle 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:Drag := {|DragInfo| OnDrag(oGauge,DragInfo)} /*Notifies that the user drags the layer.*/ oGauge:DragStart := {|DragInfo,Cancel| OnDragStart(oGauge,DragInfo,Cancel)} /*Occurs once the user starts dragging a layer.*/ oGauge:MouseWheel := {|Delta| OnMouseWheel(oGauge,Delta)} /*Occurs when the mouse wheel moves while the control has focus*/ oGauge:Layers():Count := 1 oLayer := oGauge:Layers:Item(0) oLayer:Background():Picture():Value := "c:\exontrol\images\card.png" oClip := oLayer:Clip() oClipRectangle := oClip:Rectangle() oClipRectangle:Width := "value/100 * width" oClipRectangle:InverseClip := .T. oClip:Value := 50 oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
13 |
How do I clip as rectangle, from left to right
PROCEDURE OnDrag(oGauge,DragInfo) /*Me.Layers(0).Clip.Value = Me.FormatABC("(value + B) MIN 0 MAX 100", Me.Layers(0).UserData, DragInfo.DeltaX )*/ RETURN PROCEDURE OnDragStart(oGauge,DragInfo,Cancel) /*DragInfo.Debug= 287*/ LOCAL oLayer oLayer := oGauge:Layers:Item(0) oLayer:UserData := oLayer:Clip:Value() RETURN PROCEDURE OnMouseWheel(oGauge,Delta) oGauge:Layers:Item(0):Clip():Value := oGauge:FormatABC("(value + B) MIN 0 MAX 100",oGauge:Layers:Item(0):Clip():Value(),Delta) RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oClip 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:Drag := {|DragInfo| OnDrag(oGauge,DragInfo)} /*Notifies that the user drags the layer.*/ oGauge:DragStart := {|DragInfo,Cancel| OnDragStart(oGauge,DragInfo,Cancel)} /*Occurs once the user starts dragging a layer.*/ oGauge:MouseWheel := {|Delta| OnMouseWheel(oGauge,Delta)} /*Occurs when the mouse wheel moves while the control has focus*/ oGauge:Layers():Count := 1 oLayer := oGauge:Layers:Item(0) oLayer:Background():Picture():Value := "c:\exontrol\images\card.png" oClip := oLayer:Clip() oClip:Rectangle():Width := "value/100 * width" oClip:Value := 50 oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
12 |
How can I associate a value to rotation angle
PROCEDURE OnChange(oGauge,Layer) oGauge:SetProperty("Caption",0/*exLayerCaption*/,oGauge:FormatABC("`Value: <b>` + (value format ``) ",oGauge:Layers:Item(0):Value())) RETURN PROCEDURE OnDragStart(oGauge,DragInfo,Cancel) /*DragInfo.Debug = 483*/ RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oPicture 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:Change := {|Layer| OnChange(oGauge,Layer)} /*Occurs when the layer's value is changed.*/ oGauge:DragStart := {|DragInfo,Cancel| OnDragStart(oGauge,DragInfo,Cancel)} /*Occurs once the user starts dragging a layer.*/ oLayer := oGauge:Layers():Add("back") oLayer:RotateType := 2/*exRotateBilinearInterpolation*/ oLayer:Left := "(width-512)/2" oLayer:Top := "(height-512)/2" oLayer:Height := Transform(512,"") oLayer:Width := Transform(512,"") oPicture := oLayer:Background():Picture() oPicture:Value := "c:\exontrol\images\card.png" oPicture:Left := "(width-pwidth)/2" oPicture:Top := "(height-pheight)/2" oPicture:Width := "pwidth" oPicture:Height := "pheight" oLayer:OnDrag := 2/*exDoRotate*/ oLayer:DefaultRotateAngle := 45 oLayer:RotateCenterY := "lheight/2 + 32" oLayer:RotateCenterX := "lwidth/2 + 32" oLayer:RotateAngleToValue := "value/360 * 100" oLayer:ValueToRotateAngle := "value / 100 * 360" oLayer:Value := 50 oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
11 |
How can I associate a value to vertical offset
PROCEDURE OnChange(oGauge,Layer) oGauge:SetProperty("Caption",0/*exLayerCaption*/,oGauge:FormatABC("`Value: <b>` + (value format ``)",oGauge:Layers:Item(0):Value())) RETURN PROCEDURE OnDragStart(oGauge,DragInfo,Cancel) /*DragInfo.Debug = 287*/ RETURN #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:Change := {|Layer| OnChange(oGauge,Layer)} /*Occurs when the layer's value is changed.*/ oGauge:DragStart := {|DragInfo,Cancel| OnDragStart(oGauge,DragInfo,Cancel)} /*Occurs once the user starts dragging a layer.*/ oLayer := oGauge:Layers():Add("back") oLayer:Background():Picture():Value := "c:\exontrol\images\card.png" oLayer:OnDrag := 1/*exDoMove*/ oLayer:DefaultOffsetY := -100 oLayer:OffsetYValid := "value MIN 0 MAX 200" oLayer:OffsetXValid := Transform(0,"") oLayer:OffsetToValue := "offsety /200 * 100" oLayer:ValueToOffsetY := "value / 100 * 200" oLayer:Value := 50 oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
10 |
How can I associate a value to horizontal offset
PROCEDURE OnChange(oGauge,Layer) oGauge:SetProperty("Caption",0/*exLayerCaption*/,oGauge:FormatABC("`Value: <b>` + (value format ``)",oGauge:Layers:Item(0):Value())) RETURN PROCEDURE OnDragStart(oGauge,DragInfo,Cancel) /*DragInfo.Debug = 287*/ RETURN #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:Change := {|Layer| OnChange(oGauge,Layer)} /*Occurs when the layer's value is changed.*/ oGauge:DragStart := {|DragInfo,Cancel| OnDragStart(oGauge,DragInfo,Cancel)} /*Occurs once the user starts dragging a layer.*/ oLayer := oGauge:Layers():Add("back") oLayer:Background():Picture():Value := "c:\exontrol\images\card.png" oLayer:OnDrag := 1/*exDoMove*/ oLayer:DefaultOffsetX := -100 oLayer:OffsetXValid := "value MIN 0 MAX 200" oLayer:OffsetYValid := Transform(0,"") oLayer:OffsetToValue := "offsetx /200 * 100" oLayer:ValueToOffsetX := "value / 100 * 200" oLayer:Value := 50 oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
9 |
How can I display the current angle
PROCEDURE OnChange(oGauge,Layer) oGauge:SetProperty("Caption",0/*exLayerCaption*/,oGauge:FormatABC("`Angle: <b>` + (value format ``) + `°`",oGauge:Layers:Item(0):RotateAngle())) RETURN PROCEDURE OnDragStart(oGauge,DragInfo,Cancel) /*DragInfo.Debug = 483*/ RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oPicture 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:Change := {|Layer| OnChange(oGauge,Layer)} /*Occurs when the layer's value is changed.*/ oGauge:DragStart := {|DragInfo,Cancel| OnDragStart(oGauge,DragInfo,Cancel)} /*Occurs once the user starts dragging a layer.*/ oLayer := oGauge:Layers():Add("back") oLayer:RotateType := 2/*exRotateBilinearInterpolation*/ oLayer:Left := "(width-512)/2" oLayer:Top := "(height-512)/2" oLayer:Height := Transform(512,"") oLayer:Width := Transform(512,"") oPicture := oLayer:Background():Picture() oPicture:Value := "c:\exontrol\images\card.png" oPicture:Left := "(width-pwidth)/2" oPicture:Top := "(height-pheight)/2" oPicture:Width := "pwidth" oPicture:Height := "pheight" oLayer:OnDrag := 2/*exDoRotate*/ oLayer:RotateAngleValid := "(value > 180 ? value - 360 : value) MIN 15 MAX 65" oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
8 |
How can I limit the rotation angle
PROCEDURE OnChange(oGauge,Layer) oGauge:SetProperty("Caption",0/*exLayerCaption*/,oGauge:FormatABC("`Angle: <b>` + (value format ``) + `°`",oGauge:Layers:Item(0):RotateAngle())) RETURN PROCEDURE OnDragStart(oGauge,DragInfo,Cancel) /*DragInfo.Debug = 483*/ RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oPicture 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:Change := {|Layer| OnChange(oGauge,Layer)} /*Occurs when the layer's value is changed.*/ oGauge:DragStart := {|DragInfo,Cancel| OnDragStart(oGauge,DragInfo,Cancel)} /*Occurs once the user starts dragging a layer.*/ oLayer := oGauge:Layers():Add("back") oLayer:RotateType := 2/*exRotateBilinearInterpolation*/ oLayer:Left := "(width-512)/2" oLayer:Top := "(height-512)/2" oLayer:Height := Transform(512,"") oLayer:Width := Transform(512,"") oPicture := oLayer:Background():Picture() oPicture:Value := "c:\exontrol\images\card.png" oPicture:Left := "(width-pwidth)/2" oPicture:Top := "(height-pheight)/2" oPicture:Width := "pwidth" oPicture:Height := "pheight" oLayer:OnDrag := 2/*exDoRotate*/ oLayer:RotateAngleValid := "(value > 180 ? value - 360 : value) MIN 15 MAX 65" oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
7 |
Can I specify a different center while rotating
PROCEDURE OnDragStart(oGauge,DragInfo,Cancel) /*DragInfo.Debug = 483*/ RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oPicture 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:DragStart := {|DragInfo,Cancel| OnDragStart(oGauge,DragInfo,Cancel)} /*Occurs once the user starts dragging a layer.*/ oLayer := oGauge:Layers():Add("back") oLayer:RotateType := 2/*exRotateBilinearInterpolation*/ oLayer:Left := "(width-512)/2" oLayer:Top := "(height-512)/2" oLayer:Height := Transform(512,"") oLayer:Width := Transform(512,"") oPicture := oLayer:Background():Picture() oPicture:Value := "c:\exontrol\images\card.png" oPicture:Left := "(width-pwidth)/2" oPicture:Top := "(height-pheight)/2" oPicture:Width := "pwidth" oPicture:Height := "pheight" oLayer:OnDrag := 2/*exDoRotate*/ oLayer:RotateAngle := -45 oLayer:RotateCenterY := "lheight/2 + 32" oLayer:RotateCenterX := "lwidth/2 + 32" oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
6 |
How can I rotate a layer, without cutting off the picture
PROCEDURE OnDragStart(oGauge,DragInfo,Cancel) /*DragInfo.Debug = 483*/ RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oPicture 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:DragStart := {|DragInfo,Cancel| OnDragStart(oGauge,DragInfo,Cancel)} /*Occurs once the user starts dragging a layer.*/ oLayer := oGauge:Layers():Add("back") oLayer:Left := "(width-512)/2" oLayer:Top := "(height-512)/2" oLayer:Height := Transform(512,"") oLayer:Width := Transform(512,"") oPicture := oLayer:Background():Picture() oPicture:Value := "c:\exontrol\images\card.png" oPicture:Left := "(width-pwidth)/2" oPicture:Top := "(height-pheight)/2" oPicture:Width := "pwidth" oPicture:Height := "pheight" oLayer:OnDrag := 2/*exDoRotate*/ oLayer:RotateAngle := -45 oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
5 |
How can I rotate a layer
PROCEDURE OnDragStart(oGauge,DragInfo,Cancel) /*DragInfo.Debug = 483*/ RETURN #include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oGauge LOCAL oPicture 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:DragStart := {|DragInfo,Cancel| OnDragStart(oGauge,DragInfo,Cancel)} /*Occurs once the user starts dragging a layer.*/ oLayer := oGauge:Layers():Add("back") oPicture := oLayer:Background():Picture() oPicture:Value := "c:\exontrol\images\card.png" oPicture:Width := "pwidth" oPicture:Height := "pheight" oLayer:OnDrag := 2/*exDoRotate*/ oLayer:RotateAngle := 45 oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
4 |
Is there any way to debug the layer while moving
|
3 |
How do I specify where to move the layer, while dragging
#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} ) oLayer := oGauge:Layers():Add("back") oLayer:Background():Picture():Value := "c:\exontrol\images\card.png" oLayer:OnDrag := 1/*exDoMove*/ oLayer:OffsetXValid := "int(value / 64) * 64" oLayer:OffsetYValid := "int(value / 64) * 64" oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN |
2 |
How can I add layers to the control
|
1 |
How can I add layers to the control
|