drawing lines on a webform

M

Mythran

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
 
M

Mythran

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>

 
M

Mythran

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 said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top