drawing lines on a webform

Discussion in 'ASP .Net' started by =?Utf-8?B?UGF1bA==?=, Jul 29, 2004.

  1. Hi just wondering if there is an easy way to a box around a bunch of controls like
    -----------------------------------------------------
    | control1 control2 control3 |
    | |
    ----------------------------------------------------
    thanks,


    --
    Paul G
    Software engineer.
     
    =?Utf-8?B?UGF1bA==?=, Jul 29, 2004
    #1
    1. Advertising

  2. =?Utf-8?B?UGF1bA==?=

    Mythran Guest

    Try a panel with borders set?

    Or...

    Private Sub DrawBorder(ByVal Controls As Control())
    Dim x1 As Integer = Integer.MaxValue
    Dim x2 As Integer = Integer.MinValue
    Dim y1 As Integer = Integer.MaxValue
    Dim y2 As Integer = Integer.MinValue
    Dim graph As Graphics = Me.CreateGraphics()
    Dim pen As Pen
    Dim rect As Rectangle

    For Each Control As Control In Controls
    x1 = Min(x1, Control.Left)
    x2 = Max(x2, Control.Left + Control.Width)
    y1 = Min(y1, Control.Top)
    y2 = Max(y2, Control.Top + Control.Height)
    Next

    ' Draw the borders around the controls.
    pen = New Pen(Color.Blue, 1)
    rect = New Rectangle(x1 - 4, y1 - 4, (x2 - x1) + 4, (y2 - y1) + 4)
    graph.DrawRectangle(pen, rect)
    End Sub

    Private Function Max(ByVal Num1 As Integer, ByVal Num2 As Integer) As Integer
    Return IIf(Num1 > Num2, Num1, Num2)
    End Function

    Private Function Min(ByVal Num1 As Integer, ByVal Num2 As Integer) As Integer
    Return IIf(Num1 < Num2, Num1, Num2)
    End Function

    Private Sub Form1_Paint(ByVal sender As Object, ByVal e As
    System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
    Dim controls As Control() = New Control() { _
    Checkbox1, Checkbox2, Checkbox3, Checkbox4, Checkbox5, Checkbox6 _
    }

    DrawBorder(controls)
    End Sub

    "Paul" <> wrote in message
    news:...
    > Hi just wondering if there is an easy way to a box around a bunch of controls

    like
    > -----------------------------------------------------
    > | control1 control2 control3 |
    > | |
    > ----------------------------------------------------
    > thanks,
    >
    >
    > --
    > Paul G
    > Software engineer.
     
    Mythran, Jul 29, 2004
    #2
    1. Advertising

  3. =?Utf-8?B?UGF1bA==?=

    Mythran Guest

    WOAH!!! Sorry, I did that..but it's for WinForms :p Sorry about that heh.

    As for your REAL answer...

    <table style='width:75%;border:1px Solid Black;'>
    <tr>
    <td>
    <asp:label ... blah ...>blah</asp:label>
    </td>

    <td>
    <asp:label ... blah ...>blah</asp:label>
    </td>

    <td>
    <asp:label ... blah ...>blah</asp:label>
    </td>
    </tr>
    </table>

    And another example...using non-html controls (meaning asp.net controls...which
    still use html controls behind the scenes):

    <asp:panel style='border:1px Solid Black;' ... blah ...>
    <asp:label style='width:100px;' ... blah ...>blah</asp:label>
    <asp:label style='width:100px;' ... blah ...>blah</asp:label>
    <asp:label style='width:100px;' ... blah ...>blah</asp:label>
    </asp:panel>

    "Paul" <> wrote in message
    > news:...
    > > Hi just wondering if there is an easy way to a box around a bunch of controls

    > like
    > > -----------------------------------------------------
    > > | control1 control2 control3 |
    > > | |
    > > ----------------------------------------------------
    > > thanks,
    > >
    > >
    > > --
    > > Paul G
    > > Software engineer.

    >
    >
     
    Mythran, Jul 29, 2004
    #3
  4. =?Utf-8?B?UGF1bA==?=

    Mythran Guest

    Hrm..

    a frame page eh? Try window.parentWindow.close() or window.parent.close() or
    something to that effect (window.top.close() should do the trick).

    Mythran



    "Paul" <> wrote in message
    news:...
    > ok thanks for the information. Looks like the panel control will work for some

    of the stuff I am grouping. Also was wondering if you know how to close a htm
    file that includes a frame? I am trying to setup a log off button and tried
    java script like
    > <script language="javascript" event="onclick()" for="Button2">
    > window.close();
    > </script>
    > I have a frame, htm file that contains 2 aspx files,
    > <frame name="main" src="default.aspx">
    > <FRAME src="contents.aspx">
    > I have the log off button on the contents.aspx form, tried client side script

    in the html for contents but this did not close the window.
    > Thanks
    > but did not work.
    > The
    >
    > --
    > Paul G
    > Software engineer.
    >
    >
    > "Mythran" wrote:
    >
    > > WOAH!!! Sorry, I did that..but it's for WinForms :p Sorry about that heh.
    > >
    > > As for your REAL answer...
    > >
    > > <table style='width:75%;border:1px Solid Black;'>
    > > <tr>
    > > <td>
    > > <asp:label ... blah ...>blah</asp:label>
    > > </td>
    > >
    > > <td>
    > > <asp:label ... blah ...>blah</asp:label>
    > > </td>
    > >
    > > <td>
    > > <asp:label ... blah ...>blah</asp:label>
    > > </td>
    > > </tr>
    > > </table>
    > >
    > > And another example...using non-html controls (meaning asp.net

    controls...which
    > > still use html controls behind the scenes):
    > >
    > > <asp:panel style='border:1px Solid Black;' ... blah ...>
    > > <asp:label style='width:100px;' ... blah ...>blah</asp:label>
    > > <asp:label style='width:100px;' ... blah ...>blah</asp:label>
    > > <asp:label style='width:100px;' ... blah ...>blah</asp:label>
    > > </asp:panel>
    > >
    > > "Paul" <> wrote in message
    > > > news:...
    > > > > Hi just wondering if there is an easy way to a box around a bunch of

    controls
    > > > like
    > > > > -----------------------------------------------------
    > > > > | control1 control2 control3 |
    > > > > | |
    > > > > ----------------------------------------------------
    > > > > thanks,
    > > > >
    > > > >
    > > > > --
    > > > > Paul G
    > > > > Software engineer.
    > > >
    > > >

    > >
    > >
    > >
     
    Mythran, Jul 30, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. peshrad
    Replies:
    3
    Views:
    1,544
    David Freeman
    Nov 8, 2004
  2. anthonyroche

    Drawing lines on a chart

    anthonyroche, Nov 8, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    402
    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=
    Nov 8, 2004
  3. ray well

    drawing on a webform

    ray well, Feb 25, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    439
    Steve C. Orr [MVP, MCSD]
    Feb 25, 2005
  4. Replies:
    1
    Views:
    686
    Kevin Spencer
    Jan 9, 2006
  5. defn noob
    Replies:
    1
    Views:
    432
    Mark Space
    Jun 28, 2008
Loading...

Share This Page