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
QHTML 2.0 - frmFrame.vb

frmFrame.vb

Caricato da: Totem
Scarica il programma completo

  1. Imports QHTML.frmQHTML
  2. Public Class frmFrame
  3.     Public Structure Frame
  4.         Dim Name, URL As String
  5.         Dim Scrolling As String
  6.         Dim MHeight, MWidth As Int16
  7.         Dim NoResize As Boolean
  8.     End Structure
  9.     Public Structure Row_Col
  10.         Dim ValString As String
  11.         Dim Type As String
  12.     End Structure
  13.     Public Rows, Cols As Row_Col
  14.     Public FramesList As New ArrayList
  15.     Public Function TransformValue(ByVal S As Row_Col) As String
  16.         Dim T As String = ""
  17.         Dim ToAdd As Char
  18.  
  19.         If S.Type = "pixel" Then
  20.             ToAdd = ""
  21.         End If
  22.         If S.Type = "percentage" Then
  23.             ToAdd = "%"
  24.         End If
  25.         If S.Type = "part" Then
  26.             ToAdd = "*"
  27.         End If
  28.  
  29.         For i As Int16 = 0 To S.ValString.Length - 1
  30.             If S.ValString(i) = "," Then
  31.                 T = T & ToAdd & ","
  32.             Else
  33.                 T = T & S.ValString(i)
  34.             End If
  35.         Next
  36.         T = T & ToAdd
  37.  
  38.         Return T
  39.     End Function
  40.     Private Sub cmdAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAdd.Click
  41.         Dim F As Frame
  42.  
  43.         F.Name = txtName.Text
  44.         F.URL = txtURL.Text
  45.         F.Scrolling = cmbScroll.SelectedItem
  46.         F.MHeight = nudMHeight.Value
  47.         F.MWidth = nudMWidth.Value
  48.         F.NoResize = chbRedim.Checked
  49.  
  50.         FramesList.Add(F)
  51.  
  52.         lstFrames.Items.Add(F.Name)
  53.  
  54.         txtName.Text = Nothing
  55.         txtURL.Text = Nothing
  56.         chbRedim.Checked = False
  57.         nudMHeight.Value = 0
  58.         nudMWidth.Value = 0
  59.         cmbScroll.SelectedItem = "auto"
  60.     End Sub
  61.     Private Sub cmdRemove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdRemove.Click
  62.         If lstFrames.SelectedIndex >= 0 Then
  63.             FramesList.RemoveAt(lstFrames.SelectedIndex)
  64.             lstFrames.Items.RemoveAt(lstFrames.SelectedIndex)
  65.         Else
  66.             MsgBox("Nessun elemento selezionato!", MsgBoxStyle.Exclamation)
  67.         End If
  68.     End Sub
  69.     Private Sub cmdOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdOK.Click
  70.         Dim Result As String = "<!--Frameset:-->" + vbCrLf + "  <frameset"
  71.         Dim A As Frame
  72.  
  73.         'Frameset
  74.         Result += " rows=" + Quote + TransformValue(Rows) + Quote
  75.         Result += " cols=" + Quote + TransformValue(Cols) + Quote
  76.         If chbBorder.Checked Then
  77.             Result += " frameborder=" + Quote + "yes" + Quote
  78.         Else
  79.             Result += " frameborder=" + Quote + "no" + Quote
  80.         End If
  81.         Result += " bordercolor=" + Quote + dudColor.SelectedItem + Quote + ">" + vbCrLf
  82.  
  83.         'Frames
  84.         For Each A In FramesList
  85.             Result += "  <frame src=" + Quote + A.URL + Quote
  86.             Result += " name=" + Quote + A.Name + Quote
  87.             Result += " scrolling=" + Quote + A.Scrolling + Quote
  88.             Result += " marginheight=" + Quote & A.MHeight & Quote
  89.             Result += " marginwidth=" + Quote & A.MWidth & Quote
  90.             If A.NoResize Then
  91.                 Result += " noresize"
  92.             End If
  93.             Result += ">" + vbCrLf
  94.         Next
  95.  
  96.         'Fine
  97.         Result += "  </frameset>" + vbCrLf + "  <!--Fine frameset-->"
  98.  
  99.         InsertTAG(Result)
  100.  
  101.         Me.Close()
  102.     End Sub
  103.     Private Sub cmdConfirm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdConfirm.Click
  104.         If ComboBox1.SelectedItem = "Colonne" Then
  105.             Cols.ValString = txtVal.Text
  106.             If rbtPixel.Checked Then
  107.                 Cols.Type = "pixel"
  108.             End If
  109.             If rbtPercentage.Checked Then
  110.                 Cols.Type = "percentage"
  111.             End If
  112.             If rbtPart.Checked Then
  113.                 Cols.Type = "part"
  114.             End If
  115.         Else
  116.             Rows.ValString = txtVal.Text
  117.             If rbtPixel.Checked Then
  118.                 Rows.Type = "pixel"
  119.             End If
  120.             If rbtPercentage.Checked Then
  121.                 Rows.Type = "percentage"
  122.             End If
  123.             If rbtPart.Checked Then
  124.                 Rows.Type = "part"
  125.             End If
  126.         End If
  127.  
  128.         txtVal.Text = ""
  129.     End Sub
  130.     Private Sub frmFrame_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  131.         dudColor.SelectedItem = "black"
  132.  
  133.         Cols.Type = "percentage"
  134.         Cols.ValString = "100"
  135.         Rows.Type = "percentage"
  136.         Rows.ValString = "100"
  137.         ComboBox1.SelectedIndex = 0
  138.     End Sub
  139. End Class