I know this must be trivial for many of you. But I am playing with
this and can't figure it out.
I have a form, on that form is one panel which has 3 textboxes, when I
run my program and maximize the form I want to resize my 3 text boxes
according to the size of the form. Each text box should take 33% of
the panel's width and full hight of the panel's height. Resizing of
the panel is easy with docking... but these 3 textboxes are driving
me crazy.
Any ideas?
Please
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =--- 13 2509
Martin,
I would dock one Textbox to the Top, dock one Textbox to the Bottom and set
the third to Fill.
In the Layout event for the Panel I would set the height of the top TextBox
to 1/3 height of the panel, I would set the bottom Textbox to 1/3 height of
the panel. The third TextBox will take care of itself. (Remember that most
numbers are not easily divisible by three, hence my setting the height of
only two text boxes and allowing the middle one to take up the slack...)
Remember to set the Multiline property for each TextBox to true!
Of course you can do the same thing with Left & Right if you want horizontal
instead of vertical. With horizontal you can leave Multiline to false.
Hope this helps
Jay
"Martin Ho" <ma******@74tec h-dot-com.no-spam.invalid> wrote in message
news:3f******** @127.0.0.1... I know this must be trivial for many of you. But I am playing with this and can't figure it out.
I have a form, on that form is one panel which has 3 textboxes, when I run my program and maximize the form I want to resize my 3 text boxes according to the size of the form. Each text box should take 33% of the panel's width and full hight of the panel's height. Resizing of the panel is easy with docking... but these 3 textboxes are driving me crazy. Any ideas? Please ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet
News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000
Newsgroups ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
=---
Hehehehe
I had a problem like this but I was using listview but the control type
doesn't matter. You're going to want to put your own code in to the panel
_Resize event to change the size and position of the textboxs the way you
want them. I tried all types of things in .Net so that I wouldn't have to
do that but in the end I had to..
"Martin Ho" <ma******@74tec h-dot-com.no-spam.invalid> wrote in message
news:3f******** @127.0.0.1... I know this must be trivial for many of you. But I am playing with this and can't figure it out.
I have a form, on that form is one panel which has 3 textboxes, when I run my program and maximize the form I want to resize my 3 text boxes according to the size of the form. Each text box should take 33% of the panel's width and full hight of the panel's height. Resizing of the panel is easy with docking... but these 3 textboxes are driving me crazy. Any ideas? Please ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet
News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000
Newsgroups ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
=---
Jay, I don't want them to dock to top bottom and fill...
I want them to look like a vertical columns, I don't want them to look
like a horizontal boxes.
Mike Bulava, could you please provide some little code on how to do
this?
I would really appreciate to see some example.
I have no idea why something so trivial is so ridiculously
complicated.
This should be easy to setup, the same way as when you designing
tables in html or so... This is just damn hard :)
Martin
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
I'm usally not one to give code answers because I don't want to be doing
someone elses work but here a little something. Becaufe I'm not testing
this, and I'm leaving a few things out.
Private Sub Panel_Resize(Ar gs) handles Panel.resize
Dim iHieght as integer=Panel.h eight/3
Textbo1.top=0
Textbox1.hieght =ihieght
textbox2.top=ih ieght
textbox2.hieght =ihieght
texbox3.top=tex tbox2.top+ihieg ht
textbox3.hieght =ihieght
end sub
You basicly mathamticly figuring out where each textbox should be in the
panel and then placing it there.
This is complicated at all it's called coding...
Have a nice day,
Mike
"Martin Ho" <ma******@74tec h-dot-com.no-spam.invalid> wrote in message
news:3f******** @127.0.0.1... I know this must be trivial for many of you. But I am playing with this and can't figure it out.
I have a form, on that form is one panel which has 3 textboxes, when I run my program and maximize the form I want to resize my 3 text boxes according to the size of the form. Each text box should take 33% of the panel's width and full hight of the panel's height. Resizing of the panel is easy with docking... but these 3 textboxes are driving me crazy. Any ideas? Please ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet
News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000
Newsgroups ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
=---
Mike,
Rather then using the Resize event, I would recommend the Layout event
instead.
As the Layout event occurs "when a control should reposition its child
controls", while a Resize event occurs "when the control is resized".
Which basically means that the Layout event can occur independent of the
form resizing. Also using Control.Suspend Layout & Control.ResumeL ayout you
can control when the Layout event occurs (it is normally turned off when the
form is being constructed!)
Hope this helps
Jay
"Mike Bulava" <mb*****@comcas t.net> wrote in message
news:OQ******** ******@TK2MSFTN GP10.phx.gbl... I'm usally not one to give code answers because I don't want to be doing someone elses work but here a little something. Becaufe I'm not testing this, and I'm leaving a few things out.
Private Sub Panel_Resize(Ar gs) handles Panel.resize Dim iHieght as integer=Panel.h eight/3 Textbo1.top=0 Textbox1.hieght =ihieght textbox2.top=ih ieght textbox2.hieght =ihieght texbox3.top=tex tbox2.top+ihieg ht textbox3.hieght =ihieght end sub
You basicly mathamticly figuring out where each textbox should be in the panel and then placing it there.
This is complicated at all it's called coding...
Have a nice day, Mike
"Martin Ho" <ma******@74tec h-dot-com.no-spam.invalid> wrote in message news:3f******** @127.0.0.1... I know this must be trivial for many of you. But I am playing with this and can't figure it out.
I have a form, on that form is one panel which has 3 textboxes, when I run my program and maximize the form I want to resize my 3 text boxes according to the size of the form. Each text box should take 33% of the panel's width and full hight of the panel's height. Resizing of the panel is easy with docking... but these 3 textboxes are driving me crazy. Any ideas? Please ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups ---= 19 East/West-Coast Specialized Servers - Total Privacy via
Encryption =---
Martin, Jay, I don't want them to dock to top bottom and fill... I want them to look like a vertical columns, I don't want them to look like a horizontal boxes.
As I stated in my message if you want vertical columns (horizontal layout),
then dock on the left, right and change the Width.
If you want horizontal columns (vertical layout), then you need to dock on
the top & bottom and change the Height!
I have no idea why something so trivial is so ridiculously complicated.
It is extremely trivial! I really don't see where it is complicated ;-)
The following is a form that has both vertical & horizontal Text boxes!
---x--- cut here ---x---
Option Strict On
Option Explicit On
Public Class TestForm
Inherits System.Windows. Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeCompo nent()
'Add any initialization after the InitializeCompo nent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Disp ose()
End If
End If
MyBase.Dispose( disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.Componen tModel.IContain er
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Private WithEvents Panel1 As System.Windows. Forms.Panel
Friend WithEvents TextBox1 As System.Windows. Forms.TextBox
Friend WithEvents TextBox2 As System.Windows. Forms.TextBox
Friend WithEvents TextBox3 As System.Windows. Forms.TextBox
Private WithEvents Panel2 As System.Windows. Forms.Panel
Private WithEvents TextBox4 As System.Windows. Forms.TextBox
Private WithEvents TextBox5 As System.Windows. Forms.TextBox
Private WithEvents TextBox6 As System.Windows. Forms.TextBox
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()
Me.Panel1 = New System.Windows. Forms.Panel
Me.TextBox3 = New System.Windows. Forms.TextBox
Me.TextBox2 = New System.Windows. Forms.TextBox
Me.TextBox1 = New System.Windows. Forms.TextBox
Me.Panel2 = New System.Windows. Forms.Panel
Me.TextBox4 = New System.Windows. Forms.TextBox
Me.TextBox5 = New System.Windows. Forms.TextBox
Me.TextBox6 = New System.Windows. Forms.TextBox
Me.Panel1.Suspe ndLayout()
Me.Panel2.Suspe ndLayout()
Me.SuspendLayou t()
'
'Panel1
'
Me.Panel1.Ancho r = CType((((System .Windows.Forms. AnchorStyles.To p Or
System.Windows. Forms.AnchorSty les.Bottom) _
Or System.Windows. Forms.AnchorSty les.Left) _
Or System.Windows. Forms.AnchorSty les.Right),
System.Windows. Forms.AnchorSty les)
Me.Panel1.Contr ols.Add(Me.Text Box3)
Me.Panel1.Contr ols.Add(Me.Text Box2)
Me.Panel1.Contr ols.Add(Me.Text Box1)
Me.Panel1.Locat ion = New System.Drawing. Point(8, 56)
Me.Panel1.Name = "Panel1"
Me.Panel1.Size = New System.Drawing. Size(272, 192)
Me.Panel1.TabIn dex = 0
'
'TextBox3
'
Me.TextBox3.Doc k = System.Windows. Forms.DockStyle .Bottom
Me.TextBox3.Loc ation = New System.Drawing. Point(0, 168)
Me.TextBox3.Mul tiline = True
Me.TextBox3.Nam e = "TextBox3"
Me.TextBox3.Siz e = New System.Drawing. Size(272, 24)
Me.TextBox3.Tab Index = 2
Me.TextBox3.Tex t = "TextBox3"
'
'TextBox2
'
Me.TextBox2.Doc k = System.Windows. Forms.DockStyle .Fill
Me.TextBox2.Loc ation = New System.Drawing. Point(0, 24)
Me.TextBox2.Mul tiline = True
Me.TextBox2.Nam e = "TextBox2"
Me.TextBox2.Siz e = New System.Drawing. Size(272, 168)
Me.TextBox2.Tab Index = 1
Me.TextBox2.Tex t = "TextBox2"
'
'TextBox1
'
Me.TextBox1.Doc k = System.Windows. Forms.DockStyle .Top
Me.TextBox1.Loc ation = New System.Drawing. Point(0, 0)
Me.TextBox1.Mul tiline = True
Me.TextBox1.Nam e = "TextBox1"
Me.TextBox1.Siz e = New System.Drawing. Size(272, 24)
Me.TextBox1.Tab Index = 0
Me.TextBox1.Tex t = "TextBox1"
'
'Panel2
'
Me.Panel2.Ancho r = CType(((System. Windows.Forms.A nchorStyles.Top Or
System.Windows. Forms.AnchorSty les.Left) _
Or System.Windows. Forms.AnchorSty les.Right),
System.Windows. Forms.AnchorSty les)
Me.Panel2.Contr ols.Add(Me.Text Box6)
Me.Panel2.Contr ols.Add(Me.Text Box5)
Me.Panel2.Contr ols.Add(Me.Text Box4)
Me.Panel2.Locat ion = New System.Drawing. Point(8, 8)
Me.Panel2.Name = "Panel2"
Me.Panel2.Size = New System.Drawing. Size(272, 32)
Me.Panel2.TabIn dex = 1
'
'TextBox4
'
Me.TextBox4.Doc k = System.Windows. Forms.DockStyle .Left
Me.TextBox4.Loc ation = New System.Drawing. Point(0, 0)
Me.TextBox4.Nam e = "TextBox4"
Me.TextBox4.Siz e = New System.Drawing. Size(80, 22)
Me.TextBox4.Tab Index = 0
Me.TextBox4.Tex t = "TextBox4"
'
'TextBox5
'
Me.TextBox5.Doc k = System.Windows. Forms.DockStyle .Fill
Me.TextBox5.Loc ation = New System.Drawing. Point(80, 0)
Me.TextBox5.Nam e = "TextBox5"
Me.TextBox5.Siz e = New System.Drawing. Size(192, 22)
Me.TextBox5.Tab Index = 1
Me.TextBox5.Tex t = "TextBox5"
'
'TextBox6
'
Me.TextBox6.Doc k = System.Windows. Forms.DockStyle .Right
Me.TextBox6.Loc ation = New System.Drawing. Point(172, 0)
Me.TextBox6.Nam e = "TextBox6"
Me.TextBox6.Tab Index = 2
Me.TextBox6.Tex t = "TextBox6"
'
'TestForm
'
Me.AutoScaleBas eSize = New System.Drawing. Size(6, 15)
Me.ClientSize = New System.Drawing. Size(292, 260)
Me.Controls.Add (Me.Panel2)
Me.Controls.Add (Me.Panel1)
Me.Name = "TestForm"
Me.Text = "Test Form"
Me.Panel1.Resum eLayout(False)
Me.Panel2.Resum eLayout(False)
Me.ResumeLayout (False)
End Sub
#End Region
Private Sub Panel1_Layout(B yVal sender As Object, ByVal e As
System.Windows. Forms.LayoutEve ntArgs) Handles Panel1.Layout
TextBox1.Height = Panel1.Height \ 3
TextBox3.Height = Panel1.Height \ 3
End Sub
Private Sub Panel2_Layout(B yVal sender As Object, ByVal e As
System.Windows. Forms.LayoutEve ntArgs) Handles Panel2.Layout
TextBox4.Width = Panel2.Width \ 3
TextBox6.Width = Panel2.Width \ 3
End Sub
End Class
---x--- cut here ---x---
Hope this helps
Jay
"Martin Ho" <ma******@74tec h-dot-com.no-spam.invalid> wrote in message
news:3f******** **@127.0.0.1... Jay, I don't want them to dock to top bottom and fill... I want them to look like a vertical columns, I don't want them to look like a horizontal boxes.
Mike Bulava, could you please provide some little code on how to do this?
I would really appreciate to see some example. I have no idea why something so trivial is so ridiculously complicated. This should be easy to setup, the same way as when you designing tables in html or so... This is just damn hard :)
Martin ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet
News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000
Newsgroups ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
=---
Martin,
Of course if you want to generalize the layout even more to support any
number of controls, you can use something like:
' single vertical column
Private Sub Panel1_Layout(B yVal sender As Object, ByVal e As
System.Windows. Forms.LayoutEve ntArgs) Handles Panel1.Layout
For Each control As Control In Panel1.Controls
control.Dock = DockStyle.Top
control.Height = Panel1.Height \ Panel1.Controls .Count
Next
End Sub
' single horizontal row
Private Sub Panel1_Layout(B yVal sender As Object, ByVal e As
System.Windows. Forms.LayoutEve ntArgs) Handles Panel1.Layout
For Each control As Control In Panel1.Controls
control.Dock = DockStyle.Left
control.Width = Panel1.Width \ Panel1.Controls .Count
Next
End Sub
Just place all the controls on a panel, then use the above code, in the
panel's layout event.
Note: The above routine will leave a slight gap after the last control... I
would consider making the very last control Fill to avoid this gap.
Hope this helps
Jay
"Martin Ho" <ma******@74tec h-dot-com.no-spam.invalid> wrote in message
news:3f******** @127.0.0.1... I know this must be trivial for many of you. But I am playing with this and can't figure it out.
I have a form, on that form is one panel which has 3 textboxes, when I run my program and maximize the form I want to resize my 3 text boxes according to the size of the form. Each text box should take 33% of the panel's width and full hight of the panel's height. Resizing of the panel is easy with docking... but these 3 textboxes are driving me crazy. Any ideas? Please ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet
News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000
Newsgroups ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
=---
Thanks a lot for all your help guy's.
Martin
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
My control is called GroupBox2, so I added this code suggested by Jay
B. Harlow, and it worked like a charm, thanks a lot Jay:
Private Sub GroupBox2_Layou t(ByVal sender As
Object, ByVal e As System.Windows. Forms.LayoutEve ntArgs) Handles
GroupBox2.Layou t
For Each control As Control In GroupBox2.Contr ols
control.Dock = DockStyle.Top
control.Height = GroupBox2.Heigh t \
GroupBox2.Contr ols.Count
Next
For Each control As Control In GroupBox2.Contr ols
control.Dock = DockStyle.Left
control.Width = GroupBox2.Width \
GroupBox2.Contr ols.Count
Next
End Sub
Backup form for this topic: http://www.dotnetboards.com/viewtopic.php?t=7483
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =--- This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Nick |
last post by:
Hi - I'm trying to loop through the textboxes on a page to unlock them for
editing. The Enabled property is set to false, and the following code is on
an 'Edit' button on the form. Can anyone tell me why it doesn't work?
Thanks
Nick.
Code:
|
by: the friendly display name |
last post by:
Hello newsgroup..
Following problem:
I have two buttons on a page, If I click on button1, an additional textbox
should be dynamical created and added to a panel. If I click on button2, one
box should be removed from the Panel.
The values of the textboxes should of course be the same through all
viewstates.
|
by: tjfdownsouth |
last post by:
I am using a panel inside an asp.net 2.0 page so that I can have the
scrolling capabilities. Inside the panel I have a datagrid that I would like
to stay within a certain area. On the initial page load the panel works as
expected but when I load the datagrid the panel expands off the side of the
page to accomidate the new grid size. Does anyone know how to prevent this
without using an absolute size. The panel basically takes up the...
|
by: Yuk Tang |
last post by:
If I have a panel in which I have placed a maximised form, what's the
easiest way to resize the form to automatically fill the panel when the
panel is resized? I am using VS 2003.
--
Cheers, ymt.
|
by: theresa |
last post by:
Hello. I'm creating a form that has (up to) 10 identical panels on the
page, with each panel containing the same 8 textboxes for things like
school name, address, etc, and one dropdown box. The user chooses how
many schools they need to enter information for, and the form shows the
appropriate number of panels. All 10 panels are generated on page load,
then hidden until the user selects how many they need.
Now comes the tricky part. If...
| |
by: mnath |
last post by:
i am creating a user interface where user can give multiple inputs in a grid fashion. i have decided panel control is to be used and textboxes are to added dynamically.
now i am not able to add more than two textboxes. the textboxes are to be one above the other. panel should show scroll bar as more textboxes are add. can any of u assist me. thanks in advance.
|
by: =?Utf-8?B?c2lwcHl1Y29ubg==?= |
last post by:
I have a usercontrol that has a panel as a band across the width of the user
control
When the usercontrol is diaplayed the button is not centered.
If I anchor the button to the panel Left/Top/Right the button get's streched
which I want to try to avoid.
Anyone have ideas on how to center the button in the panel not matter
the size of the panel??
|
by: steve |
last post by:
I have a form with a toolstrip, a panel and a status bar. On the panel I added an event handler for ClientSizeChanged but it calls
the handler umpteen times during a resize. Is there any way that I can just capture the final event when the user has finished
resizing? If it takes a relatively long time to regenerate the panel then the whole application is going to stutter.
Is ClientSizeChanged the best event to capture for this or is there...
|
by: adarshyam |
last post by:
Hi, I am trying to import contents of excel spread sheet to the panel of textboxes (NOT datagrid). can anybody please tel me how to import the contents of each cell in the column into the textboxes dynamically as soon as the user opens the link of excel into the form. pls temme how to get the link into the form and how to retrieve the cells contents from that excel link and place into textboxes.
pls gimme some guidance .. i jus know how to...
|
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,...
|
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...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |