How do I add html to a VB form?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • C.K

    How do I add html to a VB form?

    Hi all,

    Is it possible to use html to design my form. What I want to do
    is to make a calendar program, which will receive a picture
    image and a month, and the form must display the image on
    the top half of an A4 and a calander grid on the bottom half.
    I thought html could be useful to do this, is it possible?


  • Cor Ligthert

    #2
    Re: How do I add html to a VB form?

    CK,

    You have to set yourself the pictures in an imagelist and use that on the
    buttons.

    It is a sample I once made.

    I hope this helps?

    Cor
    \\\Needs only a form and nothing more.
    Private Sub Form1_Load(ByVa l sender As Object, _
    ByVal e As System.EventArg s) Handles MyBase.Load
    Dim start As Integer = 4
    Dim top As Integer = 25
    Dim i As Integer
    Dim nowdate As DateTime = DateTime.Now
    Dim mybutton(System .DateTime.DaysI nMonth _
    (nowdate.Year, nowdate.Month)) As Button
    For i = 0 To System.DateTime .DaysInMonth _
    (nowdate.Year, nowdate.Month) - 1
    mybutton(i) = New Button
    mybutton(i).Tex tAlign = ContentAlignmen t.MiddleCenter
    mybutton(i).Wid th = 40
    mybutton(i).Hei ght = 20
    mybutton(i).Fla tStyle = FlatStyle.Flat
    mybutton(i).Bac kColor = Drawing.Color.A ntiqueWhite
    mybutton(i).Loc ation = New System.Drawing. Point(start, top)
    mybutton(i).Tex t = (i + 1).ToString
    mybutton(i).Cur sor = Cursors.Hand
    Me.Controls.Add (mybutton(i))
    AddHandler mybutton(i).Cli ck, AddressOf mybutton_Click
    AddHandler mybutton(i).Mou seHover, AddressOf mybutton_Hoover
    AddHandler mybutton(i).Mou seLeave, AddressOf mybutton_Leave
    start = start + 40
    If (i + 1) Mod 5 = 0 Then
    top = top + 20
    start = 4
    End If
    Next
    End Sub
    Private Sub mybutton_Click _
    (ByVal sender As Object, ByVal e As System.EventArg s)
    Dim thisbutton As Button = DirectCast(send er, Button)
    MessageBox.Show ("The day is: " & thisbutton.Text )
    End Sub
    Private Sub mybutton_Hoover _
    (ByVal sender As Object, ByVal e As System.EventArg s)
    Dim thisbutton As Button = DirectCast(send er, Button)
    thisbutton.Back Color = Drawing.Color.A liceBlue
    End Sub
    Private Sub mybutton_Leave _
    (ByVal sender As Object, ByVal e As System.EventArg s)
    Dim thisbutton As Button = DirectCast(send er, Button)
    thisbutton.Back Color = Drawing.Color.A ntiqueWhite
    End Sub
    ///


    Comment

    • C.K

      #3
      Re: How do I add html to a VB form?

      Hi Cor,

      Thanks for your code. Are you using buttons to create the
      calendar grid ? This is a good idea - didn't think of it.
      I want to just tell you more about the design, see what
      you think. Firstly, the image will be on the top half of
      the A4, i.e. not underneath the calendar, and I might
      add that the entire form will only be used for printing
      off a calendar month, i.e. not for on screen display.
      Let me know if any more ideas spring to mind...

      tfn
      C.K.

      "Cor Ligthert" <notfirstname@p lanet.nl> wrote in message
      news:ewKHYgllEH A.3988@tk2msftn gp13.phx.gbl...[color=blue]
      > CK,
      >
      > You have to set yourself the pictures in an imagelist and use that on the
      > buttons.
      >
      > It is a sample I once made.
      >
      > I hope this helps?
      >
      > Cor
      > \\\Needs only a form and nothing more.
      > Private Sub Form1_Load(ByVa l sender As Object, _
      > ByVal e As System.EventArg s) Handles MyBase.Load
      > Dim start As Integer = 4
      > Dim top As Integer = 25
      > Dim i As Integer
      > Dim nowdate As DateTime = DateTime.Now
      > Dim mybutton(System .DateTime.DaysI nMonth _
      > (nowdate.Year, nowdate.Month)) As Button
      > For i = 0 To System.DateTime .DaysInMonth _
      > (nowdate.Year, nowdate.Month) - 1
      > mybutton(i) = New Button
      > mybutton(i).Tex tAlign = ContentAlignmen t.MiddleCenter
      > mybutton(i).Wid th = 40
      > mybutton(i).Hei ght = 20
      > mybutton(i).Fla tStyle = FlatStyle.Flat
      > mybutton(i).Bac kColor = Drawing.Color.A ntiqueWhite
      > mybutton(i).Loc ation = New System.Drawing. Point(start, top)
      > mybutton(i).Tex t = (i + 1).ToString
      > mybutton(i).Cur sor = Cursors.Hand
      > Me.Controls.Add (mybutton(i))
      > AddHandler mybutton(i).Cli ck, AddressOf mybutton_Click
      > AddHandler mybutton(i).Mou seHover, AddressOf mybutton_Hoover
      > AddHandler mybutton(i).Mou seLeave, AddressOf mybutton_Leave
      > start = start + 40
      > If (i + 1) Mod 5 = 0 Then
      > top = top + 20
      > start = 4
      > End If
      > Next
      > End Sub
      > Private Sub mybutton_Click _
      > (ByVal sender As Object, ByVal e As System.EventArg s)
      > Dim thisbutton As Button = DirectCast(send er, Button)
      > MessageBox.Show ("The day is: " & thisbutton.Text )
      > End Sub
      > Private Sub mybutton_Hoover _
      > (ByVal sender As Object, ByVal e As System.EventArg s)
      > Dim thisbutton As Button = DirectCast(send er, Button)
      > thisbutton.Back Color = Drawing.Color.A liceBlue
      > End Sub
      > Private Sub mybutton_Leave _
      > (ByVal sender As Object, ByVal e As System.EventArg s)
      > Dim thisbutton As Button = DirectCast(send er, Button)
      > thisbutton.Back Color = Drawing.Color.A ntiqueWhite
      > End Sub
      > ///
      >
      >[/color]


      Comment

      • Herfried K. Wagner [MVP]

        #4
        Re: How do I add html to a VB form?

        * "C.K" <assdadad> scripsit:[color=blue]
        > Is it possible to use html to design my form.[/color]

        Maybe you can archieve what you want to do with a datagrid. Samples on
        customization of this control can be found here:

        <URL:http://www.syncfusion. com/FAQ/WinForms/default.asp#44>

        --
        M S Herfried K. Wagner
        M V P <URL:http://dotnet.mvps.org/>
        V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

        Comment

        • C.K

          #5
          Re: How do I add html to a VB form?

          I am now thinking there will be a problem with the button array
          approach, how can I print it, I believe we cannot print the
          VB form, or can we ?

          Regarding 3rd party controls, this will be a last resort approach.

          C.K.
          "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
          news:OJA6p%23ml EHA.3896@tk2msf tngp13.phx.gbl. ..[color=blue]
          > * "C.K" <assdadad> scripsit:[color=green]
          > > Is it possible to use html to design my form.[/color]
          >
          > Maybe you can archieve what you want to do with a datagrid. Samples on
          > customization of this control can be found here:
          >
          > <URL:http://www.syncfusion. com/FAQ/WinForms/default.asp#44>
          >
          > --
          > M S Herfried K. Wagner
          > M V P <URL:http://dotnet.mvps.org/>
          > V B <URL:http://dotnet.mvps.org/dotnet/faqs/>[/color]


          Comment

          Working...