473,327 Members | 2,016 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

drawing lines on a webform

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.
Nov 18 '05 #1
3 1821
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" <Pa**@discussions.microsoft.com> wrote in message
news:B0**********************************@microsof t.com...
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.

Nov 18 '05 #2
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" <Pa**@discussions.microsoft.com> wrote in message
news:B0**********************************@microsof t.com...
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.


Nov 18 '05 #3
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" <Pa**@discussions.microsoft.com> wrote in message
news:A8**********************************@microsof t.com...
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" <Pa**@discussions.microsoft.com> wrote in message
news:B0**********************************@microsof t.com...
> 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.


Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: T. F. | last post by:
Hi, I need to create a box / field that the user can draw into (with some kind of pen). I also need to know how I can edit the size of the pen style and how I can "transport" the drawn image...
2
by: Champika Nirosh | last post by:
Hi, I want to create drawing board application that can draw Line, rectagle, circle and free hand drawing. Each drawing need to be transparent, moveable (draggable), have bring to front and...
0
by: borhan | last post by:
I am designing a program in which the user will be drawing, lines, circules and so on, on a paint control which displays an image opened by the user. "It's like there is a map on the picturebox...
1
by: ray well | last post by:
hi, is it possible to draw on a webform at the server side in the Page_Load event? i would appreciate a bit of code. i need to draw some lines and boxes thanks
8
by: Benoit Martin | last post by:
I had to draw my own control because I couldn't find any control doing what I wanted it to do. This control has a grid that I need to have control over. To do that, I draw each line of the grid...
2
by: George | last post by:
Dear colleagues, I refer to your help with specific graphic problem. It is necessary to create a viewfinder in graphic application. It seems that the algorithm is simple: just draw lines in...
9
by: davetelling | last post by:
I am not a programmer, I'm an engineer trying to make an interface to a product I'm designing. I have used C# to make a form that interrogates the unit via the serial port and receives the data. I...
4
by: Galen Somerville | last post by:
My VB2005 app gets real time Heart sounds and an ECG from a USB device. I'm looking for a way to speed up the drawing of the traces on the screen. In the following code the routine GetSounds...
4
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, I've windows form, in this form i've a panel. I want to draw lines inside the panel using the panel coordinates( meaing that the left upper corner of the panel is 0,0), how can i do it? ...
1
by: YouPoP | last post by:
I am doing an app (C# 2.0) where you can draw in a panel with your mouse in "real time". I actually have 2 problems; 1- it does not really is "real time", if your mouse move fast or very fast the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.