473,748 Members | 7,827 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1841
Try a panel with borders set?

Or...

Private Sub DrawBorder(ByVa l Controls As Control())
Dim x1 As Integer = Integer.MaxValu e
Dim x2 As Integer = Integer.MinValu e
Dim y1 As Integer = Integer.MaxValu e
Dim y2 As Integer = Integer.MinValu e
Dim graph As Graphics = Me.CreateGraphi cs()
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.DrawRecta ngle(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(ByV al sender As Object, ByVal e As
System.Windows. Forms.PaintEven tArgs) Handles MyBase.Paint
Dim controls As Control() = New Control() { _
Checkbox1, Checkbox2, Checkbox3, Checkbox4, Checkbox5, Checkbox6 _
}

DrawBorder(cont rols)
End Sub

"Paul" <Pa**@discussio ns.microsoft.co m> wrote in message
news:B0******** *************** ***********@mic rosoft.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...whic h
still use html controls behind the scenes):

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

"Paul" <Pa**@discussio ns.microsoft.co m> wrote in message
news:B0******** *************** ***********@mic rosoft.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.parentWi ndow.close() or window.parent.c lose() or
something to that effect (window.top.clo se() should do the trick).

Mythran

"Paul" <Pa**@discussio ns.microsoft.co m> wrote in message
news:A8******** *************** ***********@mic rosoft.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="javas cript" event="onclick( )" for="Button2">
window.close();
</script>
I have a frame, htm file that contains 2 aspx files,
<frame name="main" src="default.as px">
<FRAME src="contents.a spx">
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...whic h still use html controls behind the scenes):

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

"Paul" <Pa**@discussio ns.microsoft.co m> wrote in message
news:B0******** *************** ***********@mic rosoft.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
2427
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 into a smaller box (that is only around 10x10 pixel so the original image must be comprimized onto that 10x10 pixel field..) and how to center it. ( if you guess that this is about neural networks you're right :) )
2
12344
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 send to back feature etc. How can I do this .. where should I start?
0
1334
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 control and the user draws some raads on the map." I am using System::Drawing::Graphics class, first I assign the handle of the picbox where the user wil draw: graphicsSurface = System::Drawing::Graphics::FromHwnd( picBox->Handle );
1
1169
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
5649
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 using a 1pixel pictureBox. I also need "boxes" to be placed within that grid depending on data pulled from my dataset. I also used pictureBox controls for that. All those components that I use to draw my control are added to the controls collection...
2
2247
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 specific position in according to value of some controls, track bars, for example. Next read the track bars value to find the coordinates of lines cross. It works, but I can not get real cross because the background image is being deface by lines...
9
3181
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 want to be able to draw lines in a picturebox based upon certain data points I have received. I dragged a picturebox from the toolbar onto my form, but after having gone through the help files, looking online and trying a variety of things, I...
4
1662
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 recieves the USB data for six consequtive horizontal pixels (or 6 sound/ECG samples). The routine FixChns handles the scaling of the data and puts it into the PlotAry for presentation. The variable RptCnt then handles the placement for the 6 sets...
4
3782
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? Thanks, Gidi.
1
3984
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 line is added after a very small delay. 2-Because I use AddLine(), it adds very short lines from one point to another and it does not give a very good result. Also because of this and my "not real time" problem, when the mouse moves fast it adds...
0
8987
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8826
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9534
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9316
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9241
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8239
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
3303
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2777
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2211
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.