Sign in to follow this  
Followers 0
dazza

Transparency

3 posts in this topic

Here's one for the experts...

I need to write an application that sits ontop of another. This other shows a map. I need Autoit to have a floating toolbox that allows me to draw lines and drop graphics on the map below. Obviously, these lines and graphics are not actually on the map; they are just shown on top.

I would rather use AutoIt than VBE although VBE does has a transparency/opacity property built into it's objects.

Can AutoIt do this?

Many thanks. :)

Share this post


Link to post
Share on other sites



Here's one for the experts...

I need to write an application that sits ontop of another. This other shows a map. I need Autoit to have a floating toolbox that allows me to draw lines and drop graphics on the map below. Obviously, these lines and graphics are not actually on the map; they are just shown on top.

I would rather use AutoIt than VBE although VBE does has a transparency/opacity property built into it's objects.

Can AutoIt do this?

Many thanks. :)

Here is an example to get you started. It has a strip at the top and bottom to hold controls and a transparent are in the middle for your lines to go over whatever windo is behind. It uses a simple bitmap which I have included, though you can make your own of course.

Run the script and press F7 to draw a single line.

#include <GUIConstants.au3>
$gui=GUICreate("", 300, 470, 10, 10,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_TOPMOST,$WS_EX_TOOLWINDOW))
Global $pic1 = GUICtrlCreatePic("sample.bmp",0,22,0,0)
$pic_hWnd = ControlGetHandle($gui,"",$pic1)
global $pic_hdc = DLLCall("user32.dll","int","GetDC","hwnd",$pic_hWnd)
guictrlcreatelabel("Some label",100,455,120,21)

$Button1 = GUICtrlCreateButton("Exit",10,0,100,20)
;button won't work if it's over the transparent area although it will show

guisetstate()

hotkeyset("{F7}","ALine")

while 1
    if guigetmsg() = $Button1 Then
        exit
    EndIf
    
WEnd


Func ALine()
Local $lineThick = 2, $lineCol = 0xFF0000

$pen = DllCall("gdi32.dll", "int", "CreatePen", "int", 0, "int", $lineThick, "int", $lineCol)
DllCall("gdi32.dll", "int", "SelectObject", "int", $pic_hdc[0], "int", $pen[0])
DllCall("GDI32.dll", "int", "MoveToEx", "hwnd", $pic_hdc[0], "int", 20, "int", 30, "int", 0)
DllCall("GDI32.dll", "int", "LineTo", "hwnd", $pic_hdc[0], "int", 200, "int", 200)
DLLCall("gdi32.dll","int","DeleteObject","int",$pen[0])
    
EndFunc

Func OnAutoItExit()
    if $pic_hdc[0] <> 0 then
DllCall("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $pic_hdc[0])
EndIf

endfunc


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0