script is for vista+ OS (because of AERO environment)

p.s. top left image was drawn with GDI+
#region parts that are not my work: ;JamesBrooks for Vista glass functions: <a href='http://www.autoitscript.com/forum/topic/...lass-four-functions/page__hl__' class='bbc_url' title=''>http://www.autoitscript.com/forum/topic/...lass-four-functions/page__hl__</a> ;Authenticity and Yashied for glow txt on glass: <a href='http://www.autoitscript.com/forum/topic/...extex-to-get-glowing-text-on-a' class='bbc_url' title=''>http://www.autoitscript.com/forum/topic/...extex-to-get-glowing-text-on-a</a> ;Malkey for GDI+ gradient: <a href='http://www.autoitscript.com/forum/topic/75792-a-gdiplus-gradient-line-brush/' class='bbc_url' title=''>http://www.autoitscript.com/forum/topic/75792-a-gdiplus-gradient-line-brush/</a> #endregion #include <FontConstants.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <GDIPlus.au3> OnAutoItExitRegister( "_CleanUp" ) Global $IconSize = 48 Global $width = 300 Global $height = 350 Global $shine1 = 5 Global $shine2 = 5 Global $shine3 = 125 Global $menuFontSize = 16 Global $title = 'Some cool menu' Global $temp_image = @TempDir & '\my_seven_image.bmp' Global $Win_Back_Color = 0x636363;0xC5C5C5;454545 <--- color of lower dark grey line For $i = 1 to Int($IconSize/4.8) ;adding space in front of the title so that it doesn't overlap top left image $title = ' ' & $title Next #region values requires for text shine on glass area Global Const $DTT_TEXTCOLOR = 0x00000001 Global Const $DTT_GLOWSIZE = 0x00000800 Global Const $DTT_COMPOSITED = 0x00002000 If Not IsDeclared("tagDTTOPTS") Then Global Const $tagDTTOPTS = _ "uint Size;uint Flags;uint clrText;uint clrBorder;uint clrShadow;int TextShadowType;" & $tagPOINT & _ ";int BorderSize;int FontPropId;int ColorPropId;int StateId;int ApplyOverlay;int GlowSize;ptr DrawTextCallback;int lParam;" Global $Struct = DllStructCreate("int cxLeftWidth;int cxRightWidth;int cyTopHeight;int cyBottomHeight;") Global $sStruct = DllStructCreate("dword;int;ptr;int") Global $Area[4] = [0, 0, $IconSize-23, 0] #endregion Global $Form1 = GUICreate($title, $width, $height, -1, -1, -1, -1) Global $GlassArea = GUICtrlCreateLabel("", 0, 0, $width, $IconSize-23) ;area that will be filled with glass GUICtrlSetBkColor(-1, 0x000000) Global $DarkGreyArea = GUICtrlCreateGraphic(0, 0, $width, $height-45) ;work area (to add controls in) GUICtrlSetBkColor(-1, 0xC5C5C5) ;with light grey area Global $CloseButton = GUICtrlCreateButton("Close", $width-90, $height-35, 80, 25) Global $hTheme = _WinAPI_OpenThemeData($Form1, "globals") ;required function for label shine in glass area If (@OSVersion <> "WIN_VISTA") OR (@OSVersion <> "WIN_7") Then _Vista_ApplyGlassArea($Form1, $Area, $Win_Back_Color) ;applying glass area to main GUI (area where $GlassArea label is) GUISetState(@SW_SHOW, $Form1) ;creating child GUI with top left image-menu-control Global $iX = 0, $iY = 0, $iWidth = $IconSize, $iHeight = $IconSize Global $controlGui, $HoverImage, $Mask, $FileGUI, $FileMenu, $EditGUI, $EditMenu, $HelpGUI, $HelpMenu, $DownGUI, $DownMenu #region create fake GUIs with each holding a clickable control $ImageState = 1 _CreateFakeGUI($controlGui, 'ControlGUI', 48, 48, -1, -23, 1, $HoverImage) $FileState = 1 _CreateFakeGUI($FileGUI, 'FileGUI', 35, $menuFontSize*2-Round($menuFontSize/1.5), 52, 4, 2, $FileMenu) $EditState = 1 _CreateFakeGUI($EditGUI, 'EditGUI', 35, $menuFontSize*2-Round($menuFontSize/1.5), 92, 4, 2, $EditMenu) $HelpState = 1 _CreateFakeGUI($HelpGUI, 'HelpGUI', 45, $menuFontSize*2-Round($menuFontSize/1.5), 130, 4, 2, $HelpMenu) $DownState = 1 _CreateFakeGUI($DownGUI, 'DownGUI', 20, $menuFontSize*2-Round($menuFontSize/1.5), $width-18, 4, 2, $DownMenu) #endregion #region create context menus ;----------Image Menu------------------------ $ImageDummy = GUICtrlCreateDummy() $ImageContext = GUICtrlCreateContextMenu($ImageDummy) $ImMinimize = GUICtrlCreateMenuItem("Minimize", $ImageContext) $ImMaximize = GUICtrlCreateMenuItem("Maximize", $ImageContext) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateMenuItem("", $ImageContext) $imExit = GUICtrlCreateMenuItem("Exit", $ImageContext) ;----------File Menu------------------------ $FileDummy = GUICtrlCreateDummy() $FileContext = GUICtrlCreateContextMenu($FileDummy) $FileNew = GUICtrlCreateMenu("New", $FileContext) $FileNewProject = GUICtrlCreateMenuItem("Project", $FileNew) $FileNewFile = GUICtrlCreateMenuItem("File", $FileNew) $FileOpen = GUICtrlCreateMenuItem("Open", $FileContext) $FileSave = GUICtrlCreateMenuItem("Save", $FileContext) $FileSaveAs = guictrlcreatemenuitem("Save As...", $FileContext) GUICtrlCreateMenuItem("", $FileContext) $FileExit = guictrlcreatemenuitem("Exit", $FileContext) ;----------Edit Menu------------------------ $EditDummy = GUICtrlCreateDummy() $EditContext = GUICtrlCreateContextMenu($EditDummy) $EditUndo = GUICtrlCreateMenuItem("Undo", $EditContext) $EditRedo = GUICtrlCreateMenuItem("Redo", $EditContext) GUICtrlCreateMenuItem("", $EditContext) $EditCut = GUICtrlCreateMenuItem("Cut", $EditContext) $EditCopy = GUICtrlCreateMenuItem("Copy", $EditContext) $EditPaste = GUICtrlCreateMenuItem("Paste", $EditContext) GUICtrlCreateMenuItem("", $EditContext) $EditPref = GUICtrlCreateMenuItem("Preferences", $EditContext) ;----------Help Menu------------------------ $HelpDummy = GUICtrlCreateDummy() $HelpContext = GUICtrlCreateContextMenu($HelpDummy) $HelpHelp = GUICtrlCreateMenuItem("Help", $HelpContext) GUICtrlCreateMenuItem("", $HelpContext) $HelpAbout = GUICtrlCreateMenuItem("About", $HelpContext) ;----------Down arrow Menu------------------------ $DownDummy = GUICtrlCreateDummy() $DownContext = GUICtrlCreateContextMenu($DownDummy) $DownTab = GUICtrlCreateMenuItem("Tab Groups", $DownContext) $DownTabOther = GUICtrlCreateMenuItem("Tabs from other computers", $DownContext) GUICtrlCreateMenuItem("", $DownContext) $DownTabExample = GUICtrlCreateMenuItem("Example tab", $DownContext) #endregion _Draw_menus() ;drawing all menu items Global $Mask = GUICreate('Mask', $iWidth-2, $iHeight-2, 0, -22, $WS_POPUP, $WS_EX_MDICHILD, $Form1) ;another child window for shade and gloss when moving mouse over image-menu or clicking it GUISetBkColor(0xFFFFFF, $Mask) WinSetTrans($Mask, '', 40) GUISetState(@SW_DISABLE, $Mask) ;still not shown, only disabled GUIRegisterMsg(0xF,"MY_PAINT") While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $HelpAbout MsgBox(48, 'About', 'Cool menus by... sandin' & @CRLF & @CRLF & '07.07.2011', -1, $Form1) Case $ImMinimize WinSetState($Form1, '', @SW_MINIMIZE) Case $GUI_EVENT_CLOSE, $imExit, $CloseButton, $FileExit Exit Case $GlassArea ;moving window when holding glass area that isn't menu dllcall("user32.dll","int","SendMessage","hWnd", $Form1,"int",0xA1,"int", 2,"int", 0) EndSwitch #region detection clicks and hovering above menu items If WinActive($Form1) then ;<-- here's one problem, I need this in order for window not to detect any clicks if you click on another window that is above this one ;but then you can't click on any control even if the window is aside your currently active window. _MenuBehavior($FileGUI, $FileMenu, $FileState, 'File', $FileContext) _MenuBehavior($EditGUI, $EditMenu, $EditState, 'Edit', $EditContext) _MenuBehavior($HelpGUI, $HelpMenu, $HelpState, 'Help', $HelpContext) _MenuBehavior($DownGUI, $DownMenu, $DownState, ChrW(9660), $DownContext) _MenuBehavior($controlGui, $HoverImage, $ImageState, '', $ImageContext) EndIf #endregion WEnd Func _MenuBehavior($WinHWND, $i_MenuItem, ByRef $i_MenuState, $i_Label, $i_ContextMenu);, $i_Shine1, $i_Shine2, $i_Shine3, $i_Color1, $i_Color2) Local $a = GUIGetCursorInfo($WinHWND) Switch $a[4] Case $i_MenuItem If $a[2] = 1 Then If $i_MenuState <> 3 Then $i_MenuState = 3 if ($FileState <> 1) AND ($FileMenu <> $i_MenuItem) then $FileState = 1 _Draw_Menu_ex($FileGUI, 'File', $menuFontSize, $shine3, 0x000000) EndIf if ($EditState <> 1) AND ($EditMenu <> $i_MenuItem) then ;making sure that disable all other menu clicked state (if there are any) $EditState = 1 _Draw_Menu_ex($EditGUI, 'Edit', $menuFontSize, $shine3, 0x000000) EndIf if ($HelpState <> 1) AND ($HelpMenu <> $i_MenuItem) Then $HelpState = 1 _Draw_Menu_ex($HelpGUI, 'Help', $menuFontSize, $shine3, 0x000000) EndIf if ($DownState <> 1) AND ($DownMenu <> $i_MenuItem) Then $DownState = 1 _Draw_Menu_ex($DownGUI, ChrW(9660), $menuFontSize-Round(Sqrt($menuFontSize)), $shine3, 0x555555) EndIf if ($ImageState <> 1) AND ($HoverImage <> $i_MenuItem) Then $ImageState = 1 GUISetState(@SW_HIDE, $Mask) EndIf If $i_MenuItem = $DownMenu then _Draw_Menu_ex($WinHWND, ChrW(9660), $menuFontSize-Round(Sqrt($menuFontSize)), $shine2+2, 0x000099) ElseIf $i_MenuItem = $HoverImage Then GUISetBkColor(0x000000, $Mask) GUISetState(@SW_SHOWNOACTIVATE, $Mask) Else _Draw_Menu_ex($WinHWND, $i_Label, $menuFontSize, $shine1, 0x000099) ;clicked File menu state, drawing average glow, and red color EndIf ShowMenu($WinHWND, $i_MenuItem, $i_ContextMenu) ;showing context menu for File EndIf Else If $i_MenuState <> 2 Then $i_MenuState = 2 If $i_MenuItem = $DownMenu Then _Draw_Menu_ex($WinHWND, '| ' & ChrW(9660) & ' |', $menuFontSize-Round(Sqrt($menuFontSize)), $shine2, 0x555555) ElseIf $i_MenuItem = $HoverImage Then GUISetBkColor(0xFFFFFF, $Mask) GUISetState(@SW_SHOWNOACTIVATE, $Mask) Else _Draw_Menu_ex($WinHWND, $i_Label, $menuFontSize, $shine2, 0x000000) ;high glow, black color EndIf EndIf EndIf Case Else If $i_MenuState <> 1 Then $i_MenuState = 1 If $i_MenuItem = $DownMenu Then _Draw_Menu_ex($WinHWND, ChrW(9660), $menuFontSize-Round(Sqrt($menuFontSize)), $shine3, 0x555555) ElseIf $i_MenuItem = $HoverImage Then GUISetState(@SW_HIDE, $Mask) Else _Draw_Menu_ex($WinHWND, $i_Label, $menuFontSize, $shine3, 0x000000) ;spread glow so there aren't any, black color EndIf EndIf EndSwitch EndFunc Func _CreateFakeGUI(ByRef $WinHWND, $WinTitle, $WinWIdth, $WinHeight, $Win_X, $Win_Y, $AddCtrl, ByRef $CtrlHWND);, $LabelSize = 35) $WinHWND = GUICreate($WinTitle, $WinWIdth, $WinHeight, $Win_X, $Win_Y, $WS_POPUP, $WS_EX_MDICHILD, $Form1) If $AddCtrl = 1 then $CtrlHWND = GUICtrlCreatePic('', 0, 0, $iWidth, $iHeight) ;control to put image later on ElseIf $AddCtrl = 2 Then $CtrlHWND = GUICtrlCreateLabel('', 0, 0, $WinWIdth, $menuFontSize*2-Round($menuFontSize/1.5)) ;clickable area GUICtrlSetBkColor(-1, 0x000000) If (@OSVersion <> "WIN_VISTA") OR (@OSVersion <> "WIN_7") Then _Vista_ApplyGlass($WinHWND, $Win_Back_Color) ;apply glass on entire child window EndIf GUISetState(@SW_DISABLE, $WinHWND) ;disabling window so that it doesn't take focus from parent when you click on it GUISetState(@SW_SHOWNOACTIVATE, $WinHWND) ;show and doesn't focus If $AddCtrl = 1 Then _Create_7Image() ;creating image with 7 number on it (like win7) GUICtrlSetImage($CtrlHWND, $temp_image) ;setting image into control we created earlier. ;Why did I use this method and not redrew image 7 in MY_PAINT? because it would be very slow, this method is faster. EndIf EndFunc Func ShowMenu($hWnd, $CtrlID, $nContextID) Local $timez = TimerInit() Local $arPos, $x, $y Local $hMenu = GUICtrlGetHandle($nContextID) $arPos = ControlGetPos($hWnd, "", $CtrlID) $x = $arPos[0] $y = $arPos[1] + $arPos[3] ClientToScreen($hWnd, $x, $y) TrackPopupMenu($hWnd, $hMenu, $x, $y) EndFunc ;==>ShowMenu Func ClientToScreen($hWnd, ByRef $x, ByRef $y) Local $stPoint = DllStructCreate("int;int") DllStructSetData($stPoint, 1, $x) DllStructSetData($stPoint, 2, $y) DllCall("user32.dll", "int", "ClientToScreen", "hwnd", $hWnd, "ptr", DllStructGetPtr($stPoint)) $x = DllStructGetData($stPoint, 1) $y = DllStructGetData($stPoint, 2) $stPoint = 0 EndFunc ;==>ClientToScreen Func TrackPopupMenu($hWnd, $hMenu, $x, $y) DllCall("user32.dll", "int", "TrackPopupMenuEx", "hwnd", $hMenu, "int", 0, "int", $x, "int", $y, "hwnd", $hWnd, "ptr", 0) EndFunc ;==>TrackPopupMenu #region glass functions for aero graphic environment (link at the top of the script) Func _Vista_ApplyGlass($hWnd, $bColor = 0x000000) GUISetBkColor($bColor) $Ret = DllCall("dwmapi.dll", "long", "DwmExtendFrameIntoClientArea", "hwnd", $hWnd, "long*", DllStructGetPtr($Struct)) If @error Then Return 0 SetError(1) Else Return $Ret EndIf EndFunc ;==>_Vista_ApplyGlass Func _Vista_ApplyGlassArea($hWnd, $Area, $bColor = 0x000000) If IsArray($Area) Then DllStructSetData($Struct, "cxLeftWidth", $Area[0]) DllStructSetData($Struct, "cxRightWidth", $Area[1]) DllStructSetData($Struct, "cyTopHeight", $Area[2]) DllStructSetData($Struct, "cyBottomHeight", $Area[3]) GUISetBkColor($bColor); Must be here! $Ret = DllCall("dwmapi.dll", "long*", "DwmExtendFrameIntoClientArea", "hwnd", $hWnd, "ptr", DllStructGetPtr($Struct)) If @error Then Return 0 Else Return $Ret EndIf Else MsgBox(16, "_Vista_ApplyGlassArea", "Area specified is not an array!") EndIf EndFunc ;==>_Vista_ApplyGlassArea #endregion Func _Draw_menus() _Draw_Menu_ex($FileGUI, 'File', $menuFontSize, $shine3, 0x000000) _Draw_Menu_ex($EditGUI, 'Edit', $menuFontSize, $shine3, 0x000000) _Draw_Menu_ex($HelpGUI, 'Help', $menuFontSize, $shine3, 0x000000) _Draw_Menu_ex($DownGUI, ChrW(9660), $menuFontSize-Round(Sqrt($menuFontSize)), $shine3, 0x555555) EndFunc Func _Draw_Menu_ex($WinHandle, $iCaption, $iSize, $iShine, $iColor) Local $hDC = _WinAPI_GetDC($WinHandle) Local $tClientRect = _WinAPI_GetClientRect($WinHandle) Local $sText = $iCaption Local $hFont = _WinAPI_CreateFont($iSize, $iSize/2-1, 0, 0, 400, False, False, False, $DEFAULT_CHARSET, _ $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'SegoeUI') _DrawGlowingText($hDC, $sText, $tClientRect, $iShine, $hFont, $iColor) _WinAPI_DeleteObject($hFont) _WinAPI_ReleaseDC($WinHandle, $hDC) EndFunc #region making label shine in glass area (Link at the top of the script) Func _DrawGlowingText($hDC, $sText, $tRc, $iGlowSize = 10, $hFont = 0, $iTextClr = -1) Local $hCDC Local $hBrush, $hOldBrush Local $tRcText Local $tBI, $tDTO Local $hDIBBmp, $hOldBmp Local $hOldFont Local $tST Local $iFlags = BitOR($DTT_GLOWSIZE, $DTT_COMPOSITED) $hCDC = _WinAPI_CreateCompatibleDC($hDC) $tBI = DllStructCreate($tagBITMAPINFO) DllStructSetData($tBI, "Size", DllStructGetSize($tBI)-4) DllStructSetData($tBI, "Width", DllStructGetData($tRc, "Right")-DllStructGetData($tRc, "Left")) DllStructSetData($tBI, "Height", -(DllStructGetData($tRc, "Bottom")-DllStructGetData($tRc, "Top"))) DllStructSetData($tBI, "Planes", 1) DllStructSetData($tBI, "BitCount", 32) DllStructSetData($tBI, "Compression", 0) ; BI_RGB $hDIBBmp = _WinAPI_CreateDIBSection($hDC, $tBI) $hOldBmp = _WinAPI_SelectObject($hCDC, $hDIBBmp) If $hFont Then $hOldFont = _WinAPI_SelectObject($hCDC, $hFont) $tDTO = DllStructCreate($tagDTTOPTS) DllStructSetData($tDTO, "Size", DllStructGetSize($tDTO)) If $iTextClr <> -1 Then $iFlags = BitOR($iFlags, $DTT_TEXTCOLOR) DllStructSetData($tDTO, "clrText", $iTextClr) EndIf DllStructSetData($tDTO, "Flags", $iFlags) DllStructSetData($tDTO, "GlowSize", $iGlowSize) _WinAPI_DrawThemeTextEx($hTheme, $hCDC, 0, 0, $sText, _ BitOR($DT_SINGLELINE, $DT_CENTER, $DT_VCENTER, $DT_NOPREFIX), $tRc, $tDTO) _WinAPI_BitBlt($hDC, DllStructGetData($tRc, "Left"), DllStructGetData($tRc, "Top"), _ DllStructGetData($tRc, "Right")-DllStructGetData($tRc, "Left"), _ DllStructGetData($tRc, "Bottom")-DllStructGetData($tRc, "Top"), $hCDC, 0, 0, 0xCC0020) ; SRCCOPY ;top+Sqrt($menuFontSize) _WinAPI_SelectObject($hCDC, $hOldBmp) If $hFont Then _WinAPI_SelectObject($hCDC, $hOldFont) _WinAPI_DeleteObject($hDIBBmp) _WinAPI_DeleteDC($hCDC) EndFunc Func _WinAPI_CreateDIBSection($hDC, Const ByRef $tBmpInfo, $iUsage = 0, $pBits = 0, $hSecond = 0, $iOffset = 0) Local $aResult = DllCall("gdi32.dll", "hwnd", "CreateDIBSection", "hwnd", $hDC, "ptr", DllStructGetPtr($tBmpInfo), _ "uint", $iUsage, "ptr", $pBits, "hwnd", $hSecond, "uint", $iOffset) If @error Then Return SetError(@error, @extended, 0) If $aResult[0] = 87 Then Return SetError(1, 1, 0); 87 = ERROR_INVALID_PARAMETER If $aResult[0] = 0 Then Return SetError(1, 2, 0) Return SetError(0, 0, $aResult[0]) EndFunc Func _WinAPI_DrawThemeTextEx($hTheme, $hDC, $iPartId, $iStateId, $sText, $iFlags, ByRef $tRect, Const ByRef $tDTTOPTS) Local $aResult = DllCall("uxtheme.dll", "int", "DrawThemeTextEx", "ptr", $hTheme, "hwnd", $hDC, "int", $iPartId, "int", $iStateId, _ "wstr", $sText, "int", -1, "uint", $iFlags, "ptr", DllStructGetPtr($tRect), "ptr", DllStructGetPtr($tDTTOPTS)) If @error Then Return SetError(@error, @extended, 0) If $aResult[0] <> 0 Then Return SetError(1, 0, 0) Return SetError(0, 0, $aResult[0] = 0) EndFunc Func _WinAPI_OpenThemeData($hWnd, $sClassList) Local $aResult = DllCall("uxtheme.dll", "hwnd", "OpenThemeData", "hwnd", $hWnd, "wstr", $sClassList) If @error Then Return SetError(@error, @extended, 0) If $aResult[0] = 0 Then Return SetError(1, 0, 0) Return SetError(0, 0, $aResult[0]) EndFunc Func _WinAPI_CloseThemeData($hTheme) Local $aResult = DllCall("uxtheme.dll", "int", "CloseThemeData", "hwnd", $hTheme) If @error Then Return SetError(@error, @extended, 0) Return SetError(0, 0, $aResult[0] = 0) EndFunc #endregion Func MY_PAINT($hWnd, $Msg, $wParam, $lParam) _Draw_menus() Return $GUI_RUNDEFMSG EndFunc Func _Create_7Image() ;drawn by myself xP _GDIPlus_Startup() Local $hGraphic = _GDIPlus_GraphicsCreateFromHWND($controlGui) Local $hbitmap = _GDIPlus_BitmapCreateFromGraphics($iwidth, $iheight, $hGraphic) Local $backbuffer = _GDIPlus_ImageGetGraphicsContext($hbitmap) Local $LetterSize = 36 Local $Letter = '7' Local $hbrush = _GDIPlus_BrushCreateSolid(0xFF152a3d) Local $hbrushB = _GDIPlus_BrushCreateSolid(0xFF000000) Local $hbrush2 = _GDIPlus_BrushCreateSolid(0x3A152a3d) Local $hbrush3 = _GDIPlus_BrushCreateSolid(0x28FFFFFF) Local $hFormat = _GDIPlus_StringFormatCreate () Local $hFamily = _GDIPlus_FontFamilyCreate ("Times New Roman") Local $hPen = _GDIPlus_PenCreate (0xFF454545) Local $hFont = _GDIPlus_FontCreate ($hFamily, $LetterSize, 1) Local $tLayout Local $tLayout2 #region malkey's gradient example ;creating gradient Local $aFact[4] = [0, 0.3, 0.6, 1.0] Local $aPosit[4] = [0.0, 0.3, 0.6, 1.0] Local $hBrushLin2 = gdiplus_CreateLineBrushFromRect($iX, $iY, $iWidth, $iHeight, $aFact, $aPosit, _ 0xFF5078fb, 0xFF91e9ff, 0x00000002, 1) _GDIPlus_GraphicsFillRect($backbuffer, $iX, $iY, $iWidth, $iHeight, $hBrushLin2) #endregion Local $StartNum = 1 ;creating little pixels to add texture for $j = 1 to 48 for $i = $StartNum to 48 step 3 _GDIPlus_GraphicsFillRect($backbuffer, $i-1, $j-1, 1, 1, $hbrush2) Next $StartNum += 1 If $StartNum > 3 then $StartNum = 1 Next Local $3D_Depth = 3 $tLayout2 = _GDIPlus_RectFCreate ($iX+7, $iY-1, $iWidth, $iHeight) _GDIPlus_GraphicsDrawStringEx ($backbuffer, $Letter, $hFont, $tLayout2, $hFormat, $hbrush2) ;creating shadow under character For $i = 1 to $3D_Depth $tLayout = _GDIPlus_RectFCreate ($iX+6-$i, $iY-$i-2, $iWidth-4, $iHeight+4) If $i = $3D_Depth then _GDIPlus_GraphicsDrawStringEx ($backbuffer, $Letter, $hFont, $tLayout, $hFormat, $hBrush) ;creating character Else _GDIPlus_GraphicsDrawStringEx ($backbuffer, $Letter, $hFont, $tLayout, $hFormat, $hBrushB) ;creating character depth EndIf Next Local $i_a = 48 ;ellipse points Local $i_b = 32 For $j = 1 to 48 For $i = 1 to 48 if $i >= Sqrt($i_a^2-$i_a^2*$j^2/$i_b^2) then _GDIPlus_GraphicsFillRect($backbuffer, 48-$i, 48-$j, 1, 1, $hbrush3) ;creating gloss with ellipse equation Next Next _GDIPlus_GraphicsDrawRect($backbuffer, $iX, $iY, $iWidth-1, $iHeight-1, $hPen) ;boxing entire image with dark grey line Local $GC = _GDIPlus_ImageGetGraphicsContext($hbitmap) Local $newBmp = _GDIPlus_BitmapCreateFromGraphics($iwidth, $iheight, $GC) Local $newGC = _GDIPlus_ImageGetGraphicsContext($newBmp) _GDIPlus_GraphicsDrawImageRect($newGC, $hbitmap, 0, 0, $iwidth, $iheight) _GDIPlus_ImageSaveToFile($newBmp, $temp_image) ;saving created image - it's easier to show image and leave it there, than redrawing this entire thing ;when GID+ gets disappeared _WinAPI_DeleteObject($hbitmap) ;disposing all the unneeded stuff _GDIPlus_GraphicsDispose($backbuffer) _GDIPlus_GraphicsDispose($GC) _GDIPlus_GraphicsDispose($newGC) _GDIPlus_BitmapDispose($newBmp) _GDIPlus_BrushDispose($hBrushLin2) _GDIPlus_BrushDispose($hbrush) _GDIPlus_BrushDispose($hbrushB) _GDIPlus_BrushDispose($hbrush2) _GDIPlus_BrushDispose($hbrush3) _GDIPlus_PenDispose ($hPen) _GDIPlus_FontDispose ($hFont) _GDIPlus_FontFamilyDispose ($hFamily) _GDIPlus_StringFormatDispose ($hFormat) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($temp_image) _GDIPlus_Shutdown() EndFunc #region drawing gradient by Malkey (link at the top of the script) Func gdiplus_CreateLineBrushFromRect($iX, $iY, $iWidth, $iHeight, $aFactors, $aPositions, _ $iArgb1 = 0xFF0000FF, $iArgb2 = 0xFFFF0000, $LinearGradientMode = 0x00000001, $WrapMode = 0) Local $tRect, $pRect, $aRet, $tFactors, $pFactors, $tPositions, $pPositions, $iCount If $iArgb1 = -1 Then $iArgb1 = 0xFF0000FF If $iArgb2 = -1 Then $iArgb2 = 0xFFFF0000 If $LinearGradientMode = -1 Then $LinearGradientMode = 0x00000001 If $WrapMode = -1 Then $WrapMode = 1 $tRect = DllStructCreate("float X;float Y;float Width;float Height") $pRect = DllStructGetPtr($tRect) DllStructSetData($tRect, "X", $iX) DllStructSetData($tRect, "Y", $iY) DllStructSetData($tRect, "Width", $iWidth) DllStructSetData($tRect, "Height", $iHeight) ;Note: Withn _GDIPlus_Startup(), $ghGDIPDll is defined $aRet = DllCall($ghGDIPDll, "int", "GdipCreateLineBrushFromRect", "ptr", $pRect, "int", $iArgb1, _ "int", $iArgb2, "int", $LinearGradientMode, "int", $WrapMode, "int*", 0) If IsArray($aFactors) = 0 Then Dim $aFactors[4] = [0.0, 0.4, 0.6, 1.0] If IsArray($aPositions) = 0 Then Dim $aPositions[4] = [0.0, 0.3, 0.7, 1.0] $iCount = UBound($aPositions) $tFactors = DllStructCreate("float[" & $iCount & "]") $pFactors = DllStructGetPtr($tFactors) For $iI = 0 To $iCount - 1 DllStructSetData($tFactors, 1, $aFactors[$iI], $iI + 1) Next $tPositions = DllStructCreate("float[" & $iCount & "]") $pPositions = DllStructGetPtr($tPositions) For $iI = 0 To $iCount - 1 DllStructSetData($tPositions, 1, $aPositions[$iI], $iI + 1) Next $hStatus = DllCall($ghGDIPDll, "int", "GdipSetLineBlend", "hwnd", $aRet[6], _ "ptr", $pFactors, "ptr", $pPositions, "int", $iCount) Return $aRet[6] ; Handle of Line Brush EndFunc ;==>Gdiplus_CreateLineBrushFromRect #endregion Func _CleanUp() _WinAPI_CloseThemeData($hTheme) FileDelete($temp_image) EndFunc
Edited by sandin, 12 July 2011 - 12:16 PM.







