Jump to content

Search the Community

Showing results for tags 'button gdiplus'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Hey Guys, I need help in creating a function that uses GDI+ to create Metro style buttons, like in Windows 8 Sidebar, i have attached some example below: Earlier I used to design the buttons on photoshop but now I am thinking of doing it through code which would decrease the size of executable, also it would take time once for creating code rather than spending hours on photoshop. Here is the code I made till now, was able to draw only the button without text, as I suck on GDI+ #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Test", 615, 437) $Button1 = CtrlCreateButton("Button1", 48, 72, 100, 20) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func CtrlCreateButton($Text = "", $Left = 0, $Top = 0, $Width = 0, $Height = 0, $BGColor = 0xff00ff, $HoverColor = 0xbbbbbb, $FontSize = 10, $FontColor = 0xff456f, $FontFamily ="Arial", $WorkDir = @TempDir) _GDIPlus_Startup() ;Global $iWidth = 100, $iHeight = 100 ;dimension of the bitmap Local $iStride = 0, $pScan0 = 0, $iPixelFormat = $GDIP_PXF32ARGB ;some bitmap parameters Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $Width, "int", $Height, "int", $iStride, "int", $iPixelFormat, "ptr", $pScan0, "int*", 0) Local $hBitmap = $aResult[6] ;this is the handle of the new empty bitmap Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap) ;create a context to the bitmap handle to do some GDI+ operations ;Global Const $iBgColor = 0xFFDE2697 ;define background color -> ARGB -> 0xFFDE2697 _GDIPlus_GraphicsClear($hContext, $BGColor) ;clear empty bitmap with new color ;$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hContext) ;_GDIPlus_GraphicsDrawStringEx($hContext, $Text, _GDIPlus_FontCreate(_GDIPlus_FontFamilyCreate($FontFamily), $FontSize), _GDIPlus_RectFCreate(), _GDIPlus_StringFormatCreate(), _GDIPlus_BrushCreateSolid($FontColor)) $sFilename = $WorkDir & "\" & Chr(Random(65, 90, 1)) & Chr(Random(65, 90, 1)) & Random(1000000, 999999, 1) _GDIPlus_ImageSaveToFile($hBitmap, $sFilename) GUICtrlCreatePic($sFilename, $Left, $Top, $Width, $Height) _GDIPlus_GraphicsDispose($hContext) _GDIPlus_Shutdown() EndFunc ;==>MetroUICtrlCreateButton Please help me out guys... Thanks in advance
×
×
  • Create New...