הערה
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות להיכנס או לשנות מדריכי כתובות.
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות לשנות מדריכי כתובות.
Question
Saturday, June 13, 2009 5:47 AM
i want insert a text into tablelayoutpanel cells..present i am inserting with the help of labels i am placing into cells..but it takes more time..so i decided to any other way to do this one..
so i need with any controls insert in text .
A | B | C | |
---|---|---|---|
D | E | F | |
G | H | I | |
Like this i need to display dynamically..........
Please Help any one..
Thanks & Regards....
All replies (4)
Saturday, June 13, 2009 7:56 AM
The form has to be loaded in any way, here a complete sample how to draw a text on a form.
If you want to draw in a control, then you need much more effort than is possible for a forum sample.
You then can better buy a 3th party control which fits to your needs.
But you should be able to do with this sample to do what you want, be aware that beside the draw string there are too draw lines and all other kind of drawing classes
Public Class Form1
Dim WithEvents bt As New Button With {.Size = New Size(70, 20), .Location = New Point(70, 20)}
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Controls.Add(bt)
End Sub
Private Sub bt_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles bt.Click
Dim gr As Graphics = CreateGraphics()
Dim txt As String = "TheText"
Dim theFont As New Font("Times New Roman", 30, FontStyle.Bold, GraphicsUnit.Pixel)
Dim layout_rect As New RectangleF(0, 0, _
Me.ClientSize.Width - 1, Me.ClientSize.Height - 1)
Dim strFormat As New StringFormat
strFormat.Alignment = StringAlignment.Center
strFormat.LineAlignment = StringAlignment.Center
strFormat.FormatFlags = _
StringFormatFlags.DirectionVertical Or _
StringFormatFlags.DirectionRightToLeft
gr.DrawString(txt, theFont, Brushes.Red, layout_rect, strFormat)
End Sub
End Class
Success
Cor
Saturday, June 13, 2009 12:04 PM
hi Cor Ligthert ..
you are not understand my question ..my quesation is ..i am creating tableLayoutpanel with 24 columns * 24 rows..and each cell i am creating Label .so it's take so much of time to creating..so other than this is there any possible to placing only Text in each cell with out creaing control..
Thanks & Reagrds
Wednesday, March 16, 2011 9:33 AM
hey dilip have u got ur thing solved??
i'd like to know..
thanks in advance!!
Wednesday, March 16, 2011 11:00 AM
take so much of time to creating
What do you mean it take so much of time to create all labels. Do you create all labels manually?
You can create all of label through your code like below,
Remeber to put **SuspendLayout/ResumeLayout, **It can stop reprinting the form until all of labels are created.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.TableLayoutPanel1.RowCount = 24
Me.TableLayoutPanel1.ColumnCount = 24
Me.TableLayoutPanel1.SuspendLayout()
For column = 0 To Me.TableLayoutPanel1.RowCount - 1
Me.TableLayoutPanel1.ColumnStyles.Add(New RowStyle(SizeType.AutoSize, 100))
For row = 0 To Me.TableLayoutPanel1.RowCount - 1
Me.TableLayoutPanel1.RowStyles.Add(New RowStyle(SizeType.AutoSize, 100))
Dim lblLabel As New Label()
lblLabel.Text = "Label: " + row.ToString() + column.ToString
Me.TableLayoutPanel1.Controls.Add(lblLabel, column, row)
Next row
Next column
Me.TableLayoutPanel1.ResumeLayout()
End Sub
Regards