vanheartnet

Switch Class 1

Aug 23rd, 2020 (edited)
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.46 KB | None | 0 0
  1. /*
  2. SwitchLabel:
  3. Gui,1:Submit,Nohide
  4. ;-----------------------------------------------------
  5. ;~ GuiControl , % Switch[ A_GuiControl ].Window ": Focus" , % Switch[ A_GuiControl ].Hwnd
  6.  
  7. if(JJ=0){
  8. Switch[ A_GuiControl ].Draw_Bitmap_ON()
  9. IniWrite,1,gg.ini,sss,aa2
  10. JJ:=1
  11. }else{
  12. Switch[ A_GuiControl ].Draw_Bitmap_OFF()
  13. IniWrite,0,gg.ini,sss,aa2
  14. JJ:=0
  15. }
  16. ToolTip, % JJ
  17.  
  18. */
  19.  
  20.  
  21.  
  22. Class SWITCH_1{
  23. __New( x:=10, y:=10, w:= 100, h:= 30, state:=0, BG_Color:="222222", Switch_BG_Color:="333333", Switch_F_Color:="404040", Text_Color3:="00FF00", Switch_Border:="ffffff", Font_Size:=20, Text1:="SwitchON", Text2:="SwitchOFF", Text_Color1:="FF0000", Text_Color2:="00FF00", Window:="1", Label:="SwitchC"){
  24. This.X:=x
  25. This.Y:=y
  26. This.W:=w
  27. This.H:=h
  28. This.Window:=Window
  29. This.State:=state
  30. This.Font_Size := Font_Size
  31. This.Text_Color3:= "0xFF" Text_Color3
  32. This.BG_Color:= "0xFF" BG_Color
  33. This.Switch_BG_Color:= "0xFF" Switch_BG_Color
  34. This.Switch_F_Color:= "0xFF" Switch_F_Color
  35. This.Switch_Border:= "0xFF" Switch_Border
  36. This.Text1:=Text1
  37. This.Text2:=Text2
  38. This.Text_Color1:= "0xFF" Text_Color1
  39. This.Text_Color2:= "0xFF" Text_Color2
  40. This.Label:=Label
  41. This.Create_Switch_OFF()
  42. This.Create_Switch_ON()
  43. This.Adding_Control()
  44. sleep 20
  45. (This.State=0)?(This.Draw_Bitmap_OFF()):(This.Draw_Bitmap_ON())
  46. }
  47. Adding_Control(){
  48. Global
  49. num := Switch.Length()+1
  50. Gui , % This.Window " : Add" , Picture , % "x" This.X " y" This.Y " w" This.W " h" This.H " hwndHwnd v" Num " g" This.Label " 0xE"
  51. This.Number := Num , This.Hwnd := Hwnd
  52. }
  53.  
  54.  
  55. Create_Switch_OFF{
  56. ;Bitmap Created Using: HB Bitmap Maker
  57. pBitmap:=Gdip_CreateBitmap( 100 , 30 )
  58. G := Gdip_GraphicsFromImage( pBitmap )
  59. Gdip_SetSmoothingMode( G , 4 )
  60. ;background
  61. Brush := Gdip_BrushCreateSolid( "0xFF333333" )
  62. Gdip_FillRectangle( G , Brush , -1 , -1 , 104 , 33 )
  63. Gdip_DeleteBrush( Brush )
  64. ;rounddedbackground
  65. Brush := Gdip_BrushCreateSolid( "0xFF000000" )
  66. Gdip_FillRoundedRectangle( G , Brush , 6 , 3 , 89 , 24 , 5 )
  67. Gdip_DeleteBrush( Brush )
  68. Pen := Gdip_CreatePen( "0xFFff0000" , 1 )
  69. Gdip_DrawRoundedRectangle( G , Pen , 5 , 3 , 90 , 24 , 5 )
  70. Gdip_DeletePen( Pen )
  71. ;backcolor
  72. Brush := Gdip_BrushCreateSolid( "0xFF666666" )
  73. Gdip_FillRoundedRectangle( G , Brush , 7 , 4 , 50 , 22 , 5 )
  74. Gdip_DeleteBrush( Brush )
  75. ;fontcolor
  76. Brush := Gdip_CreateLineBrushFromRect( 0 , 10 , 100 , 100 , "0xFF404040" , "0xFFffffff" , 1 , 1 )
  77. Gdip_FillRoundedRectangle( G , Brush , 7 , 4 , 50 , 22 , 5 )
  78. Gdip_DeleteBrush( Brush )
  79. Pen := Gdip_CreatePen( "0xFFffffff" , 1 )
  80. Gdip_DrawRoundedRectangle( G , Pen , 7 , 4 , 50 , 22 , 5 )
  81. Gdip_DeletePen( Pen )
  82. ;BACK CIRCLE
  83. Brush := Gdip_BrushCreateSolid( "0xFF222222" )
  84. Gdip_FillEllipse( G , Brush , 16 , 9 , 12 , 12 )
  85. Gdip_DeleteBrush( Brush )
  86. ;FONTCIRCLE
  87. Brush := Gdip_BrushCreateSolid( "0xFFff0000" )
  88. Gdip_FillEllipse( G , Brush , 17 , 10 , 10 , 10 )
  89. Gdip_DeleteBrush( Brush )
  90. ;BACK TEXT
  91. Brush := Gdip_BrushCreateSolid( "0xFFFFFFFF" )
  92. ;BACK TEXT
  93. Gdip_TextToGraphics( G , "OFF" , "s12 Center vCenter Bold c" Brush " x50 y-10" , "Segoe UI" , 50 , 50 )
  94. Gdip_DeleteBrush( Brush )
  95. ;FONT TEXT
  96. Brush := Gdip_BrushCreateSolid( "0xFFFF0000" )
  97. ;FONT TEXT
  98. Gdip_TextToGraphics( G , "OFF" , "s12 Center vCenter Bold c" Brush " x51 y-9" , "Segoe UI" , 50 , 50 )
  99. Gdip_DeleteBrush( Brush )
  100. Gdip_DeleteGraphics( G )
  101. This.Draw_OFF_Bitmap := Gdip_CreateHBITMAPFromBitmap(pBitmap)
  102. Gdip_DisposeImage(pBitmap)
  103. }
  104. Create_Switch_ON{
  105. ;Bitmap Created Using: HB Bitmap Maker
  106. pBitmap:=Gdip_CreateBitmap( 100 , 30 )
  107. G := Gdip_GraphicsFromImage( pBitmap )
  108. Gdip_SetSmoothingMode( G , 4 )
  109. ;background
  110. Brush := Gdip_BrushCreateSolid( "0xFF333333" )
  111. Gdip_FillRectangle( G , Brush , -1 , -1 , 104 , 33 )
  112. Gdip_DeleteBrush( Brush )
  113. ;rounddedbackground
  114. Brush := Gdip_BrushCreateSolid( "0xFF000000" )
  115. Gdip_FillRoundedRectangle( G , Brush , 6 , 3 , 89 , 24 , 5 )
  116. Gdip_DeleteBrush( Brush )
  117. ;backcolor
  118. Brush := Gdip_BrushCreateSolid( "0xFF666666" )
  119. Gdip_FillRoundedRectangle( G , Brush , 44 , 4 , 50 , 22 , 5 )
  120. Gdip_DeleteBrush( Brush )
  121. ;fontcolor
  122. Brush := Gdip_CreateLineBrushFromRect( 0 , 10 , 100 , 100 , "0xFF404040" , "0xFFffffff" , 1 , 1 )
  123. Gdip_FillRoundedRectangle( G , Brush , 44 , 4 , 50 , 22 , 5 )
  124. Gdip_DeleteBrush( Brush )
  125. Pen := Gdip_CreatePen( "0xFF00ff00" , 1 )
  126. Gdip_DrawRoundedRectangle( G , Pen , 7 , 3 , 89 , 24 , 5 )
  127. Gdip_DeletePen( Pen )
  128. Pen := Gdip_CreatePen( "0xFFffffff" , 1 )
  129. Gdip_DrawRoundedRectangle( G , Pen , 44 , 4 , 50 , 22 , 5 )
  130. Gdip_DeletePen( Pen )
  131. ;BACK CIRCLE
  132. Brush := Gdip_BrushCreateSolid( "0xFF222222" )
  133. Gdip_FillEllipse( G , Brush , 76 , 9 , 12 , 12 )
  134. Gdip_DeleteBrush( Brush )
  135. ;FONTCIRCLE
  136. Brush := Gdip_BrushCreateSolid( "0xFF00FF00" )
  137. Gdip_FillEllipse( G , Brush , 77 , 10 , 10 , 10 )
  138. Gdip_DeleteBrush( Brush )
  139. ;BACK TEXT
  140. Brush := Gdip_BrushCreateSolid( "0xFFFFFFFF" )
  141. ;BACK TEXT
  142. Gdip_TextToGraphics( G , "ON" , "s12 Center vCenter Bold c" Brush " x0 y-10" , "Segoe UI" , 50 , 50 )
  143. Gdip_DeleteBrush( Brush )
  144. ;FONT TEXT
  145. Brush := Gdip_BrushCreateSolid( "0xFF00FF00" )
  146. ;FONT TEXT
  147. Gdip_TextToGraphics( G , "ON" , "s12 Center vCenter Bold c" Brush " x1 y-9" , "Segoe UI" , 50 , 50 )
  148. Gdip_DeleteBrush( Brush )
  149. Gdip_DeleteGraphics( G )
  150. This.Draw_ON_Bitmap:= Gdip_CreateHBITMAPFromBitmap(pBitmap)
  151. Gdip_DisposeImage(pBitmap)
  152. }
  153.  
  154. Draw_Bitmap_ON(){
  155. SetImage( This.Hwnd , This.Draw_ON_Bitmap )
  156. }
  157. Draw_Bitmap_OFF(){
  158. SetImage( This.Hwnd , This.Draw_OFF_Bitmap )
  159. }
  160.  
  161. }
  162.  
Advertisement
Add Comment
Please, Sign In to add comment