Jump to content

Ekrana Gui Olmadan Saydam Yazı Yazdırmak!


blue_life
 Share

Recommended Posts

Bir arkadaşımız özelden saydam yazı yazırma hakkında istekte bulunmuştu.
Misal katılımsız bir çalışmadan sonra, bazı arkadaşlar ekranda yazı yazdırıyor veyahut saydam resim çıkartıyor.
Bu yüzden bu konuyu açtım. Kısaca çok basit örneklerle bunu nasıl yapabileceğinizi göstermek istiyorum.

Ilk olarak ekrana bir yazı yazdıralım.
[img]http://i.imgur.com/XDIZX.png[/img]

[codebox]$hGUI = GUICreate("BlueLife Test", 400, 70, -1, -1, 0x80000000, 0x00000080 + 0x00000008 + 0x00080000)
GUISetBkColor(0xABCDEF)
GUICtrlCreateLabel("Kurulum tamamlandı!" & @CRLF & " .:: BlueLife ::.", 0, 0,400,70,1)
GUICtrlSetFont(-1, 24, 800, 2, "Tahoma")
GUICtrlSetColor(-1, 0x000080)
__WinAPI_SetLayeredWindowAttributes($hGUI, 0xABCDEF, 250)
GUISetState(@SW_SHOW,$hGUI)
Sleep(5000) ;5 Saniye bekleme

Func __WinAPI_SetLayeredWindowAttributes($hWnd, $i_transcolor, $Transparency = 255, $dwFlags = 0x03, $isColorRef = False)
If $dwFlags = Default Or $dwFlags = "" Or $dwFlags < 0 Then $dwFlags = 0x03
If Not $isColorRef Then
$i_transcolor = Hex(String($i_transcolor), 6)
$i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
EndIf
Local $aResult = DllCall("user32.dll", "bool", "SetLayeredWindowAttributes", "hwnd", $hWnd, "dword", $i_transcolor, "byte", $Transparency, "dword", $dwFlags)
If @error Then Return SetError(@error, @extended, False)
Return $aResult[0]
EndFunc ;==>_WinAPI_SetLayeredWindowAttributes[/codebox]

Örnekte göreceğiniz üzere güimiz için bir arkaplan regi belirlemişiz. [b]GUISetBkColor(0xABCDEF)[/b]
Sonra _[b]_WinAPI_SetLayeredWindowAttributes[/b]($hGUI, 0xABCDEF, 250) satırı ile bu belirlediğimiz renkleri ekrandan sildirmişiz.
Bu arada ilgili udf WINAPI.au3 içinde mevcut!

Aynı şekilde guimiz içinde bir resim oluşturup, resimde görünmesini istemediğimiz kısımları ilgili satır ile ekranda görünmemesini sağlayabiliriz.
Hadi bunun içinde biraz değiştirererk bir örnek verelim.

[codebox]Local $File = @ProgramFilesDir & "\AutoIt3\Examples\GUI\merlin.gif"
If FileExists($File) = 0 Then
MsgBox(16,"",$File & " dosyası bulunamadı!")
Exit
EndIf

$hGUI = GUICreate("BlueLife Test", 68, 71, -1, -1, 0x80000000, 0x00000080 + 0x00000008 + 0x00080000)
GUISetBkColor(0xFFFFFF)
GUICtrlCreatePic($File,0,0,68,71)
__WinAPI_SetLayeredWindowAttributes($hGUI, 0xFFFFFF, 250)
GUISetState(@SW_SHOW,$hGUI)
Sleep(5000) ;5 Saniye bekleme

Func __WinAPI_SetLayeredWindowAttributes($hWnd, $i_transcolor, $Transparency = 255, $dwFlags = 0x03, $isColorRef = False)
If $dwFlags = Default Or $dwFlags = "" Or $dwFlags < 0 Then $dwFlags = 0x03
If Not $isColorRef Then
$i_transcolor = Hex(String($i_transcolor), 6)
$i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
EndIf
Local $aResult = DllCall("user32.dll", "bool", "SetLayeredWindowAttributes", "hwnd", $hWnd, "dword", $i_transcolor, "byte", $Transparency, "dword", $dwFlags)
If @error Then Return SetError(@error, @extended, False)
Return $aResult[0]
EndFunc ;==>_WinAPI_SetLayeredWindowAttributes[/codebox]

Istek üzerine, trayda yanında görülecek bir resim örneği.
[codebox]Local $File = @DesktopDir & "\tnctr_logo.bmp"
If FileExists($File) = 0 Then
InetGet("http://bluelife.zxq.net/Files/Picture/tnctr_logo.bmp", $File,0,0)
EndIf

Local $ResW = 324
Local $ResH = 91
Local $Gui_X = @DesktopWidth - ($ResW + 5)
$Gui_Y = @DesktopHeight - ($ResH + 5)
Local $Bclor = 0x00ff1e

Local $Shell_Pos = WinGetHandle("[CLASS:Shell_TrayWnd]") ;CLASS:Progman
If $Shell_Pos <> "" Then
$Shell_Pos = WinGetPos($Shell_Pos)

If UBound($Shell_Pos) = 4 Then
If $Shell_Pos[1] < 1 Then
If $Shell_Pos[0] > 0 Then $Gui_X = @DesktopWidth - ($Shell_Pos[2] + ($ResW + 5))
Else
If $Shell_Pos[0] < 1 Then $Gui_Y = @DesktopHeight - ($Shell_Pos[3] + ($ResH + 5))
EndIf
EndIf

EndIf

Local $hGUI = GUICreate("BlueLife Test", $ResW, $ResH, $Gui_X, $Gui_Y, 0x80000000, 0x00000080 + 0x00000008 + 0x00080000)
GUISetBkColor($Bclor)
If GUICtrlCreatePic($File,0,0,$ResW,$ResH) = 0 Then
MsgBox(16,"",$File & " dosyası bulunamadı!")
Exit
EndIf

__WinAPI_SetLayeredWindowAttributes($hGUI, $Bclor,5)
GUISetState(@SW_SHOW,$hGUI)
For $I = 10 To 250 Step 5
__WinAPI_SetLayeredWindowAttributes($hGUI, $Bclor,$I)
Sleep(25)
Next


Sleep(5000) ;5 Saniye bekleme

For $I = 250 To 5 Step -5
__WinAPI_SetLayeredWindowAttributes($hGUI, $Bclor,$I)
Sleep(10)
Next

Func __WinAPI_SetLayeredWindowAttributes($hWnd, $i_transcolor, $Transparency = 255, $dwFlags = 0x03, $isColorRef = False)
If $dwFlags = Default Or $dwFlags = "" Or $dwFlags < 0 Then $dwFlags = 0x03
If Not $isColorRef Then
$i_transcolor = Hex(String($i_transcolor), 6)
$i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
EndIf
Local $aResult = DllCall("user32.dll", "bool", "SetLayeredWindowAttributes", "hwnd", $hWnd, "dword", $i_transcolor, "byte", $Transparency, "dword", $dwFlags)
If @error Then Return SetError(@error, @extended, False)
Return $aResult[0]
EndFunc ;==>_WinAPI_SetLayeredWindowAttributes[/codebox]

Umarım konuyu anlamıştırsınız... Kolay gelsin arkadaşlar...

Edit: Eklediğim resim saydam deyil ama yazıyı yazdırıdığınızda kenardaki ilgili renler ekranda çıkmaz.
Sadece yazı çıkar... Edited by blue_life
Link to comment
Share on other sites

  • 1 ay sonra...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...