|
-
Apr 28th, 2011, 04:18 AM
#1
Thread Starter
Fanatic Member
panel control with
is there any free panel or frame or groupbox control that has a header where i can type text, maybe with gradient?
Thanks
-
Apr 28th, 2011, 05:28 AM
#2
Fanatic Member
Re: panel control with
I think you have to use GDI to draw border plus label to do that.
If you know WPF then this is a example about that :
http://www.vbdotnetheaven.com/UploadFile/rohatash/5311/
-
Apr 28th, 2011, 05:55 AM
#3
Thread Starter
Fanatic Member
Re: panel control with
will WPF work in .net 2.0?
-
Apr 28th, 2011, 09:37 AM
#4
Re: panel control with
Hi,
WPF is brought to world within .net 3.0 and you'd better follow that.
Then change it this way:
1. You get VS 2008
2. Take your old project.
3. Change the targetting to .net 3.0/3.5 so slight conversion takes place against your project files.
4. Ensure that the project is built and runs without changes
5. Add references to your WPF assemblies containing prepared WPF forms or add the form to a project
6. Use WPF interop bringing the form/control into Winforms
-
Apr 29th, 2011, 04:42 AM
#5
Thread Starter
Fanatic Member
Re: panel control with
am targeting winxp upwards and .net 2.0 framework. am borderd about .net 3.0 download which is very large.
-
Apr 29th, 2011, 10:39 AM
#6
Re: panel control with
The following custom GroupBox I created has a TextBox where the Text of the GroupBox is usually located. I am sure the logic for sizing the TextBox could use some more work but my simple test it works fine.
Add the class (see attachment) to your project, build then place the control onto your form and try it out. Again I am sure it will need some tweaking which I do not have time at the moment to do.
Code:
Public Class GroupBoxTextBox
Inherits GroupBox
Private WithEvents mTextBox As New TextBox
Public Sub New()
MyBase.New()
mTextBox = New TextBox
mTextBox.Multiline = True
mTextBox.Location = New Drawing.Point(0, 0)
Me.Controls.Add(mTextBox)
mTextBox.Text = mTextBox.Text
MyBase.Text = ""
End Sub
Public Overrides Property Text() As String
Get
Return MyBase.Text
End Get
Set(ByVal Value As String)
MyBase.Text = ""
mTextBox.Text = Value
Dim gr As Drawing.Graphics = Me.CreateGraphics
Dim Size As Drawing.SizeF = gr.MeasureString(mTextBox.Text, Me.Font)
Dim ProposedWidth As Integer = CInt(Size.Width + 20)
If ProposedWidth < Me.ClientSize.Width Then
mTextBox.Size = New Drawing.Size(ProposedWidth, CInt(Size.Height + 5))
Else
' Constrain TextBox width within the parent client area
mTextBox.Size = New Drawing.Size(Me.ClientSize.Width - 5, CInt(Size.Height + 5))
End If
End Set
End Property
End Class
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|