Advertisement
CivReborn

HB_Plain_Rounded_Button_Type_1

Mar 22nd, 2019
506
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;Paste :
  2.  
  3. #SingleInstance , Force
  4. #NoEnv
  5. ListLines , Off
  6. SetBatchLines , -1
  7.  
  8. pToken := Gdip_Startup()
  9.  
  10. global HB_Button := []
  11.  
  12. Main := New Custom_Window( x := "" , y := "" , w := 600 , h := 400 , Name := "1" , Options := "+AlwaysOnTop -Caption -DPIScale" , Title := "HB Rounded Button Class 1 Scripting Tool" , Background_Bitmap := HB_BITMAP_MAKER() )
  13.  
  14. Gui , 1: Add   , Text , x50  y0  w450 h40 BackgroundTrans gMove_Window
  15. Gui , 1: Add   , Text , x550 y6  w20  h20 BackgroundTrans gMin_Window
  16. Gui , 1: Add   , Text , x575 y6  w20  h20 BackgroundTrans gGuiClose
  17. Gui , 1: Add   , Text , x5   y5  w30  h30 BackgroundTrans gTag
  18.  
  19. Gui , 1: Color , 222222 , aaaaaa
  20.  
  21. Gui , 1: Font  , cBlack s8
  22.  
  23. HB_Button.Push( New HB_Plain_Rounded_Button_Type_1( x := 400 , y := 58    , w := 180 , h := 60  , Button_Color := "00ff66"  , Button_Background_Color := "555555" , Text := "Clip New Button"     , Font := "Arial" , Font_Size := 12 , Font_Color_Top := "111111" , Font_Color_Bottom := "cccccc" , Window := "1" , Label := "Clip_New_Button"     ) )
  24. HB_Button.Push( New HB_Plain_Rounded_Button_Type_1( x        , y += h + 5 , w        , h        , Button_Color := "0066ff"  , Button_Background_Color             , Text := "Clip Click Function" , Font            , Font_Size       , Font_Color_Top := "cccccc" , Font_Color_Bottom := "111111" , Window        , Label := "Clip_Click_Function" ) )
  25. HB_Button.Push( New HB_Plain_Rounded_Button_Type_1( x        , y += h + 5 , w        , h        , Button_Color := "ffff44"  , Button_Background_Color             , Text := "Clip Setup"          , Font            , Font_Size       , Font_Color_Top := "111111" , Font_Color_Bottom := "cccccc" , Window        , Label := "Clip_Setup"          ) )
  26. HB_Button.Push( New HB_Plain_Rounded_Button_Type_1( x        , y += h + 5 , w        , h        , Button_Color := "880000"  , Button_Background_Color             , Text := "Clip Hover Function" , Font            , Font_Size       , Font_Color_Top := "cccccc" , Font_Color_Bottom := "111111" , Window        , Label := "Clip_Hover_Function" ) )
  27. HB_Button.Push( New HB_Plain_Rounded_Button_Type_1( x        , y += h + 5 , w        , h        , Button_Color := "C1C1C1"  , Button_Background_Color             , Text := "Clip Button Class"   , Font            , Font_Size       , Font_Color_Top := "111111" , Font_Color_Bottom := "cccccc" , Window        , Label := "Clip_Button_Class"   ) )
  28.  
  29. Gui , 1: Add , Edit , x82  y72  w99  h21 -E0x200 border Center                  gSubmit_All vX_Edit             , 10
  30. Gui , 1: Add , Edit , x267 y72  w99  h21 -E0x200 border Center                  gSubmit_All vY_Edit             , 10
  31. Gui , 1: Add , Edit , x82  y117 w99  h21 -E0x200 border Center                  gSubmit_All vW_Edit             , 150
  32. Gui , 1: Add , Edit , x267 y117 w99  h21 -E0x200 border Center                  gSubmit_All vH_Edit             , 40
  33. Gui , 1: Add , Edit , x82  y162 w99  h21 -E0x200 border Center Uppercase limit6 gSubmit_All vBTN_Color_Edit     , C1C1C1
  34. Gui , 1: Add , Edit , x267 y162 w99  h21 -E0x200 border Center Uppercase limit6 gSubmit_All vBTN_BG_Color_Edit  , 222222
  35. Gui , 1: Add , Edit , x82  y207 w99  h21 -E0x200 border Center                  gSubmit_All vFont_Edit          , Arial
  36. Gui , 1: Add , Edit , x267 y207 w99  h21 -E0x200 border Center Number           gSubmit_All vFont_Size_Edit     , 16
  37. Gui , 1: Add , Edit , x82  y252 w99  h21 -E0x200 border Center Uppercase limit6 gSubmit_All vFont_Color_Edit    , 000000
  38. Gui , 1: Add , Edit , x267 y252 w99  h21 -E0x200 border Center Uppercase limit6 gSubmit_All vFont_BG_Color_Edit , AAAAAA
  39. Gui , 1: Add , Edit , x82  y297 w99  h21 -E0x200 border Center                  gSubmit_All vWindow_Edit        , 1
  40. Gui , 1: Add , Edit , x227 y297 w139 h21 -E0x200 border Center                  gSubmit_All vLabel_Edit         , GuiClose
  41. Gui , 1: Add , Edit , x92  y347 w279 h21 -E0x200 border Center                  gSubmit_All vBTN_Text_Edit      , Button
  42.  
  43. Main.Show_Window()
  44.  
  45. Gui , 1: Submit , NoHide
  46.  
  47. SetTimer , HB_Button_Hover , 50
  48.  
  49. return
  50.  
  51. GuiClose(){
  52.     ExitApp
  53. }
  54.    
  55. Submit_All:
  56.     Gui , 1: Submit , NoHide
  57.     return
  58.  
  59. Move_Window(){
  60.     SetTimer , HB_Button_Hover , Off
  61.     PostMessage , 0xA1 , 2
  62.     While( GetKeyState( "LButton" ) )
  63.         sleep , 10
  64.     SetTimer , HB_Button_Hover , On
  65. }
  66.  
  67. Tag(){
  68.     Try
  69.         Run , https://www.youtube.com/user/CivReborn
  70. }
  71.  
  72. Min_Window(){
  73.     Gui , 1: Minimize
  74. }
  75.  
  76. HB_Button_Hover(){
  77.     Static Index , Hover_On
  78.     MouseGetPos,,,, ctrl , 2
  79.     if( !Hover_On && ctrl ){
  80.         loop , % HB_Button.Length()
  81.             if( ctrl = HB_Button[ A_Index ].hwnd )
  82.                 HB_Button[ A_Index ].Draw_Hover() , Index := A_Index , Hover_On := 1 , break
  83.     }else if( Hover_On = 1 )
  84.         if( ctrl != HB_Button[ Index ].Hwnd )
  85.             HB_Button[ Index ].Draw_Default() , Hover_On := 0
  86. }
  87.  
  88. Clip_New_Button:
  89.     GuiControl , % HB_Button[ A_GuiControl ].Window ": Focus" , % HB_Button[ A_GuiControl ].Hwnd
  90.     if( ! HB_Button[ A_GuiControl ].Draw_Pressed() )
  91.     return
  92.     Clipboard := "HB_Button.Push( New HB_Plain_Rounded_Button_Type_1( x := " X_Edit " , y := " Y_Edit " , w := " W_Edit " , h := " H_Edit " , Button_Color := """ BTN_Color_Edit """ , Button_Background_Color := """ BTN_BG_Color_Edit """ , Text := """ BTN_Text_Edit """ , Font := """ Font_Edit """ , Font_Size := " Font_Size_Edit " , Font_Color_Top := """ Font_Color_Edit """ , Font_Color_Bottom := """ Font_BG_Color_Edit """ , Window := """ Window_Edit """ , Label := """ Label_Edit """ ) )`n"
  93.     SoundBeep , 500
  94.     SoundBeep , 600
  95.     return
  96.  
  97. Clip_Click_Function(){
  98.     GuiControl , % HB_Button[ A_GuiControl ].Window ": Focus" , % HB_Button[ A_GuiControl ].Hwnd
  99.     if( ! HB_Button[ A_GuiControl ].Draw_Pressed() )
  100.     return
  101.     Clipboard := Click_Var()
  102.     SoundBeep , 500
  103.     SoundBeep , 600
  104. }
  105.  
  106. Clip_Setup(){
  107.     GuiControl , % HB_Button[ A_GuiControl ].Window ": Focus" , % HB_Button[ A_GuiControl ].Hwnd
  108.     if( ! HB_Button[ A_GuiControl ].Draw_Pressed() )
  109.     return
  110.     Clipboard := Setup_Var()
  111.     SoundBeep , 500
  112.     SoundBeep , 600
  113. }
  114.  
  115. Clip_Hover_Function(){
  116.     GuiControl , % HB_Button[ A_GuiControl ].Window ": Focus" , % HB_Button[ A_GuiControl ].Hwnd
  117.     if( ! HB_Button[ A_GuiControl ].Draw_Pressed() )
  118.     return
  119.     Clipboard := Hover_Var()
  120.     SoundBeep , 500
  121.     SoundBeep , 600
  122. }
  123.  
  124. Clip_Button_Class(){
  125.     GuiControl , % HB_Button[ A_GuiControl ].Window ": Focus" , % HB_Button[ A_GuiControl ].Hwnd
  126.     if( ! HB_Button[ A_GuiControl ].Draw_Pressed() )
  127.     return
  128.     Clipboard := Class_Var()
  129.     SoundBeep , 500
  130.     SoundBeep , 600
  131. }
  132.  
  133. class HB_Plain_Rounded_Button_Type_1    {
  134.     __New( x := 10 , y := 10 , w := 150 , h := 40 , Button_Color := "FF0000" , Button_Background_Color := "222222" , Text := "Button" , Font := "Arial" , Font_Size := 16 , Font_Color_Top := "000000" , Font_Color_Bottom := "FFFFFF" , Window := "1" , Label := "" ){
  135.         This.Text_Color_Top := "0xFF" Font_Color_Top , This.Text_Color_Bottom := "0xFF" Font_Color_Bottom , This.Font := Font , This.Font_Size := Font_Size , This.Text := Text
  136.         This.X := x , This.Y := y , This.W := w , This.H := h , This.Button_Background_Color := "0xFF" Button_Background_Color , This.Button_Color := "0xFF" Button_Color , This.Window := Window
  137.         This.Label := Label , This.Create_Default_Bitmap() , This.Create_Hover_Bitmap() , This.Create_Pressed_Bitmap() , This.Create_Trigger()
  138.         sleep, 20
  139.         This.Draw_Default()
  140.     }
  141.     Create_Trigger(){
  142.         global
  143.         num := HB_Button.Length() + 1
  144.         Gui , % This.Window ": Add" , Picture , % "x" This.X " y" This.Y " w" This.W " h" This.H " hwndHwnd_" Num " v" Num " g" This.Label " 0xE"
  145.         This.Number := Num , This.Hwnd := Hwnd_%num%
  146.     }
  147.     Create_Default_Bitmap(){
  148.         pBitmap:=Gdip_CreateBitmap( This.W, This.H )
  149.         G := Gdip_GraphicsFromImage( pBitmap )
  150.         Gdip_SetSmoothingMode( G , 2 )
  151.         Brush := Gdip_BrushCreateSolid( This.Button_Background_Color )
  152.         Gdip_FillRectangle( G , Brush , -1 , -1 , This.W+2 , This.H+2 )
  153.         Gdip_DeleteBrush( Brush )
  154.         Brush := Gdip_BrushCreateSolid( "0xFF222222" )
  155.         Gdip_FillRoundedRectangle( G , Brush , 2 , 2 , This.W-4 , This.H-3 , 16 )
  156.         Gdip_DeleteBrush( Brush )
  157.         Brush := Gdip_CreateLineBrushFromRect( 2 , -1 , This.W-4 , This.H-3 , "0xFF555555" , "0xFF000000" , 1 , 1 )
  158.         Gdip_FillRoundedRectangle( G , Brush , 2 , 0 , This.W-4 , This.H-3 , 16 )
  159.         Gdip_DeleteBrush( Brush )
  160.         if(This.Button_Color="0xFF000000"||This.Button_Color="0xFF111111")
  161.             Brush := Gdip_CreateLineBrushFromRect( 4 , -1 , This.W-6 , This.H+5 , "0xFF333333" , This.Button_Color , 1 , 1 )
  162.         else    
  163.             Brush := Gdip_CreateLineBrushFromRect( 4 , -1 , This.W-6 , This.H+5 , This.Button_Color , "0xFF333333" , 1 , 1 )
  164.         Gdip_FillRoundedRectangle( G , Brush , 3 , 1 , This.W-6 , This.H-5 , 16 )
  165.         Gdip_DeleteBrush( Brush )
  166.         Brush := Gdip_BrushCreateSolid( "0x22F0F0F0" )
  167.         Gdip_FillEllipse( G , Brush , This.W/15 , This.H/13 , This.W-(This.W/15*2) , This.H*0.45 )
  168.         Gdip_DeleteBrush( Brush )
  169.         Brush := Gdip_BrushCreateSolid( This.Text_Color_Bottom )
  170.         Gdip_TextToGraphics( G , This.Text , "s" This.Font_Size " Center vCenter Bold c" Brush " x-1 y-1" , This.Font , This.W , This.H )
  171.         Gdip_DeleteBrush( Brush )
  172.         Brush := Gdip_BrushCreateSolid( This.Text_Color_Top )
  173.         Gdip_TextToGraphics( G , This.Text , "s" This.Font_Size " Center vCenter Bold c" Brush " x0 y0" , This.Font , This.W , This.H )
  174.         Gdip_DeleteBrush( Brush )
  175.         Gdip_DeleteGraphics( G )
  176.         This.Default_Bitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap)
  177.         Gdip_DisposeImage(pBitmap)
  178.     }
  179.     Create_Hover_Bitmap(){
  180.         pBitmap:=Gdip_CreateBitmap( This.W , This.H )
  181.          G := Gdip_GraphicsFromImage( pBitmap )
  182.         Gdip_SetSmoothingMode( G , 2 )
  183.         Brush := Gdip_BrushCreateSolid( This.Button_Background_Color )
  184.         Gdip_FillRectangle( G , Brush , -1 , -1 , This.W+2 , This.H+2 )
  185.         Gdip_DeleteBrush( Brush )
  186.         Brush := Gdip_BrushCreateSolid( "0xFF222222" )
  187.         Gdip_FillRoundedRectangle( G , Brush , 2 , 2 , This.W-4 , This.H-3 , 16 )
  188.         Gdip_DeleteBrush( Brush )
  189.         Brush := Gdip_CreateLineBrushFromRect( 2 , -1 , This.W-4 , This.H-3 , "0xFF555555" , "0xFF000000" , 1 , 1 )
  190.         Gdip_FillRoundedRectangle( G , Brush , 2 , 0 , This.W-4 , This.H-3 , 16 )
  191.         Gdip_DeleteBrush( Brush )
  192.         if(This.Button_Color="0xFF000000"||This.Button_Color="0xFF111111")
  193.             Brush := Gdip_CreateLineBrushFromRect( 4 , -1 , This.W-6 , This.H+10 , "0xFF444444" , This.Button_Color , 1 , 1 )
  194.         else    
  195.             Brush := Gdip_CreateLineBrushFromRect( 4 , -1 , This.W-6 , This.H+10 , This.Button_Color , "0xFF444444" , 1 , 1 )
  196.         Gdip_FillRoundedRectangle( G , Brush , 3 , 1 , This.W-6 , This.H-5 , 16 )
  197.         Gdip_DeleteBrush( Brush )
  198.         Brush := Gdip_BrushCreateSolid( "0x22F0F0F0" )
  199.         Gdip_FillEllipse( G , Brush , This.W/15 , This.H/13 , This.W-(This.W/15*2) , This.H*0.45 )
  200.         Gdip_DeleteBrush( Brush )
  201.         Brush := Gdip_BrushCreateSolid( This.Text_Color_Bottom )
  202.         Gdip_TextToGraphics( G , This.Text , "s" This.Font_Size " Center vCenter Bold c" Brush " x-1 y-1" , This.Font , This.W , This.H )
  203.         Gdip_DeleteBrush( Brush )
  204.         Brush := Gdip_BrushCreateSolid( This.Text_Color_Top )
  205.         Gdip_TextToGraphics( G , This.Text , "s" This.Font_Size " Center vCenter Bold c" Brush " x0 y0" , This.Font , This.W , This.H )
  206.         Gdip_DeleteBrush( Brush )
  207.         Gdip_DeleteGraphics( G )
  208.         This.Hover_Bitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap)
  209.         Gdip_DisposeImage(pBitmap)
  210.     }
  211.     Create_Pressed_Bitmap(){
  212.         pBitmap:=Gdip_CreateBitmap( This.W , This.H )
  213.          G := Gdip_GraphicsFromImage( pBitmap )
  214.         Gdip_SetSmoothingMode( G , 2 )
  215.         Brush := Gdip_BrushCreateSolid( This.Button_Background_Color )
  216.         Gdip_FillRectangle( G , Brush , -1 , -1 , This.W+2 , This.H+2 )
  217.         Gdip_DeleteBrush( Brush )
  218.         Brush := Gdip_BrushCreateSolid( "0xFF222222" )
  219.         Gdip_DeleteBrush( Brush )
  220.         Brush := Gdip_CreateLineBrushFromRect( 2 , 0 , This.W-4 , This.H-3 , "0xFF555555" , "0xFF000000" , 1 , 1 )
  221.         Gdip_FillRoundedRectangle( G , Brush , 2 , 0 , This.W-4 , This.H-3 , 16 )
  222.         Gdip_DeleteBrush( Brush )
  223.         Brush := Gdip_CreateLineBrushFromRect( 4 , -1 , This.W-6 , This.H+5 , "0xFF333333" , This.Button_Color , 1 , 1 )
  224.         Gdip_FillRoundedRectangle( G , Brush , 3 , 1 , This.W-6 , This.H-5 , 16 )
  225.         Gdip_DeleteBrush( Brush )
  226.         Brush := Gdip_BrushCreateSolid( This.Text_Color_Bottom )
  227.         Gdip_TextToGraphics( G , This.Text , "s" This.Font_Size " Center vCenter Bold c" Brush " x-1 y-2" , This.Font , This.W , This.H )
  228.         Gdip_DeleteBrush( Brush )
  229.         Brush := Gdip_BrushCreateSolid( This.Text_Color_Top )
  230.         Gdip_TextToGraphics( G , This.Text , "s" This.Font_Size " Center vCenter Bold c" Brush " x0 y-1" , This.Font , This.W , This.H )
  231.         Gdip_DeleteBrush( Brush )
  232.         Gdip_DeleteGraphics( G )
  233.         This.Pressed_Bitmap := Gdip_CreateHBITMAPFromBitmap( pBitmap )
  234.         Gdip_DisposeImage( pBitmap )
  235.     }
  236.     Draw_Default(){
  237.         SetImage( This.Hwnd , This.Default_Bitmap )
  238.     }
  239.     Draw_Hover(){
  240.         SetImage( This.Hwnd , This.Hover_Bitmap )
  241.     }
  242.     Draw_Pressed(){
  243.         SetImage( This.Hwnd , This.Pressed_Bitmap )
  244.         SetTimer , HB_Button_Hover , Off
  245.         While( GetKeyState( "LButton" ) )
  246.             sleep , 10
  247.         SetTimer , HB_Button_Hover , On
  248.         MouseGetPos,,,, ctrl , 2
  249.         if( This.Hwnd != ctrl ){
  250.             This.Draw_Default()
  251.             return False
  252.         }else   {  
  253.             This.Draw_Hover()
  254.             return true
  255.         }
  256.     }
  257. }
  258.  
  259. Class Custom_Window {
  260.     __New( x := "" , y := "" , w := 300 , h := 200 , Name := 1 , Options := "+AlwaysOnTop -Caption -DPIScale" , Title := "" , Background_Bitmap := "" ){
  261.         This.X := x , This.Y := y , This.W := w , This.H := h , This.Name := Name , This.Options := Options , This.Title := Title
  262.         This.Background_Bitmap := Background_Bitmap , This.Create_Window()
  263.     }
  264.     Create_Window(){
  265.         Gui,% This.Name ":New",%  This.Options " +LastFound"
  266.         This.Hwnd:=WinExist()
  267.         if(This.Background_Bitmap)
  268.             This.Draw_Background_Bitmap()
  269.     }
  270.     Draw_Background_Bitmap(){
  271.         This.Bitmap:=Gdip_CreateHBITMAPFromBitmap(This.Background_Bitmap)
  272.         Gdip_DisposeImage(This.Background_Bitmap)
  273.         Gui,% This.Name ":Add",Picture,% "x0 y0 w" This.W " h" This.H " 0xE"
  274.         GuiControlGet,hwnd,% This.Name ":hwnd",Static1
  275.         This.Background_Hwnd:=hwnd
  276.         SetImage(This.Background_Hwnd,This.Bitmap)
  277.     }
  278.     Show_Window(){
  279.         if(This.X&&This.Y)
  280.             Gui,% This.Name ":Show",% "x" This.X " y" This.Y " w" This.W " h" This.H,% This.Title
  281.         else if(This.X&&!This.Y)
  282.             Gui,% This.Name ":Show",% "x" This.X  " w" This.W " h" This.H,% This.Title
  283.         else if(!This.X&&This.Y)
  284.             Gui,% This.Name ":Show",% "y" This.Y  " w" This.W " h" This.H,% This.Title
  285.         else
  286.             Gui,% This.Name ":Show",% " w" This.W " h" This.H,% This.Title
  287.     }
  288. }
  289.  
  290. HB_BITMAP_MAKER(){
  291.     ;Bitmap Created Using: HB Bitmap Maker
  292.     pBitmap:=Gdip_CreateBitmap( 600 , 400 )
  293.      G := Gdip_GraphicsFromImage( pBitmap )
  294.     Gdip_SetSmoothingMode( G , 4 )
  295.     Brush := Gdip_CreateLineBrush( 202 , -12 , 322 , 404 , "0xFF222222" , "0xFF000000" , 1 )
  296.     Gdip_FillRectangle( G , Brush , -1 , -1 , 602 , 402 )
  297.     Gdip_DeleteBrush( Brush )
  298.     Brush := Gdip_CreateLineBrush( 0 , 0 , 100 , 100 , "0xFF333333" , "0xFFF0F0F0" , 1 )
  299.     Gdip_FillRectangle( G , Brush , 5 , 40 , 590 , 355 )
  300.     Gdip_DeleteBrush( Brush )
  301.     Pen := Gdip_CreatePen( "0xFF333333" , 1 )
  302.     Gdip_DrawRectangle( G , Pen , 0 , 0 , 599 , 399 )
  303.     Gdip_DeletePen( Pen )
  304.     Pen := Gdip_CreatePen( "0xFF777777" , 1 )
  305.     Gdip_DrawRectangle( G , Pen , 5 , 40 , 589 , 354 )
  306.     Gdip_DeletePen( Pen )
  307.     Brush := Gdip_BrushCreateSolid( "0xFF111111" )
  308.     Gdip_FillRectangle( G , Brush , 15 , 50 , 370 , 335 )
  309.     Gdip_DeleteBrush( Brush )
  310.     Pen := Gdip_CreatePen( "0xFF777777" , 1 )
  311.     Gdip_DrawRectangle( G , Pen , 15 , 50 , 369 , 334 )
  312.     Gdip_DeletePen( Pen )
  313.     Brush := Gdip_BrushCreateSolid( "0xFF555555" )
  314.     Gdip_FillRectangle( G , Brush , 395 , 50 , 190 , 335 )
  315.     Gdip_DeleteBrush( Brush )
  316.     Pen := Gdip_CreatePen( "0xFF222222" , 1 )
  317.     Gdip_DrawRectangle( G , Pen , 395 , 50 , 189 , 334 )
  318.     Gdip_DeletePen( Pen )
  319.     Brush := Gdip_CreateLineBrush( 12 , 7 , 17 , 19 , "0xFF333333" , "0xFFF0F0F0" , 1 )
  320.     Gdip_FillRectangle( G , Brush , 5 , 5 , 30 , 30 )
  321.     Gdip_DeleteBrush( Brush )
  322.     Pen := Gdip_CreatePen( "0xFF333333" , 2 )
  323.     Gdip_DrawRectangle( G , Pen , 5 , 5 , 30 , 30 )
  324.     Gdip_DeletePen( Pen )
  325.     Brush := Gdip_BrushCreateSolid( "0xFF222222" )
  326.     Gdip_TextToGraphics( G , "HB" , "s18 Center vCenter c" Brush " x4 y6" , "IMPACT" , 30 , 30 )
  327.     Gdip_DeleteBrush( Brush )
  328.     Brush := Gdip_BrushCreateSolid( "0xFF222222" )
  329.     Gdip_TextToGraphics( G , "HB" , "s18 Center vCenter c" Brush " x6 y6" , "IMPACT" , 30 , 30 )
  330.     Gdip_DeleteBrush( Brush )
  331.     Brush := Gdip_BrushCreateSolid( "0xFF222222" )
  332.     Gdip_TextToGraphics( G , "HB" , "s18 Center vCenter c" Brush " x6 y8" , "IMPACT" , 30 , 30 )
  333.     Gdip_DeleteBrush( Brush )
  334.     Brush := Gdip_BrushCreateSolid( "0xFF222222" )
  335.     Gdip_TextToGraphics( G , "HB" , "s18 Center vCenter c" Brush " x4 y8" , "IMPACT" , 30 , 30 )
  336.     Gdip_DeleteBrush( Brush )
  337.     Brush := Gdip_CreateLineBrush( 17 , 11 , 22 , 23 , "0xFF0011ED" , "0xFF3399FF" , 1 )
  338.     Gdip_TextToGraphics( G , "HB" , "s18 Center vCenter c" Brush " x5 y7" , "IMPACT" , 30 , 30 )
  339.     Gdip_DeleteBrush( Brush )
  340.     Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" )
  341.     Gdip_TextToGraphics( G , "HB_Plain_Rounded_Button_Type_1" , "s22 Center vCenter  c" Brush " x-1 y-4" , "impact" , 600 , 50 )
  342.     Gdip_DeleteBrush( Brush )
  343.     Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" )
  344.     Gdip_TextToGraphics( G , "HB_Plain_Rounded_Button_Type_1" , "s22 Center vCenter  c" Brush " x1 y-4" , "impact" , 600 , 50 )
  345.     Gdip_DeleteBrush( Brush )
  346.     Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" )
  347.     Gdip_TextToGraphics( G , "HB_Plain_Rounded_Button_Type_1" , "s22 Center vCenter  c" Brush " x1 y-2" , "impact" , 600 , 50 )
  348.     Gdip_DeleteBrush( Brush )
  349.     Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" )
  350.     Gdip_TextToGraphics( G , "HB_Plain_Rounded_Button_Type_1" , "s22 Center vCenter  c" Brush " x-1 y-2" , "impact" , 600 , 50 )
  351.     Gdip_DeleteBrush( Brush )
  352.     Brush := Gdip_CreateLineBrush( 237 , 14 , 249 , 27 , "0xFF0011ED" , "0xFF3399FF" , 1 )
  353.     Gdip_TextToGraphics( G , "HB_Plain_Rounded_Button_Type_1" , "s22 Center vCenter  c" Brush " x0 y-3" , "impact" , 600 , 50 )
  354.     Gdip_DeleteBrush( Brush )
  355.     Pen := Gdip_CreatePen( "0xFF333333" , 1 )
  356.     Gdip_DrawRectangle( G , Pen , 550 , 5 , 20 , 20 )
  357.     Gdip_DeletePen( Pen )
  358.     Pen := Gdip_CreatePen( "0xFF777777" , 1 )
  359.     Gdip_DrawRectangle( G , Pen , 551 , 6 , 18 , 18 )
  360.     Gdip_DeletePen( Pen )
  361.     Pen := Gdip_CreatePen( "0xFF333333" , 1 )
  362.     Gdip_DrawRectangle( G , Pen , 575 , 5 , 20 , 20 )
  363.     Gdip_DeletePen( Pen )
  364.     Pen := Gdip_CreatePen( "0xFF777777" , 1 )
  365.     Gdip_DrawRectangle( G , Pen , 576 , 6 , 18 , 18 )
  366.     Gdip_DeletePen( Pen )
  367.     Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" )
  368.     Gdip_TextToGraphics( G , "_" , "s24 Center vCenter Bold  c" Brush " x536 y-16" , "Segoe UI" , 50 , 50 )
  369.     Gdip_DeleteBrush( Brush )
  370.     Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" )
  371.     Gdip_TextToGraphics( G , "x" , "s18 Center vCenter c" Brush " x561 y-10" , "Segoe UI" , 50 , 50 )
  372.     Gdip_DeleteBrush( Brush )
  373.     Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" )
  374.     Gdip_TextToGraphics( G , "X :" , "s10  Bold c" Brush " x20 y76" , "Arial" , 50 , 50 )
  375.     Gdip_DeleteBrush( Brush )
  376.     Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" )
  377.     Gdip_TextToGraphics( G , "W :" , "s10  Bold c" Brush " x20 y121" , "Arial" , 50 , 50 )
  378.     Gdip_DeleteBrush( Brush )
  379.     Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" )
  380.     Gdip_TextToGraphics( G , "BTN Color :" , "s10  Bold c" Brush " x20 y166" , "Arial" , 110 , 50 )
  381.     Gdip_DeleteBrush( Brush )
  382.     Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" )
  383.     Gdip_TextToGraphics( G , "Font :" , "s10  Bold c" Brush " x20 y211" , "Arial" , 110 , 50 )
  384.     Gdip_DeleteBrush( Brush )
  385.     Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" )
  386.     Gdip_TextToGraphics( G , "Font Color :" , "s10  Bold c" Brush " x20 y256" , "Arial" , 110 , 50 )
  387.     Gdip_DeleteBrush( Brush )
  388.     Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" )
  389.     Gdip_TextToGraphics( G , "Window :" , "s10  Bold c" Brush " x20 y301" , "Arial" , 110 , 50 )
  390.     Gdip_DeleteBrush( Brush )
  391.     Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" )
  392.     Gdip_TextToGraphics( G , "Button Text :" , "s10  Bold c" Brush " x20 y351" , "Arial" , 110 , 50 )
  393.     Gdip_DeleteBrush( Brush )
  394.     Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" )
  395.     Gdip_TextToGraphics( G , "Y :" , "s10  Bold c" Brush " x184 y76" , "Arial" , 50 , 50 )
  396.     Gdip_DeleteBrush( Brush )
  397.     Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" )
  398.     Gdip_TextToGraphics( G , "H :" , "s10  Bold c" Brush " x184 y121" , "Arial" , 50 , 50 )
  399.     Gdip_DeleteBrush( Brush )
  400.     Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" )
  401.     Gdip_TextToGraphics( G , "BTN BG Color :" , "s10  Bold c" Brush " x184 y166" , "Arial" , 90 , 50 )
  402.     Gdip_DeleteBrush( Brush )
  403.     Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" )
  404.     Gdip_TextToGraphics( G , "Font Size :" , "s10  Bold c" Brush " x184 y211" , "Arial" , 90 , 50 )
  405.     Gdip_DeleteBrush( Brush )
  406.     Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" )
  407.     Gdip_TextToGraphics( G , "Font BG Color :" , "s10  Bold c" Brush " x184 y256" , "Arial" , 90 , 50 )
  408.     Gdip_DeleteBrush( Brush )
  409.     Brush := Gdip_BrushCreateSolid( "0xFFF0F0F0" )
  410.     Gdip_TextToGraphics( G , "Label :" , "s10  Bold c" Brush " x184 y301" , "Arial" , 90 , 50 )
  411.     Gdip_DeleteBrush( Brush )
  412.     Gdip_DeleteGraphics( G )
  413.     return pBitmap
  414. }
  415.  
  416. ;######################################################################################################################################
  417. ;#####################################################                          #######################################################
  418. ;#####################################################        Gdip LITE         #######################################################
  419. ;#####################################################                          #######################################################
  420. ;######################################################################################################################################
  421. ; Gdip standard library v1.45 by tic (Tariq Porter) 07/09/11
  422. ; Modifed by Rseding91 using fincs 64 bit compatible Gdip library 5/1/2013
  423. BitBlt(ddc, dx, dy, dw, dh, sdc, sx, sy, Raster=""){
  424.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  425.     return DllCall("gdi32\BitBlt", Ptr, dDC, "int", dx, "int", dy, "int", dw, "int", dh, Ptr, sDC, "int", sx, "int", sy, "uint", Raster ? Raster : 0x00CC0020)
  426. }
  427. Gdip_DrawImage(pGraphics, pBitmap, dx="", dy="", dw="", dh="", sx="", sy="", sw="", sh="", Matrix=1){
  428.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  429.     if (Matrix&1 = "")
  430.         ImageAttr := Gdip_SetImageAttributesColorMatrix(Matrix)
  431.     else if (Matrix != 1)
  432.         ImageAttr := Gdip_SetImageAttributesColorMatrix("1|0|0|0|0|0|1|0|0|0|0|0|1|0|0|0|0|0|" Matrix "|0|0|0|0|0|1")
  433.     if(sx = "" && sy = "" && sw = "" && sh = ""){
  434.         if(dx = "" && dy = "" && dw = "" && dh = ""){
  435.             sx := dx := 0, sy := dy := 0
  436.             sw := dw := Gdip_GetImageWidth(pBitmap)
  437.             sh := dh := Gdip_GetImageHeight(pBitmap)
  438.         }else   {
  439.             sx := sy := 0,sw := Gdip_GetImageWidth(pBitmap),sh := Gdip_GetImageHeight(pBitmap)
  440.         }
  441.     }
  442.     E := DllCall("gdiplus\GdipDrawImageRectRect", Ptr, pGraphics, Ptr, pBitmap, "float", dx, "float", dy, "float", dw, "float", dh, "float", sx, "float", sy, "float", sw, "float", sh, "int", 2, Ptr, ImageAttr, Ptr, 0, Ptr, 0)
  443.     if ImageAttr
  444.         Gdip_DisposeImageAttributes(ImageAttr)
  445.     return E
  446. }
  447. Gdip_SetImageAttributesColorMatrix(Matrix){
  448.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  449.     VarSetCapacity(ColourMatrix, 100, 0)
  450.     Matrix := RegExReplace(RegExReplace(Matrix, "^[^\d-\.]+([\d\.])", "$1", "", 1), "[^\d-\.]+", "|")
  451.     StringSplit, Matrix, Matrix, |
  452.     Loop, 25
  453.     {
  454.         Matrix := (Matrix%A_Index% != "") ? Matrix%A_Index% : Mod(A_Index-1, 6) ? 0 : 1
  455.         NumPut(Matrix, ColourMatrix, (A_Index-1)*4, "float")
  456.     }
  457.     DllCall("gdiplus\GdipCreateImageAttributes", A_PtrSize ? "UPtr*" : "uint*", ImageAttr)
  458.     DllCall("gdiplus\GdipSetImageAttributesColorMatrix", Ptr, ImageAttr, "int", 1, "int", 1, Ptr, &ColourMatrix, Ptr, 0, "int", 0)
  459.     return ImageAttr
  460. }
  461. Gdip_GetImageWidth(pBitmap){
  462.    DllCall("gdiplus\GdipGetImageWidth", A_PtrSize ? "UPtr" : "UInt", pBitmap, "uint*", Width)
  463.    return Width
  464. }
  465. Gdip_GetImageHeight(pBitmap){
  466.    DllCall("gdiplus\GdipGetImageHeight", A_PtrSize ? "UPtr" : "UInt", pBitmap, "uint*", Height)
  467.    return Height
  468. }
  469. Gdip_DeletePen(pPen){
  470.    return DllCall("gdiplus\GdipDeletePen", A_PtrSize ? "UPtr" : "UInt", pPen)
  471. }
  472. Gdip_DeleteBrush(pBrush){
  473.    return DllCall("gdiplus\GdipDeleteBrush", A_PtrSize ? "UPtr" : "UInt", pBrush)
  474. }
  475. Gdip_DisposeImage(pBitmap){
  476.    return DllCall("gdiplus\GdipDisposeImage", A_PtrSize ? "UPtr" : "UInt", pBitmap)
  477. }
  478. Gdip_DeleteGraphics(pGraphics){
  479.    return DllCall("gdiplus\GdipDeleteGraphics", A_PtrSize ? "UPtr" : "UInt", pGraphics)
  480. }
  481. Gdip_DisposeImageAttributes(ImageAttr){
  482.     return DllCall("gdiplus\GdipDisposeImageAttributes", A_PtrSize ? "UPtr" : "UInt", ImageAttr)
  483. }
  484. Gdip_DeleteFont(hFont){
  485.    return DllCall("gdiplus\GdipDeleteFont", A_PtrSize ? "UPtr" : "UInt", hFont)
  486. }
  487. Gdip_DeleteStringFormat(hFormat){
  488.    return DllCall("gdiplus\GdipDeleteStringFormat", A_PtrSize ? "UPtr" : "UInt", hFormat)
  489. }
  490. Gdip_DeleteFontFamily(hFamily){
  491.    return DllCall("gdiplus\GdipDeleteFontFamily", A_PtrSize ? "UPtr" : "UInt", hFamily)
  492. }
  493. CreateCompatibleDC(hdc=0){
  494.    return DllCall("CreateCompatibleDC", A_PtrSize ? "UPtr" : "UInt", hdc)
  495. }
  496. SelectObject(hdc, hgdiobj){
  497.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  498.     return DllCall("SelectObject", Ptr, hdc, Ptr, hgdiobj)
  499. }
  500. DeleteObject(hObject){
  501.    return DllCall("DeleteObject", A_PtrSize ? "UPtr" : "UInt", hObject)
  502. }
  503. GetDC(hwnd=0){
  504.     return DllCall("GetDC", A_PtrSize ? "UPtr" : "UInt", hwnd)
  505. }
  506. GetDCEx(hwnd, flags=0, hrgnClip=0){
  507.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  508.     return DllCall("GetDCEx", Ptr, hwnd, Ptr, hrgnClip, "int", flags)
  509. }
  510. ReleaseDC(hdc, hwnd=0){
  511.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  512.     return DllCall("ReleaseDC", Ptr, hwnd, Ptr, hdc)
  513. }
  514. DeleteDC(hdc){
  515.    return DllCall("DeleteDC", A_PtrSize ? "UPtr" : "UInt", hdc)
  516. }
  517. Gdip_SetClipRegion(pGraphics, Region, CombineMode=0){
  518.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  519.     return DllCall("gdiplus\GdipSetClipRegion", Ptr, pGraphics, Ptr, Region, "int", CombineMode)
  520. }
  521. CreateDIBSection(w, h, hdc="", bpp=32, ByRef ppvBits=0){
  522.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  523.     hdc2 := hdc ? hdc : GetDC()
  524.     VarSetCapacity(bi, 40, 0)
  525.     NumPut(w, bi, 4, "uint"), NumPut(h, bi, 8, "uint"), NumPut(40, bi, 0, "uint"), NumPut(1, bi, 12, "ushort"), NumPut(0, bi, 16, "uInt"), NumPut(bpp, bi, 14, "ushort")
  526.     hbm := DllCall("CreateDIBSection", Ptr, hdc2, Ptr, &bi, "uint", 0, A_PtrSize ? "UPtr*" : "uint*", ppvBits, Ptr, 0, "uint", 0, Ptr)
  527.     if !hdc
  528.         ReleaseDC(hdc2)
  529.     return hbm
  530. }
  531. Gdip_GraphicsFromImage(pBitmap){
  532.     DllCall("gdiplus\GdipGetImageGraphicsContext", A_PtrSize ? "UPtr" : "UInt", pBitmap, A_PtrSize ? "UPtr*" : "UInt*", pGraphics)
  533.     return pGraphics
  534. }
  535. Gdip_GraphicsFromHDC(hdc){
  536.     DllCall("gdiplus\GdipCreateFromHDC", A_PtrSize ? "UPtr" : "UInt", hdc, A_PtrSize ? "UPtr*" : "UInt*", pGraphics)
  537.     return pGraphics
  538. }
  539. Gdip_GetDC(pGraphics){
  540.     DllCall("gdiplus\GdipGetDC", A_PtrSize ? "UPtr" : "UInt", pGraphics, A_PtrSize ? "UPtr*" : "UInt*", hdc)
  541.     return hdc
  542. }
  543.  
  544.  
  545. Gdip_Startup(){
  546.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  547.     if !DllCall("GetModuleHandle", "str", "gdiplus", Ptr)
  548.         DllCall("LoadLibrary", "str", "gdiplus")
  549.     VarSetCapacity(si, A_PtrSize = 8 ? 24 : 16, 0), si := Chr(1)
  550.     DllCall("gdiplus\GdiplusStartup", A_PtrSize ? "UPtr*" : "uint*", pToken, Ptr, &si, Ptr, 0)
  551.     return pToken
  552. }
  553. Gdip_TextToGraphics(pGraphics, Text, Options, Font="Arial", Width="", Height="", Measure=0){
  554.     IWidth := Width, IHeight:= Height
  555.     RegExMatch(Options, "i)X([\-\d\.]+)(p*)", xpos)
  556.     RegExMatch(Options, "i)Y([\-\d\.]+)(p*)", ypos)
  557.     RegExMatch(Options, "i)W([\-\d\.]+)(p*)", Width)
  558.     RegExMatch(Options, "i)H([\-\d\.]+)(p*)", Height)
  559.     RegExMatch(Options, "i)C(?!(entre|enter))([a-f\d]+)", Colour)
  560.     RegExMatch(Options, "i)Top|Up|Bottom|Down|vCentre|vCenter", vPos)
  561.     RegExMatch(Options, "i)NoWrap", NoWrap)
  562.     RegExMatch(Options, "i)R(\d)", Rendering)
  563.     RegExMatch(Options, "i)S(\d+)(p*)", Size)
  564.     if !Gdip_DeleteBrush(Gdip_CloneBrush(Colour2))
  565.         PassBrush := 1, pBrush := Colour2
  566.     if !(IWidth && IHeight) && (xpos2 || ypos2 || Width2 || Height2 || Size2)
  567.         return -1
  568.     Style := 0, Styles := "Regular|Bold|Italic|BoldItalic|Underline|Strikeout"
  569.     Loop, Parse, Styles, |
  570.     {
  571.         if RegExMatch(Options, "\b" A_loopField)
  572.         Style |= (A_LoopField != "StrikeOut") ? (A_Index-1) : 8
  573.     }
  574.     Align := 0, Alignments := "Near|Left|Centre|Center|Far|Right"
  575.     Loop, Parse, Alignments, |
  576.     {
  577.         if RegExMatch(Options, "\b" A_loopField)
  578.             Align |= A_Index//2.1      ; 0|0|1|1|2|2
  579.     }
  580.     xpos := (xpos1 != "") ? xpos2 ? IWidth*(xpos1/100) : xpos1 : 0
  581.     ypos := (ypos1 != "") ? ypos2 ? IHeight*(ypos1/100) : ypos1 : 0
  582.     Width := Width1 ? Width2 ? IWidth*(Width1/100) : Width1 : IWidth
  583.     Height := Height1 ? Height2 ? IHeight*(Height1/100) : Height1 : IHeight
  584.     if !PassBrush
  585.         Colour := "0x" (Colour2 ? Colour2 : "ff000000")
  586.     Rendering := ((Rendering1 >= 0) && (Rendering1 <= 5)) ? Rendering1 : 4
  587.     Size := (Size1 > 0) ? Size2 ? IHeight*(Size1/100) : Size1 : 12
  588.     hFamily := Gdip_FontFamilyCreate(Font)
  589.     hFont := Gdip_FontCreate(hFamily, Size, Style)
  590.     FormatStyle := NoWrap ? 0x4000 | 0x1000 : 0x4000
  591.     hFormat := Gdip_StringFormatCreate(FormatStyle)
  592.     pBrush := PassBrush ? pBrush : Gdip_BrushCreateSolid(Colour)
  593.     if !(hFamily && hFont && hFormat && pBrush && pGraphics)
  594.         return !pGraphics ? -2 : !hFamily ? -3 : !hFont ? -4 : !hFormat ? -5 : !pBrush ? -6 : 0
  595.     CreateRectF(RC, xpos, ypos, Width, Height)
  596.     Gdip_SetStringFormatAlign(hFormat, Align)
  597.     Gdip_SetTextRenderingHint(pGraphics, Rendering)
  598.     ReturnRC := Gdip_MeasureString(pGraphics, Text, hFont, hFormat, RC)
  599.     if vPos
  600.     {
  601.         StringSplit, ReturnRC, ReturnRC, |
  602.         if (vPos = "vCentre") || (vPos = "vCenter")
  603.             ypos += (Height-ReturnRC4)//2
  604.         else if (vPos = "Top") || (vPos = "Up")
  605.             ypos := 0
  606.         else if (vPos = "Bottom") || (vPos = "Down")
  607.             ypos := Height-ReturnRC4
  608.         CreateRectF(RC, xpos, ypos, Width, ReturnRC4)
  609.         ReturnRC := Gdip_MeasureString(pGraphics, Text, hFont, hFormat, RC)
  610.     }
  611.     if !Measure
  612.         E := Gdip_DrawString(pGraphics, Text, hFont, hFormat, pBrush, RC)
  613.     if !PassBrush
  614.         Gdip_DeleteBrush(pBrush)
  615.     Gdip_DeleteStringFormat(hFormat)
  616.     Gdip_DeleteFont(hFont)
  617.     Gdip_DeleteFontFamily(hFamily)
  618.     return E ? E : ReturnRC
  619. }
  620. Gdip_DrawString(pGraphics, sString, hFont, hFormat, pBrush, ByRef RectF){
  621.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  622.     if (!A_IsUnicode)
  623.     {
  624.         nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &sString, "int", -1, Ptr, 0, "int", 0)
  625.         VarSetCapacity(wString, nSize*2)
  626.         DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &sString, "int", -1, Ptr, &wString, "int", nSize)
  627.     }
  628.     return DllCall("gdiplus\GdipDrawString", Ptr, pGraphics, Ptr, A_IsUnicode ? &sString : &wString, "int", -1, Ptr, hFont, Ptr, &RectF, Ptr, hFormat, Ptr, pBrush)
  629. }
  630. Gdip_CreateLineBrush(x1, y1, x2, y2, ARGB1, ARGB2, WrapMode=1){
  631.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  632.     CreatePointF(PointF1, x1, y1), CreatePointF(PointF2, x2, y2)
  633.     DllCall("gdiplus\GdipCreateLineBrush", Ptr, &PointF1, Ptr, &PointF2, "Uint", ARGB1, "Uint", ARGB2, "int", WrapMode, A_PtrSize ? "UPtr*" : "UInt*", LGpBrush)
  634.     return LGpBrush
  635. }
  636. Gdip_CreateLineBrushFromRect(x, y, w, h, ARGB1, ARGB2, LinearGradientMode=1, WrapMode=1){
  637.     CreateRectF(RectF, x, y, w, h)
  638.     DllCall("gdiplus\GdipCreateLineBrushFromRect", A_PtrSize ? "UPtr" : "UInt", &RectF, "int", ARGB1, "int", ARGB2, "int", LinearGradientMode, "int", WrapMode, A_PtrSize ? "UPtr*" : "UInt*", LGpBrush)
  639.     return LGpBrush
  640. }
  641. Gdip_CloneBrush(pBrush){
  642.     DllCall("gdiplus\GdipCloneBrush", A_PtrSize ? "UPtr" : "UInt", pBrush, A_PtrSize ? "UPtr*" : "UInt*", pBrushClone)
  643.     return pBrushClone
  644. }
  645. Gdip_FontFamilyCreate(Font){
  646.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  647.     if (!A_IsUnicode)
  648.     {
  649.         nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &Font, "int", -1, "uint", 0, "int", 0)
  650.         VarSetCapacity(wFont, nSize*2)
  651.         DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &Font, "int", -1, Ptr, &wFont, "int", nSize)
  652.     }
  653.     DllCall("gdiplus\GdipCreateFontFamilyFromName", Ptr, A_IsUnicode ? &Font : &wFont, "uint", 0, A_PtrSize ? "UPtr*" : "UInt*", hFamily)
  654.     return hFamily
  655. }
  656. Gdip_SetStringFormatAlign(hFormat, Align){
  657.    return DllCall("gdiplus\GdipSetStringFormatAlign", A_PtrSize ? "UPtr" : "UInt", hFormat, "int", Align)
  658. }
  659. Gdip_StringFormatCreate(Format=0, Lang=0){
  660.    DllCall("gdiplus\GdipCreateStringFormat", "int", Format, "int", Lang, A_PtrSize ? "UPtr*" : "UInt*", hFormat)
  661.    return hFormat
  662. }
  663. Gdip_FontCreate(hFamily, Size, Style=0){
  664.    DllCall("gdiplus\GdipCreateFont", A_PtrSize ? "UPtr" : "UInt", hFamily, "float", Size, "int", Style, "int", 0, A_PtrSize ? "UPtr*" : "UInt*", hFont)
  665.    return hFont
  666. }
  667. Gdip_CreatePen(ARGB, w){
  668.    DllCall("gdiplus\GdipCreatePen1", "UInt", ARGB, "float", w, "int", 2, A_PtrSize ? "UPtr*" : "UInt*", pPen)
  669.    return pPen
  670. }
  671. Gdip_CreatePenFromBrush(pBrush, w){
  672.     DllCall("gdiplus\GdipCreatePen2", A_PtrSize ? "UPtr" : "UInt", pBrush, "float", w, "int", 2, A_PtrSize ? "UPtr*" : "UInt*", pPen)
  673.     return pPen
  674. }
  675. Gdip_BrushCreateSolid(ARGB=0xff000000){
  676.     DllCall("gdiplus\GdipCreateSolidFill", "UInt", ARGB, A_PtrSize ? "UPtr*" : "UInt*", pBrush)
  677.     return pBrush
  678. }
  679. Gdip_BrushCreateHatch(ARGBfront, ARGBback, HatchStyle=0){
  680.     DllCall("gdiplus\GdipCreateHatchBrush", "int", HatchStyle, "UInt", ARGBfront, "UInt", ARGBback, A_PtrSize ? "UPtr*" : "UInt*", pBrush)
  681.     return pBrush
  682. }
  683. CreateRectF(ByRef RectF, x, y, w, h){
  684.    VarSetCapacity(RectF, 16)
  685.    NumPut(x, RectF, 0, "float"), NumPut(y, RectF, 4, "float"), NumPut(w, RectF, 8, "float"), NumPut(h, RectF, 12, "float")
  686. }
  687. Gdip_SetTextRenderingHint(pGraphics, RenderingHint){
  688.     return DllCall("gdiplus\GdipSetTextRenderingHint", A_PtrSize ? "UPtr" : "UInt", pGraphics, "int", RenderingHint)
  689. }
  690. Gdip_MeasureString(pGraphics, sString, hFont, hFormat, ByRef RectF){
  691.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  692.     VarSetCapacity(RC, 16)
  693.     if !A_IsUnicode
  694.     {
  695.         nSize := DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &sString, "int", -1, "uint", 0, "int", 0)
  696.         VarSetCapacity(wString, nSize*2)
  697.         DllCall("MultiByteToWideChar", "uint", 0, "uint", 0, Ptr, &sString, "int", -1, Ptr, &wString, "int", nSize)
  698.     }
  699.     DllCall("gdiplus\GdipMeasureString", Ptr, pGraphics, Ptr, A_IsUnicode ? &sString : &wString, "int", -1, Ptr, hFont, Ptr, &RectF, Ptr, hFormat, Ptr, &RC, "uint*", Chars, "uint*", Lines)
  700.     return &RC ? NumGet(RC, 0, "float") "|" NumGet(RC, 4, "float") "|" NumGet(RC, 8, "float") "|" NumGet(RC, 12, "float") "|" Chars "|" Lines : 0
  701. }
  702. CreateRect(ByRef Rect, x, y, w, h){
  703.     VarSetCapacity(Rect, 16)
  704.     NumPut(x, Rect, 0, "uint"), NumPut(y, Rect, 4, "uint"), NumPut(w, Rect, 8, "uint"), NumPut(h, Rect, 12, "uint")
  705. }
  706. CreateSizeF(ByRef SizeF, w, h){
  707.    VarSetCapacity(SizeF, 8)
  708.    NumPut(w, SizeF, 0, "float"), NumPut(h, SizeF, 4, "float")
  709. }
  710. CreatePointF(ByRef PointF, x, y){
  711.    VarSetCapacity(PointF, 8)
  712.    NumPut(x, PointF, 0, "float"), NumPut(y, PointF, 4, "float")
  713. }
  714. Gdip_DrawArc(pGraphics, pPen, x, y, w, h, StartAngle, SweepAngle){
  715.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  716.     return DllCall("gdiplus\GdipDrawArc", Ptr, pGraphics, Ptr, pPen, "float", x, "float", y, "float", w, "float", h, "float", StartAngle, "float", SweepAngle)
  717. }
  718. Gdip_DrawPie(pGraphics, pPen, x, y, w, h, StartAngle, SweepAngle){
  719.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  720.     return DllCall("gdiplus\GdipDrawPie", Ptr, pGraphics, Ptr, pPen, "float", x, "float", y, "float", w, "float", h, "float", StartAngle, "float", SweepAngle)
  721. }
  722. Gdip_DrawLine(pGraphics, pPen, x1, y1, x2, y2){
  723.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  724.     return DllCall("gdiplus\GdipDrawLine", Ptr, pGraphics, Ptr, pPen, "float", x1, "float", y1, "float", x2, "float", y2)
  725. }
  726. Gdip_DrawLines(pGraphics, pPen, Points){
  727.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  728.     StringSplit, Points, Points, |
  729.     VarSetCapacity(PointF, 8*Points0)
  730.     Loop, %Points0%
  731.     {
  732.         StringSplit, Coord, Points%A_Index%, `,
  733.         NumPut(Coord1, PointF, 8*(A_Index-1), "float"), NumPut(Coord2, PointF, (8*(A_Index-1))+4, "float")
  734.     }
  735.     return DllCall("gdiplus\GdipDrawLines", Ptr, pGraphics, Ptr, pPen, Ptr, &PointF, "int", Points0)
  736. }
  737. Gdip_FillRectangle(pGraphics, pBrush, x, y, w, h){
  738.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  739.     return DllCall("gdiplus\GdipFillRectangle", Ptr, pGraphics, Ptr, pBrush, "float", x, "float", y, "float", w, "float", h)
  740. }
  741. Gdip_FillRoundedRectangle(pGraphics, pBrush, x, y, w, h, r){
  742.     Region := Gdip_GetClipRegion(pGraphics)
  743.     Gdip_SetClipRect(pGraphics, x-r, y-r, 2*r, 2*r, 4)
  744.     Gdip_SetClipRect(pGraphics, x+w-r, y-r, 2*r, 2*r, 4)
  745.     Gdip_SetClipRect(pGraphics, x-r, y+h-r, 2*r, 2*r, 4)
  746.     Gdip_SetClipRect(pGraphics, x+w-r, y+h-r, 2*r, 2*r, 4)
  747.     E := Gdip_FillRectangle(pGraphics, pBrush, x, y, w, h)
  748.     Gdip_SetClipRegion(pGraphics, Region, 0)
  749.     Gdip_SetClipRect(pGraphics, x-(2*r), y+r, w+(4*r), h-(2*r), 4)
  750.     Gdip_SetClipRect(pGraphics, x+r, y-(2*r), w-(2*r), h+(4*r), 4)
  751.     Gdip_FillEllipse(pGraphics, pBrush, x, y, 2*r, 2*r)
  752.     Gdip_FillEllipse(pGraphics, pBrush, x+w-(2*r), y, 2*r, 2*r)
  753.     Gdip_FillEllipse(pGraphics, pBrush, x, y+h-(2*r), 2*r, 2*r)
  754.     Gdip_FillEllipse(pGraphics, pBrush, x+w-(2*r), y+h-(2*r), 2*r, 2*r)
  755.     Gdip_SetClipRegion(pGraphics, Region, 0)
  756.     Gdip_DeleteRegion(Region)
  757.     return E
  758. }
  759. Gdip_GetClipRegion(pGraphics){
  760.     Region := Gdip_CreateRegion()
  761.     DllCall("gdiplus\GdipGetClip", A_PtrSize ? "UPtr" : "UInt", pGraphics, "UInt*", Region)
  762.     return Region
  763. }
  764. Gdip_SetClipRect(pGraphics, x, y, w, h, CombineMode=0){
  765.    return DllCall("gdiplus\GdipSetClipRect",  A_PtrSize ? "UPtr" : "UInt", pGraphics, "float", x, "float", y, "float", w, "float", h, "int", CombineMode)
  766. }
  767. Gdip_SetClipPath(pGraphics, Path, CombineMode=0){
  768.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  769.     return DllCall("gdiplus\GdipSetClipPath", Ptr, pGraphics, Ptr, Path, "int", CombineMode)
  770. }
  771. Gdip_ResetClip(pGraphics){
  772.    return DllCall("gdiplus\GdipResetClip", A_PtrSize ? "UPtr" : "UInt", pGraphics)
  773. }
  774. Gdip_FillEllipse(pGraphics, pBrush, x, y, w, h){
  775.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  776.     return DllCall("gdiplus\GdipFillEllipse", Ptr, pGraphics, Ptr, pBrush, "float", x, "float", y, "float", w, "float", h)
  777. }
  778. Gdip_FillRegion(pGraphics, pBrush, Region){
  779.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  780.     return DllCall("gdiplus\GdipFillRegion", Ptr, pGraphics, Ptr, pBrush, Ptr, Region)
  781. }
  782. Gdip_FillPath(pGraphics, pBrush, Path){
  783.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  784.     return DllCall("gdiplus\GdipFillPath", Ptr, pGraphics, Ptr, pBrush, Ptr, Path)
  785. }
  786. Gdip_CreateRegion(){
  787.     DllCall("gdiplus\GdipCreateRegion", "UInt*", Region)
  788.     return Region
  789. }
  790. Gdip_DeleteRegion(Region){
  791.     return DllCall("gdiplus\GdipDeleteRegion", A_PtrSize ? "UPtr" : "UInt", Region)
  792. }
  793. Gdip_CreateBitmap(Width, Height, Format=0x26200A){
  794.     DllCall("gdiplus\GdipCreateBitmapFromScan0", "int", Width, "int", Height, "int", 0, "int", Format, A_PtrSize ? "UPtr" : "UInt", 0, A_PtrSize ? "UPtr*" : "uint*", pBitmap)
  795.     Return pBitmap
  796. }
  797. Gdip_SetSmoothingMode(pGraphics, SmoothingMode){
  798.    return DllCall("gdiplus\GdipSetSmoothingMode", A_PtrSize ? "UPtr" : "UInt", pGraphics, "int", SmoothingMode)
  799. }
  800. Gdip_DrawRectangle(pGraphics, pPen, x, y, w, h){
  801.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  802.     return DllCall("gdiplus\GdipDrawRectangle", Ptr, pGraphics, Ptr, pPen, "float", x, "float", y, "float", w, "float", h)
  803. }
  804. Gdip_DrawRoundedRectangle(pGraphics, pPen, x, y, w, h, r){
  805.     Gdip_SetClipRect(pGraphics, x-r, y-r, 2*r, 2*r, 4)
  806.     Gdip_SetClipRect(pGraphics, x+w-r, y-r, 2*r, 2*r, 4)
  807.     Gdip_SetClipRect(pGraphics, x-r, y+h-r, 2*r, 2*r, 4)
  808.     Gdip_SetClipRect(pGraphics, x+w-r, y+h-r, 2*r, 2*r, 4)
  809.     E := Gdip_DrawRectangle(pGraphics, pPen, x, y, w, h)
  810.     Gdip_ResetClip(pGraphics)
  811.     Gdip_SetClipRect(pGraphics, x-(2*r), y+r, w+(4*r), h-(2*r), 4)
  812.     Gdip_SetClipRect(pGraphics, x+r, y-(2*r), w-(2*r), h+(4*r), 4)
  813.     Gdip_DrawEllipse(pGraphics, pPen, x, y, 2*r, 2*r)
  814.     Gdip_DrawEllipse(pGraphics, pPen, x+w-(2*r), y, 2*r, 2*r)
  815.     Gdip_DrawEllipse(pGraphics, pPen, x, y+h-(2*r), 2*r, 2*r)
  816.     Gdip_DrawEllipse(pGraphics, pPen, x+w-(2*r), y+h-(2*r), 2*r, 2*r)
  817.     Gdip_ResetClip(pGraphics)
  818.     return E
  819. }
  820. Gdip_DrawEllipse(pGraphics, pPen, x, y, w, h){
  821.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  822.     return DllCall("gdiplus\GdipDrawEllipse", Ptr, pGraphics, Ptr, pPen, "float", x, "float", y, "float", w, "float", h)
  823. }
  824. Gdip_CreateHBITMAPFromBitmap(pBitmap, Background=0xffffffff){
  825.     DllCall("gdiplus\GdipCreateHBITMAPFromBitmap", A_PtrSize ? "UPtr" : "UInt", pBitmap, A_PtrSize ? "UPtr*" : "uint*", hbm, "int", Background)
  826.     return hbm
  827. }
  828. SetImage(hwnd, hBitmap){
  829.     SendMessage, 0x172, 0x0, hBitmap,, ahk_id %hwnd%
  830.     E := ErrorLevel
  831.     DeleteObject(E)
  832.     return E
  833. }
  834. Gdip_FillPolygon(pGraphics, pBrush, Points, FillMode=0){
  835.     Ptr := A_PtrSize ? "UPtr" : "UInt"
  836.     StringSplit, Points, Points, |
  837.     VarSetCapacity(PointF, 8*Points0)
  838.     Loop, %Points0%
  839.     {
  840.         StringSplit, Coord, Points%A_Index%, `,
  841.         NumPut(Coord1, PointF, 8*(A_Index-1), "float"), NumPut(Coord2, PointF, (8*(A_Index-1))+4, "float")
  842.     }
  843.     return DllCall("gdiplus\GdipFillPolygon", Ptr, pGraphics, Ptr, pBrush, Ptr, &PointF, "int", Points0, "int", FillMode)
  844. }
  845.  
  846. Hover_Var(){
  847.     Hover_Var =
  848.     (% ` Join`r`n
  849. HB_Button_Hover(){
  850.     Static Index , Hover_On
  851.     MouseGetPos,,,, ctrl , 2
  852.     if( ! Hover_On && ctrl ){
  853.         loop , % HB_Button.Length()
  854.             if( ctrl = HB_Button[ A_Index ].hwnd )
  855.                 HB_Button[ A_Index ].Draw_Hover() , Index := A_Index , Hover_On := 1 , break
  856.     }else if( Hover_On = 1 )
  857.         if( ctrl != HB_Button[ Index ].Hwnd )
  858.             HB_Button[ Index ].Draw_Default() , Hover_On := 0
  859. }
  860.  
  861.     )
  862.     return Hover_Var
  863. }
  864.  
  865. Setup_Var(){
  866.     Setup_Var =
  867.     (% ` Join`r`n
  868. global HB_Button := []
  869. SetTimer, HB_Button_Hover , 50 
  870.    
  871.     )
  872.     return Setup_Var
  873. }
  874.  
  875. Class_Var(){
  876.     Class_Var =
  877.     (% ` Join`r`n
  878. class HB_Plain_Rounded_Button_Type_1    {
  879.     __New( x := 10 , y := 10 , w := 150 , h := 40 , Button_Color := "FF0000" , Button_Background_Color := "222222" , Text := "Button" , Font := "Arial" , Font_Size := 16 , Font_Color_Top := "000000" , Font_Color_Bottom := "FFFFFF" , Window := "1" , Label := "" ){
  880.         This.Text_Color_Top := "0xFF" Font_Color_Top , This.Text_Color_Bottom := "0xFF" Font_Color_Bottom , This.Font := Font , This.Font_Size := Font_Size , This.Text := Text
  881.         This.X := x , This.Y := y , This.W := w , This.H := h , This.Button_Background_Color := "0xFF" Button_Background_Color , This.Button_Color := "0xFF" Button_Color , This.Window := Window
  882.         This.Label := Label , This.Create_Default_Bitmap() , This.Create_Hover_Bitmap() , This.Create_Pressed_Bitmap() , This.Create_Trigger()
  883.         sleep, 20
  884.         This.Draw_Default()
  885.     }
  886.     Create_Trigger(){
  887.         global
  888.         num := HB_Button.Length() + 1
  889.         Gui , % This.Window ": Add" , Picture , % "x" This.X " y" This.Y " w" This.W " h" This.H " hwndHwnd_" Num " v" Num " g" This.Label " 0xE"
  890.         This.Number := Num , This.Hwnd := Hwnd_%num%
  891.     }
  892.     Create_Default_Bitmap(){
  893.         pBitmap:=Gdip_CreateBitmap( This.W, This.H )
  894.         G := Gdip_GraphicsFromImage( pBitmap )
  895.         Gdip_SetSmoothingMode( G , 2 )
  896.         Brush := Gdip_BrushCreateSolid( This.Button_Background_Color )
  897.         Gdip_FillRectangle( G , Brush , -1 , -1 , This.W+2 , This.H+2 )
  898.         Gdip_DeleteBrush( Brush )
  899.         Brush := Gdip_BrushCreateSolid( "0xFF222222" )
  900.         Gdip_FillRoundedRectangle( G , Brush , 2 , 2 , This.W-4 , This.H-3 , 16 )
  901.         Gdip_DeleteBrush( Brush )
  902.         Brush := Gdip_CreateLineBrushFromRect( 2 , -1 , This.W-4 , This.H-3 , "0xFF555555" , "0xFF000000" , 1 , 1 )
  903.         Gdip_FillRoundedRectangle( G , Brush , 2 , 0 , This.W-4 , This.H-3 , 16 )
  904.         Gdip_DeleteBrush( Brush )
  905.         if(This.Button_Color="0xFF000000"||This.Button_Color="0xFF111111")
  906.             Brush := Gdip_CreateLineBrushFromRect( 4 , -1 , This.W-6 , This.H+5 , "0xFF333333" , This.Button_Color , 1 , 1 )
  907.         else    
  908.             Brush := Gdip_CreateLineBrushFromRect( 4 , -1 , This.W-6 , This.H+5 , This.Button_Color , "0xFF333333" , 1 , 1 )
  909.         Gdip_FillRoundedRectangle( G , Brush , 3 , 1 , This.W-6 , This.H-5 , 16 )
  910.         Gdip_DeleteBrush( Brush )
  911.         Brush := Gdip_BrushCreateSolid( "0x22F0F0F0" )
  912.         Gdip_FillEllipse( G , Brush , This.W/15 , This.H/13 , This.W-(This.W/15*2) , This.H*0.45 )
  913.         Gdip_DeleteBrush( Brush )
  914.         Brush := Gdip_BrushCreateSolid( This.Text_Color_Bottom )
  915.         Gdip_TextToGraphics( G , This.Text , "s" This.Font_Size " Center vCenter Bold c" Brush " x-1 y-1" , This.Font , This.W , This.H )
  916.         Gdip_DeleteBrush( Brush )
  917.         Brush := Gdip_BrushCreateSolid( This.Text_Color_Top )
  918.         Gdip_TextToGraphics( G , This.Text , "s" This.Font_Size " Center vCenter Bold c" Brush " x0 y0" , This.Font , This.W , This.H )
  919.         Gdip_DeleteBrush( Brush )
  920.         Gdip_DeleteGraphics( G )
  921.         This.Default_Bitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap)
  922.         Gdip_DisposeImage(pBitmap)
  923.     }
  924.     Create_Hover_Bitmap(){
  925.         pBitmap:=Gdip_CreateBitmap( This.W , This.H )
  926.          G := Gdip_GraphicsFromImage( pBitmap )
  927.         Gdip_SetSmoothingMode( G , 2 )
  928.         Brush := Gdip_BrushCreateSolid( This.Button_Background_Color )
  929.         Gdip_FillRectangle( G , Brush , -1 , -1 , This.W+2 , This.H+2 )
  930.         Gdip_DeleteBrush( Brush )
  931.         Brush := Gdip_BrushCreateSolid( "0xFF222222" )
  932.         Gdip_FillRoundedRectangle( G , Brush , 2 , 2 , This.W-4 , This.H-3 , 16 )
  933.         Gdip_DeleteBrush( Brush )
  934.         Brush := Gdip_CreateLineBrushFromRect( 2 , -1 , This.W-4 , This.H-3 , "0xFF555555" , "0xFF000000" , 1 , 1 )
  935.         Gdip_FillRoundedRectangle( G , Brush , 2 , 0 , This.W-4 , This.H-3 , 16 )
  936.         Gdip_DeleteBrush( Brush )
  937.         if(This.Button_Color="0xFF000000"||This.Button_Color="0xFF111111")
  938.             Brush := Gdip_CreateLineBrushFromRect( 4 , -1 , This.W-6 , This.H+10 , "0xFF444444" , This.Button_Color , 1 , 1 )
  939.         else    
  940.             Brush := Gdip_CreateLineBrushFromRect( 4 , -1 , This.W-6 , This.H+10 , This.Button_Color , "0xFF444444" , 1 , 1 )
  941.         Gdip_FillRoundedRectangle( G , Brush , 3 , 1 , This.W-6 , This.H-5 , 16 )
  942.         Gdip_DeleteBrush( Brush )
  943.         Brush := Gdip_BrushCreateSolid( "0x22F0F0F0" )
  944.         Gdip_FillEllipse( G , Brush , This.W/15 , This.H/13 , This.W-(This.W/15*2) , This.H*0.45 )
  945.         Gdip_DeleteBrush( Brush )
  946.         Brush := Gdip_BrushCreateSolid( This.Text_Color_Bottom )
  947.         Gdip_TextToGraphics( G , This.Text , "s" This.Font_Size " Center vCenter Bold c" Brush " x-1 y-1" , This.Font , This.W , This.H )
  948.         Gdip_DeleteBrush( Brush )
  949.         Brush := Gdip_BrushCreateSolid( This.Text_Color_Top )
  950.         Gdip_TextToGraphics( G , This.Text , "s" This.Font_Size " Center vCenter Bold c" Brush " x0 y0" , This.Font , This.W , This.H )
  951.         Gdip_DeleteBrush( Brush )
  952.         Gdip_DeleteGraphics( G )
  953.         This.Hover_Bitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap)
  954.         Gdip_DisposeImage(pBitmap)
  955.     }
  956.     Create_Pressed_Bitmap(){
  957.         pBitmap:=Gdip_CreateBitmap( This.W , This.H )
  958.          G := Gdip_GraphicsFromImage( pBitmap )
  959.         Gdip_SetSmoothingMode( G , 2 )
  960.         Brush := Gdip_BrushCreateSolid( This.Button_Background_Color )
  961.         Gdip_FillRectangle( G , Brush , -1 , -1 , This.W+2 , This.H+2 )
  962.         Gdip_DeleteBrush( Brush )
  963.         Brush := Gdip_BrushCreateSolid( "0xFF222222" )
  964.         Gdip_DeleteBrush( Brush )
  965.         Brush := Gdip_CreateLineBrushFromRect( 2 , 0 , This.W-4 , This.H-3 , "0xFF555555" , "0xFF000000" , 1 , 1 )
  966.         Gdip_FillRoundedRectangle( G , Brush , 2 , 0 , This.W-4 , This.H-3 , 16 )
  967.         Gdip_DeleteBrush( Brush )
  968.         Brush := Gdip_CreateLineBrushFromRect( 4 , -1 , This.W-6 , This.H+5 , "0xFF333333" , This.Button_Color , 1 , 1 )
  969.         Gdip_FillRoundedRectangle( G , Brush , 3 , 1 , This.W-6 , This.H-5 , 16 )
  970.         Gdip_DeleteBrush( Brush )
  971.         Brush := Gdip_BrushCreateSolid( This.Text_Color_Bottom )
  972.         Gdip_TextToGraphics( G , This.Text , "s" This.Font_Size " Center vCenter Bold c" Brush " x-1 y-2" , This.Font , This.W , This.H )
  973.         Gdip_DeleteBrush( Brush )
  974.         Brush := Gdip_BrushCreateSolid( This.Text_Color_Top )
  975.         Gdip_TextToGraphics( G , This.Text , "s" This.Font_Size " Center vCenter Bold c" Brush " x0 y-1" , This.Font , This.W , This.H )
  976.         Gdip_DeleteBrush( Brush )
  977.         Gdip_DeleteGraphics( G )
  978.         This.Pressed_Bitmap := Gdip_CreateHBITMAPFromBitmap( pBitmap )
  979.         Gdip_DisposeImage( pBitmap )
  980.     }
  981.     Draw_Default(){
  982.         SetImage( This.Hwnd , This.Default_Bitmap )
  983.     }
  984.     Draw_Hover(){
  985.         SetImage( This.Hwnd , This.Hover_Bitmap )
  986.     }
  987.     Draw_Pressed(){
  988.         SetImage( This.Hwnd , This.Pressed_Bitmap )
  989.         SetTimer , HB_Button_Hover , Off
  990.         While( GetKeyState( "LButton" ) )
  991.             sleep , 10
  992.         SetTimer , HB_Button_Hover , On
  993.         MouseGetPos,,,, ctrl , 2
  994.         if( This.Hwnd != ctrl ){
  995.             This.Draw_Default()
  996.             return False
  997.         }else   {  
  998.             This.Draw_Hover()
  999.             return true
  1000.         }
  1001.     }
  1002. }
  1003.  
  1004.    
  1005.    
  1006.     )
  1007.     return Class_Var
  1008. }
  1009.  
  1010. Click_Var(){
  1011.     Click_Var =
  1012.     (% ` Join`r`n
  1013.     GuiControl , % HB_Button[ A_GuiControl ].Window ": Focus" , % HB_Button[ A_GuiControl ].Hwnd
  1014.     if( ! HB_Button[ A_GuiControl ].Draw_Pressed() )
  1015.         return
  1016.    
  1017.     )
  1018.     return Click_Var
  1019. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement