Jump to content

Png Form Örneği


selamdostum
 Share

Recommended Posts

[img]http://www.karanliksehir.com/programlar/pngform.JPG[/img]

Kodlar

[code]
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <WinAPI.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
Global Const $AC_SRC_ALPHA = 1
_GDIPlus_Startup()
$hImage = _GDIPlus_ImageLoadFromFile("X-Virus.png")
$width = _GDIPlus_ImageGetWidth($hImage)
$height = _GDIPlus_ImageGetHeight($hImage)
$gui = GUICreate("", $width, $height, -1, -1, $WS_POPUP, $WS_EX_LAYERED, GUICreate(""))
SetBitmap($gui, $hImage, 255)
;~ WinSetOnTop($gui, "", 1) << Burayı aktifleştiriseniz her zaman üstte kalacaktır.

GUISetState(@SW_SHOW,$gui)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
GUISetState(@SW_SHOW)


Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam)
If ($hWnd = $gui) And ($iMsg = $WM_NCHITTEST) Then Return $HTCAPTION
EndFunc ;==>WM_NCHITTEST
Func SetBitmap($hGUI, $hImage, $iOpacity)
Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
$hScrDC = _WinAPI_GetDC(0)
$hMemDC = _WinAPI_CreateCompatibleDC($hScrDC)
$hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
$hOld = _WinAPI_SelectObject($hMemDC, $hBitmap)
$tSize = DllStructCreate($tagSIZE)
$pSize = DllStructGetPtr($tSize)
DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage))
DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage))
$tSource = DllStructCreate($tagPOINT)
$pSource = DllStructGetPtr($tSource)
$tBlend = DllStructCreate($tagBLENDFUNCTION)
$pBlend = DllStructGetPtr($tBlend)
DllStructSetData($tBlend, "Alpha", $iOpacity)
DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA)
_WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA)
_WinAPI_ReleaseDC(0, $hScrDC)
_WinAPI_SelectObject($hMemDC, $hOld)
_WinAPI_DeleteObject($hBitmap)
_WinAPI_DeleteDC($hMemDC)
EndFunc
[/code]

Png resmi

[img]http://www.karanliksehir.com/programlar/X-Virus.png[/img]

Yada hepsini hazır olarak indir

[code]http://www.karanliksehir.com/programlar/X-VirusPNGForm.zip[/code] Edited by selamdostum
Link to comment
Share on other sites

merhaba @selamdostum
birde burdaki örneklere bak
[code]#include <GDIPlus.au3>
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
Dim $_GuiDelete

$_PngUrl = 'http://www.uclouvain.be/cps/ucl/doc/adcp/images/Google_logo.png'
$_PngPath = @TempDir & "\temp1.png"
If Not FileExists ( $_PngPath ) Then InetGet ( $_PngUrl, $_PngPath, 1 )
_GDIPlus_Startup ( )
$_Image = _GDIPlus_ImageLoadFromFile ( $_PngPath )
$_Width = _GDIPlus_ImageGetWidth ( $_Image )
$_Height = _GDIPlus_ImageGetHeight ( $_Image )
$_Ratio = $_Width / $_Height

; example 1
For $_Width = 200 To @DesktopWidth/2 Step 10
$_Gui = GUICreate ( "gui", $_Width , $_Width / $_Ratio, -1, -1, -1, BitOR ( $WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW ) )
$_Image = _ImageResize ( $_PngPath, $_Width, $_Width / $_Ratio )
_SetBitMap ( $_Gui, $_Image, 255, $_Width, $_Width / $_Ratio )
GUISetState ( @SW_SHOW )
Next

Sleep ( 2000 )
_GDIPlus_GraphicsDispose ( $_Image )
_GDIPlus_Shutdown ( )
While Not $_GuiDelete
$_GuiDelete= Not GUIDelete ( WinGetHandle ( "gui" ) )
WEnd
Sleep ( 2000 )

; example 2
$_PngUrl = 'http://www.pc-infopratique.com/images/banque/dell_logo_circle_2.png'
$_PngPath = @TempDir & "\temp2.png"
If Not FileExists ( $_PngPath ) Then InetGet ( $_PngUrl, $_PngPath, 1 )
_GDIPlus_Startup ( )
$_Image = _GDIPlus_ImageLoadFromFile ( $_PngPath )
$_Width = _GDIPlus_ImageGetWidth ( $_Image )
$_Height = _GDIPlus_ImageGetHeight ( $_Image )
$_Ratio = $_Width / $_Height

For $_Width = 50 To @DesktopWidth/2 Step 10
$_Gui = GUICreate ( "gui", $_Width , $_Width / $_Ratio, -1, -1, -1, BitOR ( $WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW ) )
$_Image = _ImageResize ( $_PngPath, $_Width, $_Height )
_SetBitMap ( $_Gui, $_Image, 255, $_Width, $_Height )
GUISetState ( @SW_SHOW )
Next

