Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Manch (Programmer) (OP)
30 Jun 04 15:00
Can you make the groupbox border appear as etched.  I swear I have seen this in many VB .Net screenshots.  I have tried changing the flatstyle property but with no luck.  If I change the flatstyle to standard I get a grey border, but not etched, and any other setting for flatstyle and I get a blue border.  I am using VS .Net 2003.

Any guidance is greatly appreciated.

Manch
RiverGuy (Programmer)
30 Jun 04 15:12
I always thought it was etched.  Maybe its raised.  If you have a link to a screenshot, post it.  I never recall seeing anything differerent on them.

But they could be custom, as a group-box like contronl would be one of the easier ones to create.
Manch (Programmer) (OP)
1 Jul 04 8:33
Thanks for your response!  It was because I had changed the backcolor of my form to a light color.  It seems Visual Studio picks a color that is a good contrast to the forms background color when it can not properly display the etched effect.  I should have figured that out sooner, one of those brain cramps I guesse.

Manch
RiverGuy (Programmer)
1 Jul 04 14:34
The thing that has always bugged me about the GroupBox/Frame is the fact that when the background color is changed is the fact that there is colored space outside of the frame, at the top, by the text.  IMO, it should have been made transparent outside of the border.
Manch (Programmer) (OP)
1 Jul 04 14:36
I agree.  They could have done a lot more with the groupbox.
Helpful Member!(2)  SHelton (Programmer)
2 Jul 04 5:51
I use the following GroupBox implementation to provide rounded corners and a correctly coloured outside edge.  It might give you what you want...

CODE

Imports System.Drawing.Drawing2D

Public Class GroupBoxEx
    Inherits System.Windows.Forms.GroupBox

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'UserControl 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.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    '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.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        components = New System.ComponentModel.Container
    End Sub

#End Region

#Region " Properties "

    Private cBorder As Color = Color.Black

    Public Property BorderColor() As Color
        Get

            Return cBorder

        End Get

        Set(ByVal Value As Color)

            cBorder = Value

            Invalidate()

        End Set

    End Property

#End Region

#Region " Paint "

    Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)

        'Draw the border

        Dim p As New Pen(cBorder, 1)

        Dim gp As New GraphicsPath

        gp.AddArc(New Rectangle(0, 9, 16, 16), 180, 90)

        gp.AddArc(New Rectangle(Width - 17, 9, 16, 16), 270, 90)

        gp.AddArc(New Rectangle(Width - 17, Height - 18, 16, 16), 0, 90)

        gp.AddArc(New Rectangle(0, Height - 18, 16, 16), 90, 90)

        gp.AddLine(0, 17, 0, Height - 17)

        e.Graphics.FillPath(New SolidBrush(BackColor), gp)

        e.Graphics.DrawPath(p, gp)

        'Draw the caption

        Dim sf As SizeF = e.Graphics.MeasureString(Text, Font)

        e.Graphics.FillRectangle(New SolidBrush(Color.Transparent), 16, 2, sf.Width, sf.Height + 4)

        e.Graphics.DrawLine(New Pen(BackColor), 16, 9, 16 + sf.Width, 9)

        e.Graphics.DrawString(Text, Font, New SolidBrush(ForeColor), 18, 3)

        gp.Dispose()

        p.Dispose()

    End Sub

    Protected Overrides Sub OnPaintBackground(ByVal pevent As System.Windows.Forms.PaintEventArgs)

        pevent.Graphics.FillRectangle(New SolidBrush(Parent.BackColor), pevent.ClipRectangle)

    End Sub

#End Region

End Class
Manch (Programmer) (OP)
2 Jul 04 9:11
Thanks SHelton,

I will give it a try!

Manch
chrissie1 (Programmer)
2 Jul 04 14:13
thanks shelton

a star for a star

Christiaan Baes
Belgium

What a wonderfull world - Louis armstrong

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close