Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
HTML Color Converter - Form1.vb

Form1.vb

Caricato da:
Scarica il programma completo

  1. Imports System
  2. Imports System.IO
  3. Imports System.Drawing
  4. Public Class Form1
  5.     Inherits System.Windows.Forms.Form
  6.     Dim H As Drawing.ColorTranslator
  7. #Region " Windows Form Designer generated code "
  8.  
  9.     Public Sub New()
  10.         MyBase.New()
  11.  
  12.         'This call is required by the Windows Form Designer.
  13.         InitializeComponent()
  14.  
  15.         'Add any initialization after the InitializeComponent() call
  16.  
  17.     End Sub
  18.  
  19.     'Form overrides dispose to clean up the component list.
  20.     Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
  21.         If disposing Then
  22.             If Not (components Is Nothing) Then
  23.                 components.Dispose()
  24.             End If
  25.         End If
  26.         MyBase.Dispose(disposing)
  27.     End Sub
  28.  
  29.     'Required by the Windows Form Designer
  30.     Private components As System.ComponentModel.IContainer
  31.  
  32.     'NOTE: The following procedure is required by the Windows Form Designer
  33.     'It can be modified using the Windows Form Designer.  
  34.     'Do not modify it using the code editor.
  35.     Friend WithEvents Label1 As System.Windows.Forms.Label
  36.     Friend WithEvents ColorDialog1 As System.Windows.Forms.ColorDialog
  37.     Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
  38.     Friend WithEvents Button1 As System.Windows.Forms.Button
  39.     Friend WithEvents Button2 As System.Windows.Forms.Button
  40.     Friend WithEvents Label2 As System.Windows.Forms.Label
  41.     Friend WithEvents Label3 As System.Windows.Forms.Label
  42.     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
  43.         Me.Label1 = New System.Windows.Forms.Label
  44.         Me.ColorDialog1 = New System.Windows.Forms.ColorDialog
  45.         Me.TextBox1 = New System.Windows.Forms.TextBox
  46.         Me.Button1 = New System.Windows.Forms.Button
  47.         Me.Button2 = New System.Windows.Forms.Button
  48.         Me.Label2 = New System.Windows.Forms.Label
  49.         Me.Label3 = New System.Windows.Forms.Label
  50.         Me.SuspendLayout()
  51.         '
  52.         'Label1
  53.         '
  54.         Me.Label1.Location = New System.Drawing.Point(8, 8)
  55.         Me.Label1.Name = "Label1"
  56.         Me.Label1.Size = New System.Drawing.Size(152, 24)
  57.         Me.Label1.TabIndex = 0
  58.         Me.Label1.Text = "Colore in HTML:"
  59.         '
  60.         'TextBox1
  61.         '
  62.         Me.TextBox1.Location = New System.Drawing.Point(8, 32)
  63.         Me.TextBox1.Name = "TextBox1"
  64.         Me.TextBox1.Size = New System.Drawing.Size(160, 26)
  65.         Me.TextBox1.TabIndex = 1
  66.         Me.TextBox1.Text = "#0"
  67.         '
  68.         'Button1
  69.         '
  70.         Me.Button1.Location = New System.Drawing.Point(8, 64)
  71.         Me.Button1.Name = "Button1"
  72.         Me.Button1.Size = New System.Drawing.Size(72, 24)
  73.         Me.Button1.TabIndex = 2
  74.         Me.Button1.Text = "Copy"
  75.         '
  76.         'Button2
  77.         '
  78.         Me.Button2.Location = New System.Drawing.Point(88, 64)
  79.         Me.Button2.Name = "Button2"
  80.         Me.Button2.Size = New System.Drawing.Size(96, 24)
  81.         Me.Button2.TabIndex = 3
  82.         Me.Button2.Text = "Open Color"
  83.         '
  84.         'Label2
  85.         '
  86.         Me.Label2.Location = New System.Drawing.Point(176, 8)
  87.         Me.Label2.Name = "Label2"
  88.         Me.Label2.Size = New System.Drawing.Size(120, 16)
  89.         Me.Label2.TabIndex = 4
  90.         Me.Label2.Text = "Colore Attuale:"
  91.         '
  92.         'Label3
  93.         '
  94.         Me.Label3.Location = New System.Drawing.Point(192, 32)
  95.         Me.Label3.Name = "Label3"
  96.         Me.Label3.Size = New System.Drawing.Size(64, 24)
  97.         Me.Label3.TabIndex = 5
  98.         '
  99.         'Form1
  100.         '
  101.         Me.AutoScaleBaseSize = New System.Drawing.Size(7, 19)
  102.         Me.ClientSize = New System.Drawing.Size(298, 96)
  103.         Me.Controls.Add(Me.Label3)
  104.         Me.Controls.Add(Me.Label2)
  105.         Me.Controls.Add(Me.Button2)
  106.         Me.Controls.Add(Me.Button1)
  107.         Me.Controls.Add(Me.TextBox1)
  108.         Me.Controls.Add(Me.Label1)
  109.         Me.Font = New System.Drawing.Font("Comic Sans MS", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
  110.         Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
  111.         Me.MaximizeBox = False
  112.         Me.MinimizeBox = False
  113.         Me.Name = "Form1"
  114.         Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
  115.         Me.Text = "HTML Color Converter - By CiTyNoVa"
  116.         Me.ResumeLayout(False)
  117.  
  118.     End Sub
  119.  
  120. #End Region
  121.  
  122.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  123.         ColorDialog1.ShowDialog()
  124.         Label3.BackColor = ColorDialog1.Color
  125.         TextBox1.Text = "#" & Hex(H.ToOle(ColorDialog1.Color))
  126.     End Sub
  127.  
  128.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  129.         Clipboard.SetDataObject(TextBox1.Text)
  130.     End Sub
  131. End Class