Sleep ( 2000 )
_GDIPlus_GraphicsDispose ( $_Image )
_GDIPlus_Shutdown ( )
$_GuiDelete= Not $_GuiDelete
While Not $_GuiDelete
$_GuiDelete= Not GUIDelete ( WinGetHandle ( "gui" ) )
WEnd
Sleep ( 2000 )

; example 3
$_PngUrl = 'http://www.blogandcom.com/wp-content/uploads/2009/09/twitter_logo-1024x378.png'
$_PngPath = @TempDir & "\temp3.png"
If Not FileExists ( $_PngPath ) Then InetGet ( $_PngUrl, $_PngPath, 1 )
_GDIPlus_Startup ( )
$_Image = _GDIPlus_ImageLoadFromFile ( $_PngPath )
$_Width = _GDIPlus_ImageGetWidth ( $_Image )
$_Height = _GDIPlus_ImageGetHeight ( $_Image )
$_Ratio = $_Width / $_Height

For $_Width = 300 To @DesktopWidth/1.3 Step 10
$_Gui = GUICreate ( "", $_Width , $_Width / $_Ratio, -1, -1, -1, BitOR ( $WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW ) )
$_Image = _ImageResize ( $_PngPath, $_Width, $_Height )
_SetBitMap ( $_Gui, $_Image, 255, $_Width, $_Width / $_Ratio )
GUISetState ( @SW_SHOW )
Next

Sleep ( 2000 )
_GDIPlus_GraphicsDispose ( $_Image )
_GDIPlus_Shutdown ( )
$_GuiDelete= Not $_GuiDelete
While Not $_GuiDelete
$_GuiDelete= Not GUIDelete ( WinGetHandle ( "gui" ) )
WEnd
Exit

Func _SetBitmap ( $hGUI, $hImage, $iOpacity, $n_width, $n_height )
Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend
$hScrDC = _WinAPI_GetDC ( 0 )
$hMemDC = _WinAPI_CreateCompatibleDC ( $hScrDC )
$hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap ( $hImage )
$hOld = _WinAPI_SelectObject ( $hMemDC, $hBitmap )
$tSize = DllStructCreate ( $tagSIZE )
$pSize = DllStructGetPtr ( $tSize )
DllStructSetData ( $tSize, "X", $n_width )
DllStructSetData ( $tSize, "Y", $n_height )
$tSource = DllStructCreate ( $tagPOINT )
$pSource = DllStructGetPtr ( $tSource )
$tBlend = DllStructCreate ( $tagBLENDFUNCTION )
$pBlend = DllStructGetPtr ( $tBlend )
DllStructSetData ( $tBlend, "Alpha", $iOpacity )
DllStructSetData ( $tBlend, "Format", 1 )
_WinAPI_UpdateLayeredWindow ( $hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA )
_WinAPI_ReleaseDC ( 0, $hScrDC )
_WinAPI_SelectObject ( $hMemDC, $hOld )
_WinAPI_DeleteObject ( $hBitmap )
_WinAPI_DeleteDC ( $hMemDC )
EndFunc ;==> _SetBitmap ( )

Func _ImageResize ( $sInImage, $newW, $newH, $sOutImage = "" )
Local $oldImage, $GC, $newBmp, $newGC
If $sOutImage = "" Then _GDIPlus_Startup ( )
$oldImage = _GDIPlus_ImageLoadFromFile ( $sInImage )
$GC = _GDIPlus_ImageGetGraphicsContext ( $oldImage )
$newBmp = _GDIPlus_BitmapCreateFromGraphics ( $newW, $newH, $GC )
$newGC = _GDIPlus_ImageGetGraphicsContext ( $newBmp )
_GDIPlus_GraphicsDrawImageRect ( $newGC, $oldImage, 0, 0, $newW, $newH )
_GDIPlus_GraphicsDispose ( $GC )
_GDIPlus_GraphicsDispose ( $newGC )
_GDIPlus_ImageDispose ( $oldImage )
If $sOutImage = "" Then
Return $newBmp
Else
_GDIPlus_ImageSaveToFile ( $newBmp, $sOutImage )
_GDIPlus_BitmapDispose ( $newBmp )
_GDIPlus_Shutdown ( )
Return 1
EndIf
EndFunc ;==> _ImageResize ( )
[/code]
umarım işini görür ve sana fikir verir.

Edited by mesale0077
Link to comment
Share on other sites

[warning][color=#FF0000][b]DİKKAT: Konu Başlığını forum Kurallarına gore yeniden düzenleyiniz. Aksi halde cope tasınacaktır.

[topic=872]Forum Kuralları[/topic] - [ Madde 10-16 ]

Konu düzenlenene kadar yazılan tüm iletiler silinecek, ileti yazanlar uyarı alacaktır.[/b][/color][/warning]

Link to comment
Share on other sites

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...