Jump to content

GDI and Picture


Recommended Posts

I want a GUI window to look like the uploaded picture with another picture on top of it. I was just wondering if there was any way to clear up the white space around this image or any way to duplicate the results.

post-45252-1243796516_thumb.png

Weather.au3

Edited by dantay9
Link to comment
Share on other sites

try this:

#include <GdiPlus.au3>
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
Global $nWidth = 400, $nHeight = 500
Global $aPoints[4][8] =[[30, -10, 5, 5, -10, 30, 0, 0], _
                        [$nWidth-30, -10, $nWidth-5, 5, $nWidth+10, 30, $nWidth, 0], _
                        [30, $nHeight+10, 5, $nHeight-5, -10, $nHeight-30, 0, $nHeight], _
                        [$nWidth-30, $nHeight+10, $nWidth-5, $nHeight-5, $nWidth+10, $nHeight-30, $nWidth, $nHeight]]

$Gui = GUICreate('Pic', $nWidth, $nHeight, -1, -1)
GUISetBkColor(0x0000FF)
GUISetState()
_GDIPlus_Startup()
Global $hGraphic = _GDIPlus_GraphicsCreateFromHWND($Gui)
Global $hBitmap = _GDIPlus_BitmapCreateFromGraphics($nWidth, $nHeight, $hGraphic)
Global $oBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
;~ _GDIPlus_GraphicsClear($oBuffer, 0xFF0000FF)
_GDIPlus_GraphicsSetSmoothingMode($oBuffer, 4)
$hBrush = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)

GUIRegisterMsg(0xF, "MY_PAINT")
GUIRegisterMsg(0x85, "MY_PAINT")

_DrawAngle($aPoints, 0)
_DrawAngle($aPoints, 1)
_DrawAngle($aPoints, 2)
_DrawAngle($aPoints, 3)
Sleep(100)

_GDIPlus_GraphicsDrawImage($hGraphic, $hBitmap, 0, 0)


Do
    Sleep(10)
Until GUIGetMsg() = $GUI_EVENT_CLOSE


Func _DrawAngle($aPoints, $nIndex)

    Local $nPoints[5][2]
       $nPoints[0][0] = 4
       $nPoints[1][0] = $aPoints[$nIndex][0]
       $nPoints[1][1] = $aPoints[$nIndex][1]
       $nPoints[2][0] = $aPoints[$nIndex][2]
       $nPoints[2][1] = $aPoints[$nIndex][3]
       $nPoints[3][0] = $aPoints[$nIndex][4]
       $nPoints[3][1] = $aPoints[$nIndex][5]
       $nPoints[4][0] = $aPoints[$nIndex][6]
       $nPoints[4][1] = $aPoints[$nIndex][7]
       _GDIPlus_GraphicsFillClosedCurve($oBuffer, $nPoints, $hBrush)
EndFunc

Func MY_PAINT($hWnd, $msg, $wParam, $lParam)
    _GDIPlus_GraphicsDrawImage($hGraphic, $hBitmap, 0, 0)
    Return $GUI_RUNDEFMSG
EndFunc ;==>MY_PAINT
Edited by oMBRa
Link to comment
Share on other sites

That isn't exactly what I want. I had everything I needed except that white ring around the weather picture needed to go away. How do I get rid of the ring around the weather picture?

lol Sorry I have missread, basically you want a gui with a blue background?
Link to comment
Share on other sites

I want a gui with a blue background. Then I also want the pictures on top of it to not have that white ring. If you run the code from my first post, you will see that the weather picture has a white ring around it. I don't like that. Can you get rid of the white ring around the weather picture?

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...