Advertisement
Guest User

Mavamaarten is really sexy

a guest
May 4th, 2014
1,407
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Imports System.Drawing.Drawing2D
  2. Imports System.ComponentModel
  3.  
  4. '###################################################
  5. '#                                                 #
  6. '#              COLOR BY Mavamaarten               #
  7. '#                                                 #
  8. '#              THEME & CODE BY Patak              #  
  9. '#                                                 #
  10. '###################################################
  11.  
  12. Public Class DesignForm
  13. #Region " Gestion du type de Control "
  14.  
  15.     Inherits ContainerControl
  16.  
  17. #End Region
  18.  
  19. #Region " Initialisation de variable "
  20.  
  21.     Private Locked As Boolean = False
  22.     Private Position As Point = Nothing
  23.  
  24.     Dim Couleur_Ecriture As Color = Color.FromArgb(70, 70, 70)
  25.     Dim Couleur_BackColor As Color = Color.FromArgb(25, 25, 25)
  26.  
  27.     Dim Couleur_Degrade1 As Color = Color.FromArgb(35, 35, 35)
  28.     Dim Couleur_Degrade2 As Color = Color.FromArgb(25, 25, 25)
  29.  
  30.     Dim Couleur_BordureExt As Color = Color.Black
  31.  
  32.     Dim Couleur_BordureInt1_Haut As Color = Color.FromArgb(74, 74, 74)
  33.     Dim Couleur_BordureInt1_Bas As Color = Color.FromArgb(39, 39, 39)
  34.     Dim Couleur_BordureInt2 As Color = Color.FromArgb(43, 43, 43)
  35.  
  36.     Dim Couleur_Separation1 As Color = Color.Black
  37.     Dim Couleur_Separation2 As Color = Color.FromArgb(0, 255, 0)
  38.     Dim Couleur_Separation3 As Color = Color.Black
  39.  
  40.     Dim Hauteur_Barre As Integer = 33
  41.  
  42. #End Region
  43.  
  44. #Region " Gestion du New "
  45.  
  46.     Sub New()
  47.         Dock = DockStyle.Fill
  48.         Font = New Font("Verdana", 10, FontStyle.Regular)
  49.         SendToBack()
  50.         DoubleBuffered = True
  51.         Padding = New Padding(2, 36, 2, 2)
  52.  
  53.     End Sub
  54.  
  55. #End Region
  56.  
  57. #Region " Propriétés "
  58.  
  59.     Public Overrides Property Text As String
  60.         Get
  61.             Return MyBase.Text
  62.         End Get
  63.         Set(ByVal Value As String)
  64.             MyBase.Text = Value
  65.             Invalidate()
  66.         End Set
  67.     End Property
  68.  
  69. #End Region
  70.  
  71. #Region " Gestion et création du design "
  72.  
  73.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  74.         MyBase.OnPaint(e)
  75.         e.Graphics.SmoothingMode = SmoothingMode.Default
  76.  
  77.         'BACKGROUND
  78.  
  79.         e.Graphics.Clear(Couleur_BackColor)
  80.  
  81.         'HAUT
  82.  
  83.         Dim Rectangle_Haut As New Rectangle(0, 0, Width, Hauteur_Barre)
  84.         Dim  Haut_Brush As New LinearGradientBrush(Rectangle_Haut, Couleur_Degrade1,  Couleur_Degrade2, LinearGradientMode.Vertical)
  85.         e.Graphics.FillRectangle(Haut_Brush, Rectangle_Haut)
  86.         Haut_Brush.Dispose()
  87.  
  88.         'ECRITURE
  89.  
  90.         Dim StringFormat As New StringFormat
  91.         StringFormat.LineAlignment = StringAlignment.Center
  92.         StringFormat.Alignment = StringAlignment.Near
  93.  
  94.         Dim Rectangle_Ecriture As New Rectangle(15, 0, Width - 15, Hauteur_Barre)
  95.  
  96.         e.Graphics.DrawString(Text, Font, New SolidBrush(Couleur_Ecriture), Rectangle_Ecriture, StringFormat)
  97.         StringFormat.Dispose()
  98.  
  99.         'BORDURE INT1
  100.  
  101.         Dim Rectangle_BordureInt1 As New Rectangle(1, 1, Width - 3, Hauteur_Barre - 4)
  102.         Dim Rectangle_BordureInt1_AvecBordure As New Rectangle(0, 0, Width - 1, Hauteur_Barre - 2)
  103.  
  104.         Dim  Brush_BordureInt1 As New  LinearGradientBrush(Rectangle_BordureInt1_AvecBordure,  Couleur_BordureInt1_Haut, Couleur_BordureInt1_Bas,  LinearGradientMode.Vertical)
  105.         e.Graphics.DrawRectangle(New Pen(Brush_BordureInt1, 1), Rectangle_BordureInt1)
  106.  
  107.         'BORDURE INT2
  108.  
  109.         Dim Rectangle_BordureInt2 As New Rectangle(1, Hauteur_Barre + 2, Width - 3, Height - Hauteur_Barre - 4)
  110.         e.Graphics.DrawRectangle(New Pen(Couleur_BordureInt2, 1), Rectangle_BordureInt2)
  111.  
  112.         'SEPARATION
  113.  
  114.         Dim Separation_Point1 As New Point(0, Hauteur_Barre)
  115.         Dim Separation_Point2 As New Point(Width, Hauteur_Barre)
  116.  
  117.         Dim Separation_Brush As New LinearGradientBrush(Separation_Point1, Separation_Point2, Color.Black, Color.Black)
  118.  
  119.         Dim ColorBlend As New ColorBlend
  120.         ColorBlend.Colors = New Color() {Couleur_Separation1, Couleur_Separation2, Couleur_Separation3}
  121.         ColorBlend.Positions = New Single() {0, 0.5, 1}
  122.  
  123.         Separation_Brush.InterpolationColors = ColorBlend
  124.  
  125.         e.Graphics.DrawLine(New Pen(Separation_Brush, 2), Separation_Point1, Separation_Point2)
  126.  
  127.         Separation_Brush.Dispose()
  128.  
  129.         'BORDURE EXT1
  130.  
  131.         Dim Rectangle_BordureExt1 As New Rectangle(0, 0, Width - 1, Hauteur_Barre - 2)
  132.         e.Graphics.DrawRectangle(New Pen(Couleur_BordureExt, 1), Rectangle_BordureExt1)
  133.  
  134.         'BORDURE EXT2
  135.  
  136.         Dim Rectangle_BordureExt2 As New Rectangle(0, Hauteur_Barre + 1, Width - 1, Height - Hauteur_Barre - 2)
  137.         e.Graphics.DrawRectangle(New Pen(Couleur_BordureExt, 1), Rectangle_BordureExt2)
  138.  
  139.     End Sub
  140.  
  141. #End Region
  142.  
  143. #Region " Gestion des actions "
  144.  
  145.     Protected Overrides Sub OnHandleCreated(ByVal e As System.EventArgs)
  146.         MyBase.OnHandleCreated(e)
  147.         FindForm.FormBorderStyle = FormBorderStyle.None
  148.     End Sub
  149.  
  150.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  151.         MyBase.OnMouseDown(e)
  152.         Dim Rectangle As New Rectangle(0, 0, Width, Hauteur_Barre)
  153.         If (Rectangle.Contains(e.Location)) Then
  154.             Locked = True
  155.             Position = e.Location
  156.         End If
  157.     End Sub
  158.  
  159.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  160.         MyBase.OnMouseUp(e)
  161.         Locked = False
  162.     End Sub
  163.  
  164.     Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
  165.         MyBase.OnMouseMove(e)
  166.         If (Locked) Then
  167.             FindForm.Location = Cursor.Position - Position
  168.         End If
  169.     End Sub
  170.  
  171.     Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  172.         MyBase.OnResize(e)
  173.         Invalidate()
  174.     End Sub
  175.  
  176. #End Region
  177. End Class
  178.  
  179. Public Class DesignControlBox
  180. #Region " Gestion du type de Control "
  181.  
  182.     Inherits Control
  183.  
  184. #End Region
  185.  
  186. #Region " Initialisation de variable "
  187.  
  188.     Dim Couleur_Ecriture_None As Color = Color.FromArgb(70, 70, 70)
  189.     Dim Couleur_Ecriture_Over As Color = Color.FromArgb(150, 150, 150)
  190.     Dim Couleur_Ecriture_Down As Color = Color.FromArgb(200, 200, 200)
  191.  
  192.     Dim Etat_Bouton As Etat = Etat.None
  193.     Dim Position As New Point
  194.  
  195. #End Region
  196.  
  197. #Region " Initialisation des Enum "
  198.  
  199.     Enum Etat As Integer
  200.         None
  201.         Over
  202.         Down
  203.     End Enum
  204.  
  205. #End Region
  206.  
  207. #Region " Gestion du New "
  208.  
  209.     Sub New()
  210.         Me.Size = New Size(40, 20)
  211.         Me.SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  212.         Me.BackColor = Color.Transparent
  213.         Me.Anchor = AnchorStyles.Top Or AnchorStyles.Right
  214.         DoubleBuffered = True
  215.     End Sub
  216.  
  217. #End Region
  218.  
  219. #Region " Gestion et création du design "
  220.  
  221.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  222.         MyBase.OnPaint(e)
  223.         e.Graphics.SmoothingMode = SmoothingMode.Default
  224.  
  225.         Dim Point_Min As New Point(2, 4)
  226.         Dim Point_Close As New Point(22, 5)
  227.  
  228.         'GESTION DES ETATS
  229.  
  230.         Dim Couleur_Ecriture As Color
  231.  
  232.         Select Case Etat_Bouton
  233.             Case Etat.None
  234.                 Couleur_Ecriture = Couleur_Ecriture_None
  235.             Case Etat.Over
  236.                 Couleur_Ecriture = Couleur_Ecriture_Over
  237.             Case Etat.Down
  238.                 Couleur_Ecriture = Couleur_Ecriture_Down
  239.         End Select
  240.  
  241.         'ECRITURE
  242.  
  243.         If (Position.X <= 20) Then
  244.             e.Graphics.DrawString("0", New Font("Marlett", 8), New SolidBrush(Couleur_Ecriture), Point_Min)
  245.             e.Graphics.DrawString("r", New Font("Marlett", 8), New SolidBrush(Couleur_Ecriture_None), Point_Close)
  246.         Else
  247.             e.Graphics.DrawString("0", New Font("Marlett", 8), New SolidBrush(Couleur_Ecriture_None), Point_Min)
  248.             e.Graphics.DrawString("r", New Font("Marlett", 8), New SolidBrush(Couleur_Ecriture), Point_Close)
  249.         End If
  250.     End Sub
  251.  
  252. #End Region
  253.  
  254. #Region " Gestion des actions "
  255.  
  256.     Protected Overrides Sub OnMouseMove(e As System.Windows.Forms.MouseEventArgs)
  257.         MyBase.OnMouseMove(e)
  258.         Position = e.Location
  259.         Invalidate()
  260.     End Sub
  261.  
  262.     Protected Overrides Sub OnClick(e As System.EventArgs)
  263.         MyBase.OnClick(e)
  264.         If (Position.X <= 20) Then
  265.             FindForm.WindowState = FormWindowState.Minimized
  266.         Else
  267.             FindForm.Close()
  268.         End If
  269.     End Sub
  270.  
  271.     Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  272.         MyBase.OnMouseEnter(e)
  273.         Etat_Bouton = Etat.Over
  274.         Invalidate()
  275.     End Sub
  276.  
  277.     Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  278.         MyBase.OnMouseLeave(e)
  279.         Etat_Bouton = Etat.None
  280.         Invalidate()
  281.     End Sub
  282.  
  283.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  284.         MyBase.OnMouseDown(e)
  285.         Etat_Bouton = Etat.Down
  286.         Invalidate()
  287.     End Sub
  288.  
  289.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  290.         MyBase.OnMouseUp(e)
  291.         Etat_Bouton = Etat.Over
  292.         Invalidate()
  293.     End Sub
  294.  
  295.     Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  296.         MyBase.OnResize(e)
  297.         Invalidate()
  298.     End Sub
  299.  
  300. #End Region
  301. End Class
  302.  
  303. Public Class DesignGroupBox
  304. #Region " Gestion du type de Control "
  305.  
  306.     Inherits ContainerControl
  307.  
  308. #End Region
  309.  
  310. #Region " Initialisation de variable "
  311.  
  312.     Dim Couleur_Ecriture As Color = Color.DarkGray
  313.     Dim Couleur_BackColor As Color = Color.FromArgb(27, 27, 27)
  314.  
  315.     Dim Couleur_Degrade1 As Color = Color.FromArgb(39, 39, 39)
  316.     Dim Couleur_Degrade2 As Color = Color.FromArgb(24, 24, 24)
  317.  
  318.     Dim Couleur_BordureExt As Color = Color.Black
  319.  
  320.     Dim Couleur_BordureInt1_Haut As Color = Color.FromArgb(52, 52, 52)
  321.     Dim Couleur_BordureInt1_Bas As Color = Color.FromArgb(37, 37, 37)
  322.     Dim Couleur_BordureInt2 As Color = Color.FromArgb(43, 43, 43)
  323.  
  324.     Dim Couleur_Separation As Color = Color.Black
  325.  
  326.     Dim Hauteur_Barre As Integer = 25
  327.  
  328. #End Region
  329.  
  330. #Region " Gestion du New "
  331.  
  332.     Sub New()
  333.         Me.Size = New Size(172, 108)
  334.         Font = New Font("Verdana", 8.25, FontStyle.Regular)
  335.         DoubleBuffered = True
  336.         Padding = New Padding(2, 27, 2, 2)
  337.     End Sub
  338.  
  339. #End Region
  340.  
  341. #Region " Propriétés "
  342.  
  343.     Public Overrides Property Text As String
  344.         Get
  345.             Return MyBase.Text
  346.         End Get
  347.         Set(ByVal Value As String)
  348.             MyBase.Text = Value
  349.             Invalidate()
  350.         End Set
  351.     End Property
  352.  
  353. #End Region
  354.  
  355. #Region " Gestion et création du design "
  356.  
  357.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  358.         MyBase.OnPaint(e)
  359.         e.Graphics.SmoothingMode = SmoothingMode.Default
  360.  
  361.         'BACKGROUND
  362.  
  363.         e.Graphics.Clear(Couleur_BackColor)
  364.  
  365.         'HAUT
  366.  
  367.         Dim Rectangle_Haut As New Rectangle(0, 0, Width, Hauteur_Barre)
  368.         Dim  Haut_Brush As New LinearGradientBrush(Rectangle_Haut, Couleur_Degrade1,  Couleur_Degrade2, LinearGradientMode.Vertical)
  369.         e.Graphics.FillRectangle(Haut_Brush, Rectangle_Haut)
  370.         Haut_Brush.Dispose()
  371.  
  372.         'ECRITURE
  373.  
  374.         Dim StringFormat As New StringFormat
  375.         StringFormat.LineAlignment = StringAlignment.Center
  376.         StringFormat.Alignment = StringAlignment.Near
  377.  
  378.         Dim Rectangle_Ecriture As New Rectangle(9, 2, Width - 9, Hauteur_Barre - 2)
  379.  
  380.         e.Graphics.DrawString(Text, Font, New SolidBrush(Couleur_Ecriture), Rectangle_Ecriture, StringFormat)
  381.         StringFormat.Dispose()
  382.  
  383.         'BORDURE INT1
  384.  
  385.         Dim Rectangle_BordureInt1 As New Rectangle(1, 1, Width - 3, Hauteur_Barre - 2)
  386.         Dim Rectangle_BordureInt1_AvecBordure As New Rectangle(0, 0, Width - 1, Hauteur_Barre)
  387.  
  388.         Dim  Brush_BordureInt1 As New  LinearGradientBrush(Rectangle_BordureInt1_AvecBordure,  Couleur_BordureInt1_Haut, Couleur_BordureInt1_Bas,  LinearGradientMode.Vertical)
  389.         e.Graphics.DrawRectangle(New Pen(Brush_BordureInt1, 1), Rectangle_BordureInt1)
  390.  
  391.         'BORDURE INT2
  392.  
  393.         Dim Rectangle_BordureInt2 As New Rectangle(1, Hauteur_Barre, Width - 3, Height - Hauteur_Barre - 2)
  394.         e.Graphics.DrawRectangle(New Pen(Couleur_BordureInt2, 1), Rectangle_BordureInt2)
  395.  
  396.         'SEPARATION
  397.  
  398.         Dim Separation_Point1 As New Point(0, Hauteur_Barre)
  399.         Dim Separation_Point2 As New Point(Width, Hauteur_Barre)
  400.  
  401.         e.Graphics.DrawLine(New Pen(Couleur_Separation, 1), Separation_Point1, Separation_Point2)
  402.  
  403.         'BORDURE EXT
  404.  
  405.         Dim Rectangle_BordureExt As New Rectangle(0, 0, Width - 1, Height - 1)
  406.         e.Graphics.DrawRectangle(New Pen(Couleur_BordureExt, 1), Rectangle_BordureExt)
  407.  
  408.     End Sub
  409.  
  410. #End Region
  411.  
  412. #Region " Gestion des actions "
  413.  
  414.     Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  415.         MyBase.OnResize(e)
  416.         Invalidate()
  417.     End Sub
  418.  
  419. #End Region
  420. End Class
  421.  
  422. Public Class DesignButton
  423. #Region " Gestion du type de Control "
  424.  
  425.     Inherits Control
  426.  
  427. #End Region
  428.  
  429. #Region " Initialisation de variable "
  430.  
  431.     Dim Couleur_Ecriture As Color = Color.FromArgb(170, 170, 170)
  432.  
  433.     Dim Couleur_Degrade1_None As Color = Color.FromArgb(40, 40, 40)
  434.     Dim Couleur_Degrade2_None As Color = Color.FromArgb(20, 20, 20)
  435.  
  436.     Dim Couleur_Degrade1_Over As Color = Color.FromArgb(46, 46, 46)
  437.     Dim Couleur_Degrade2_Over As Color = Color.FromArgb(26, 26, 26)
  438.  
  439.     Dim Couleur_Degrade1_Down As Color = Color.FromArgb(37, 37, 37)
  440.     Dim Couleur_Degrade2_Down As Color = Color.FromArgb(18, 18, 18)
  441.  
  442.     Dim Couleur_BordureExt As Color = Color.Black
  443.  
  444.     Dim Couleur_BordureInt_Haut_None As Color = Color.FromArgb(53, 53, 53)
  445.     Dim Couleur_BordureInt_Bas_None As Color = Color.FromArgb(34, 34, 34)
  446.  
  447.     Dim Couleur_BordureInt_Haut_Over As Color = Color.FromArgb(58, 58, 58)
  448.     Dim Couleur_BordureInt_Bas_Over As Color = Color.FromArgb(39, 39, 39)
  449.  
  450.     Dim Couleur_BordureInt_Haut_Down As Color = Color.FromArgb(50, 50, 50)
  451.     Dim Couleur_BordureInt_Bas_Down As Color = Color.FromArgb(32, 32, 32)
  452.  
  453.     Dim Etat_Bouton As Etat = Etat.None
  454.  
  455. #End Region
  456.  
  457. #Region " Initialisation des Enum "
  458.  
  459.     Enum Etat As Integer
  460.         None
  461.         Over
  462.         Down
  463.     End Enum
  464.  
  465. #End Region
  466.  
  467. #Region " Gestion du New "
  468.  
  469.     Sub New()
  470.         Me.Size = New Size(130, 40)
  471.         Font = New Font("Verdana", 9, FontStyle.Regular)
  472.         DoubleBuffered = True
  473.     End Sub
  474.  
  475. #End Region
  476.  
  477. #Region " Propriétés "
  478.  
  479.     Public Overrides Property Text As String
  480.         Get
  481.             Return MyBase.Text
  482.         End Get
  483.         Set(ByVal Value As String)
  484.             MyBase.Text = Value
  485.             Invalidate()
  486.         End Set
  487.     End Property
  488.  
  489. #End Region
  490.  
  491. #Region " Gestion et création du design "
  492.  
  493.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  494.         MyBase.OnPaint(e)
  495.         e.Graphics.SmoothingMode = SmoothingMode.Default
  496.  
  497.         'GESTION DES ETATS
  498.  
  499.         Dim Couleur_Degrade1 As New Color
  500.         Dim Couleur_Degrade2 As New Color
  501.  
  502.         Dim Couleur_BordureInt_Haut As New Color
  503.         Dim Couleur_BordureInt_Bas As New Color
  504.  
  505.         Select Case Etat_Bouton
  506.             Case Etat.None
  507.                 Couleur_Degrade1 = Couleur_Degrade1_None
  508.                 Couleur_Degrade2 = Couleur_Degrade2_None
  509.  
  510.                 Couleur_BordureInt_Haut = Couleur_BordureInt_Haut_None
  511.                 Couleur_BordureInt_Bas = Couleur_BordureInt_Bas_None
  512.             Case Etat.Over
  513.                 Couleur_Degrade1 = Couleur_Degrade1_Over
  514.                 Couleur_Degrade2 = Couleur_Degrade2_Over
  515.  
  516.                 Couleur_BordureInt_Haut = Couleur_BordureInt_Haut_Over
  517.                 Couleur_BordureInt_Bas = Couleur_BordureInt_Bas_Over
  518.             Case Etat.Down
  519.                 Couleur_Degrade1 = Couleur_Degrade1_Down
  520.                 Couleur_Degrade2 = Couleur_Degrade2_Down
  521.  
  522.                 Couleur_BordureInt_Haut = Couleur_BordureInt_Haut_Down
  523.                 Couleur_BordureInt_Bas = Couleur_BordureInt_Bas_Down
  524.         End Select
  525.  
  526.         'BACKGROUND
  527.  
  528.         Dim Rectangle_Haut As New Rectangle(0, 0, Width, Height)
  529.  
  530.         Dim  Haut_Brush As LinearGradientBrush = New  LinearGradientBrush(Rectangle_Haut, Couleur_Degrade1, Couleur_Degrade2,  LinearGradientMode.Vertical)
  531.         e.Graphics.FillRectangle(Haut_Brush, Rectangle_Haut)
  532.         Haut_Brush.Dispose()
  533.  
  534.         'ECRITURE
  535.  
  536.         Dim StringFormat As New StringFormat
  537.         StringFormat.LineAlignment = StringAlignment.Center
  538.         StringFormat.Alignment = StringAlignment.Center
  539.  
  540.         Dim Rectangle_Ecriture As New Rectangle(0, 0, Width, Height)
  541.  
  542.         e.Graphics.DrawString(Text, Font, New SolidBrush(Couleur_Ecriture), Rectangle_Ecriture, StringFormat)
  543.  
  544.         'BORDURE INT
  545.  
  546.         Dim Rectangle_BordureInt As New Rectangle(1, 1, Width - 3, Height - 3)
  547.         Dim Rectangle_BordureInt_AvecBordure As New Rectangle(0, 0, Width - 1, Height - 1)
  548.  
  549.         Dim  Brush_BordureInt As New  LinearGradientBrush(Rectangle_BordureInt_AvecBordure,  Couleur_BordureInt_Haut, Couleur_BordureInt_Bas,  LinearGradientMode.Vertical)
  550.         e.Graphics.DrawRectangle(New Pen(Brush_BordureInt, 1), Rectangle_BordureInt)
  551.  
  552.         'BORDURE EXT
  553.  
  554.         Dim Rectangle_BordureExt As New Rectangle(0, 0, Width - 1, Height - 1)
  555.         e.Graphics.DrawRectangle(New Pen(Couleur_BordureExt, 1), Rectangle_BordureExt)
  556.     End Sub
  557.  
  558. #End Region
  559.  
  560. #Region " Gestion des actions "
  561.  
  562.     Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  563.         MyBase.OnMouseEnter(e)
  564.         Etat_Bouton = Etat.Over
  565.         Invalidate()
  566.     End Sub
  567.  
  568.     Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  569.         MyBase.OnMouseLeave(e)
  570.         Etat_Bouton = Etat.None
  571.         Invalidate()
  572.     End Sub
  573.  
  574.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  575.         MyBase.OnMouseDown(e)
  576.         Etat_Bouton = Etat.Down
  577.         Invalidate()
  578.     End Sub
  579.  
  580.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  581.         MyBase.OnMouseUp(e)
  582.         Etat_Bouton = Etat.Over
  583.         Invalidate()
  584.     End Sub
  585.  
  586.     Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  587.         MyBase.OnResize(e)
  588.         Invalidate()
  589.     End Sub
  590.  
  591. #End Region
  592. End Class
  593.  
  594. <DefaultEvent("CheckedChanged")> _
  595. Class DeumosCheckBox
  596.     Inherits ThemeControl153
  597.  
  598.     Sub New()
  599.         LockHeight = 16
  600.  
  601.         SetColor("Border", 26, 26, 26)
  602.         SetColor("Gloss1", 35, Color.White)
  603.         SetColor("Gloss2", 5, Color.White)
  604.         SetColor("Checked1", Color.Transparent)
  605.         SetColor("Checked2", 40, Color.White)
  606.         SetColor("Unchecked1", 8, 8, 8)
  607.         SetColor("Unchecked2", 16, 16, 16)
  608.         SetColor("Glow", 5, Color.White)
  609.         SetColor("Text", Color.White)
  610.         SetColor("InnerOutline", Color.Black)
  611.         SetColor("OuterOutline", Color.Black)
  612.     End Sub
  613.  
  614.     Private C1, C2, C3, C4, C5, C6 As Color
  615.     Private P1, P2, P3 As Pen
  616.     Private B1, B2 As SolidBrush
  617.  
  618.     Protected Overrides Sub ColorHook()
  619.         C1 = GetColor("Gloss1")
  620.         C2 = GetColor("Gloss2")
  621.         C3 = GetColor("Checked1")
  622.         C4 = GetColor("Checked2")
  623.         C5 = GetColor("Unchecked1")
  624.         C6 = GetColor("Unchecked2")
  625.  
  626.         P1 = New Pen(GetColor("Border"))
  627.         P2 = New Pen(GetColor("InnerOutline"))
  628.         P3 = New Pen(GetColor("OuterOutline"))
  629.  
  630.         B1 = New SolidBrush(GetColor("Glow"))
  631.         B2 = New SolidBrush(GetColor("Text"))
  632.     End Sub
  633.  
  634.     Protected Overrides Sub PaintHook()
  635.         G.Clear(BackColor)
  636.  
  637.         DrawBorders(P1, 0, 0, _Field, _Field, 1)
  638.         DrawGradient(C1, C2, 0, 0, _Field, _Field \ 2)
  639.  
  640.         If _Checked Then
  641.             DrawGradient(C3, C4, 2, 2, _Field - 4, _Field - 4)
  642.         Else
  643.             DrawGradient(C5, C6, 2, 2, _Field - 4, _Field - 4, 90)
  644.         End If
  645.  
  646.         If State = MouseState.Over Then
  647.             G.FillRectangle(B1, 0, 0, _Field, _Field)
  648.         End If
  649.  
  650.         DrawText(B2, HorizontalAlignment.Left, _Field + 3, 0)
  651.  
  652.         DrawBorders(P2, 0, 0, _Field, _Field, 2)
  653.         DrawBorders(P3, 0, 0, _Field, _Field)
  654.  
  655.         DrawCorners(BackColor, 0, 0, _Field, _Field)
  656.     End Sub
  657.  
  658.     Private _Field As Integer = 16
  659.     Property Field() As Integer
  660.         Get
  661.             Return _Field
  662.         End Get
  663.         Set(ByVal value As Integer)
  664.             If value < 4 Then Return
  665.             _Field = value
  666.             LockHeight = value
  667.             Invalidate()
  668.         End Set
  669.     End Property
  670.  
  671.     Private _Checked As Boolean
  672.     Property Checked() As Boolean
  673.         Get
  674.             Return _Checked
  675.         End Get
  676.         Set(ByVal value As Boolean)
  677.             _Checked = value
  678.             Invalidate()
  679.         End Set
  680.     End Property
  681.  
  682.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  683.         _Checked = Not _Checked
  684.         RaiseEvent CheckedChanged(Me)
  685.         MyBase.OnMouseDown(e)
  686.     End Sub
  687.  
  688.     Event CheckedChanged(ByVal sender As Object)
  689.  
  690. End Class
  691.  
  692. <DefaultEvent("CheckedChanged")> _
  693. Class DeumosRadioButton
  694.     Inherits ThemeControl153
  695.  
  696.     Sub New()
  697.         LockHeight = 16
  698.  
  699.         SetColor("Gloss1", 38, Color.White)
  700.         SetColor("Gloss2", 5, Color.White)
  701.         SetColor("Checked1", Color.Transparent)
  702.         SetColor("Checked2", 40, Color.White)
  703.         SetColor("Unchecked1", 8, 8, 8)
  704.         SetColor("Unchecked2", 16, 16, 16)
  705.         SetColor("Glow", 5, Color.White)
  706.         SetColor("Text", Color.White)
  707.         SetColor("InnerOutline", Color.Black)
  708.         SetColor("OuterOutline", 15, Color.White)
  709.     End Sub
  710.  
  711.     Protected Overrides Sub ColorHook()
  712.         C1 = GetColor("Gloss1")
  713.         C2 = GetColor("Gloss2")
  714.         C3 = GetColor("Checked1")
  715.         C4 = GetColor("Checked2")
  716.         C5 = GetColor("Unchecked1")
  717.         C6 = GetColor("Unchecked2")
  718.  
  719.         B1 = New SolidBrush(GetColor("Glow"))
  720.         B2 = New SolidBrush(GetColor("Text"))
  721.  
  722.         P1 = New Pen(GetColor("InnerOutline"))
  723.         P2 = New Pen(GetColor("OuterOutline"))
  724.     End Sub
  725.  
  726.     Private C1, C2, C3, C4, C5, C6 As Color
  727.     Private P1, P2 As Pen
  728.     Private B1, B2 As SolidBrush
  729.  
  730.     Private R1, R2 As Rectangle
  731.     Private G1 As LinearGradientBrush
  732.  
  733.     Protected Overrides Sub PaintHook()
  734.         G.Clear(BackColor)
  735.  
  736.         G.SmoothingMode = SmoothingMode.HighQuality
  737.         R1 = New Rectangle(4, 2, _Field - 8, (_Field \ 2) - 1)
  738.         R2 = New Rectangle(4, 2, _Field - 8, (_Field \ 2))
  739.  
  740.         G1 = New LinearGradientBrush(R2, C1, C2, 90S)
  741.         G.FillEllipse(G1, R1)
  742.  
  743.         R1 = New Rectangle(2, 2, _Field - 4, _Field - 4)
  744.  
  745.         If _Checked Then
  746.             G1 = New LinearGradientBrush(R1, C3, C4, 90S)
  747.         Else
  748.             G1 = New LinearGradientBrush(R1, C5, C6, 90S)
  749.         End If
  750.         G.FillEllipse(G1, R1)
  751.  
  752.         If State = MouseState.Over Then
  753.             R1 = New Rectangle(2, 2, _Field - 4, _Field - 4)
  754.             G.FillEllipse(B1, R1)
  755.         End If
  756.  
  757.         DrawText(B2, HorizontalAlignment.Left, _Field + 3, 0)
  758.  
  759.         G.DrawEllipse(P1, 2, 2, _Field - 4, _Field - 4)
  760.         G.DrawEllipse(P2, 1, 1, _Field - 2, _Field - 2)
  761.  
  762.     End Sub
  763.  
  764.     Private _Field As Integer = 16
  765.     Property Field() As Integer
  766.         Get
  767.             Return _Field
  768.         End Get
  769.         Set(ByVal value As Integer)
  770.             If value < 4 Then Return
  771.             _Field = value
  772.             LockHeight = value
  773.             Invalidate()
  774.         End Set
  775.     End Property
  776.  
  777.     Private _Checked As Boolean
  778.     Property Checked() As Boolean
  779.         Get
  780.             Return _Checked
  781.         End Get
  782.         Set(ByVal value As Boolean)
  783.             _Checked = value
  784.             InvalidateControls()
  785.             RaiseEvent CheckedChanged(Me)
  786.             Invalidate()
  787.         End Set
  788.     End Property
  789.  
  790.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  791.         If Not _Checked Then Checked = True
  792.         MyBase.OnMouseDown(e)
  793.     End Sub
  794.  
  795.     Event CheckedChanged(ByVal sender As Object)
  796.  
  797.     Protected Overrides Sub OnCreation()
  798.         InvalidateControls()
  799.     End Sub
  800.  
  801.     Private Sub InvalidateControls()
  802.         If Not IsHandleCreated OrElse Not _Checked Then Return
  803.  
  804.         For Each C As Control In Parent.Controls
  805.             If C IsNot Me AndAlso TypeOf C Is DeumosRadioButton Then
  806.                 DirectCast(C, DeumosRadioButton).Checked = False
  807.             End If
  808.         Next
  809.     End Sub
  810.  
  811. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement