• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 396
  • Last Modified:

Is there a way to make the boundry lines of a groupbox more visible (i.e. thicker)? If so, how?

Friends,

Is there a way to make the boundry lines of a groupbox more visible (i.e. thicker)?  If so, how?

Best Regards,
Eric
0
indy500fan
Asked:
indy500fan
  • 11
  • 8
1 Solution
 
planoczCommented:
Here is a sample of different views...



'Form 1

Public Class Form1
    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.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call
        Select Case GroupBox1.DrawStyle
            Case 1
                GroupBox1.Text = "Etched"
            Case 2
                GroupBox1.Text = "RaisedOuter"
            Case 3
                GroupBox1.Text = "SunkenOuter"
            Case 4
                GroupBox1.Text = "Flat"
            Case 5
                GroupBox1.Text = "Raised"
            Case 6
                GroupBox1.Text = "Bump"

        End Select
    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.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.
    Friend WithEvents GroupBox1 As My3DControls.ctlGroupBox3D
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.GroupBox1 = New My3DControls.ctlGroupBox3D
        Me.SuspendLayout()
        '
        'GroupBox1
        '
        Me.GroupBox1.DrawStyle = 4
        Me.GroupBox1.FlatStyle = System.Windows.Forms.FlatStyle.Flat
        Me.GroupBox1.Location = New System.Drawing.Point(20, 16)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(216, 128)
        Me.GroupBox1.TabIndex = 0
        Me.GroupBox1.TabStop = False
        Me.GroupBox1.Text = "GroupBox1"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(292, 266)
        Me.Controls.Add(Me.GroupBox1)
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.ResumeLayout(False)

    End Sub

#End Region

End Class


'CLASS

Imports System.Windows.Forms

Public Class ctlGroupBox3D
    Inherits System.Windows.Forms.GroupBox
    Private miDrawstyle As Integer
#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()
        '
        'ctlGroupBox3D
        '
        Me.FlatStyle = System.Windows.Forms.FlatStyle.Flat

    End Sub
#End Region
    Public Property DrawStyle() As Integer
        Get
            Return miDrawstyle
        End Get
        Set(ByVal Value As Integer)
            Select Case Value
                Case 1 To 6
                    miDrawstyle = Value
            End Select
        End Set
    End Property
    Private Sub ctlGroupBox3D_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
        Select Case miDrawstyle
            Case 1  'flat with Etched lines
                ControlPaint.DrawBorder3D(e.Graphics, ClientRectangle, Border3DStyle.Etched)
            Case 2  'Raised Outer only
                ControlPaint.DrawBorder3D(e.Graphics, ClientRectangle, Border3DStyle.RaisedOuter)
            Case 3  'sunken:
                ControlPaint.DrawBorder3D(e.Graphics, ClientRectangle, Border3DStyle.SunkenOuter)
            Case 4  'Flat with line:
                ControlPaint.DrawBorder3D(e.Graphics, ClientRectangle, Border3DStyle.Flat)
            Case 5  'Raised All
                ControlPaint.DrawBorder3D(e.Graphics, ClientRectangle, Border3DStyle.Raised)
            Case 6  'Bump sides
                ControlPaint.DrawBorder3D(e.Graphics, ClientRectangle, Border3DStyle.Bump)
        End Select
    End Sub
End Class
0
 
indy500fanAuthor Commented:
When I do this, I get the following error:

 'DrawStyle' is not a member of 'System.Windows.Forms.GroupBox'.


In the following code:

        Select Case GroupBox1.DrawStyle '<----------Error here
            Case 1
                GroupBox1.Text = "Etched"
            Case 2
                GroupBox1.Text = "RaisedOuter"
            Case 3
                GroupBox1.Text = "SunkenOuter"
            Case 4
                GroupBox1.Text = "Flat"
            Case 5
                GroupBox1.Text = "Raised"
            Case 6
                GroupBox1.Text = "Bump"

        End Select
0
 
planoczCommented:
did you add  the class ctlGroupBox3D to your project?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
indy500fanAuthor Commented:
I am just making this a test project for now, and yes I did add it to the test project.

Am I supposed to reference it somewhere?
0
 
indy500fanAuthor Commented:
   I missed adding the Me.GroupBox1 = New My3DControls.ctlGroupBox3D in the form.

I added it and now I get the following error:

 Type 'My3DControls.ctlGroupBox3D' is not defined.


 Me.GroupBox1 = New My3DControls.ctlGroupBox3D

And when I look at the ctlGroupBox3D class I don't see any reference to My3DControls...
0
 
planoczCommented:
sorry my paste was off by one line...

Imports My3DControls.ctlGroupBox3D
Public Class Form1
0
 
indy500fanAuthor Commented:
??? I get the error:

Namespace or type 'ctlGroupBox3D' for the Imports 'My3DControls.ctlGroupBox3D' cannot be found.

I created ctlGroupBox3D as a Add New Item - Class.  Did I do that wrong?
0
 
planoczCommented:
My3DControls is the name of the project and ctlGroupBox3D is the Class name that sits in the project.
0
 
indy500fanAuthor Commented:
Do I have to do all this as a control?  Can I simply add this functionality though your code to my current project?  Or do I HAVE to have this as a reference in my current project.
0
 
planoczCommented:
no control. Just add the class to your project and imports "MYprojectname".ctlgroupbox3D to your main form and change the System.Windows.Forms.GroupBox to "MYprojectname".ctlgroupbox3D
"MYprojectname" is the name of your project.
0
 
indy500fanAuthor Commented:
Planocz.  Alrighty then.  Is it monday?
0
 
planoczCommented:
yep
0
 
indy500fanAuthor Commented:
I'm just making a mess of my project.  I'm going to give you the points because I've worked with you before and I'm sure this works, but I sure as heck can't get it to work in my stuff...

Thanks,
Eric
0
 
indy500fanAuthor Commented:
Any other suggestions
0
 
indy500fanAuthor Commented:
Do you have any other suggestions on how to do this?
0
 
planoczCommented:
post the code and I will check it. I know we can get it working
0
 
indy500fanAuthor Commented:
Planocz,

I figured out what was wrong.  I see now what you were trying to do.  I'm not sure this will work, but it is certainly better than the standard flat style.

thanks for being patient with me.

Eric
0
 
planoczCommented:
You can change the drawtype # to 1 thru 6 and see different styles.
I think the raised style would work for you.
0
 
indy500fanAuthor Commented:
Yep, that's the one I finally decided upon.  Thanks for all your help!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 11
  • 8
Tackle projects and never again get stuck behind a technical roadblock.
Join Now