This is a migrated thread and some comments may be shown as answers.

Panel Borderstyle

1 Answer 188 Views
Panel
This is a migrated thread and some comments may be shown as answers.
Sanchit
Top achievements
Rank 2
Sanchit asked on 25 Sep 2014, 12:19 PM
I am currently converting a VB.net project over to Teleriks components.  On one of my forms i have multiple panels.  When one of the panels get clicked the borderstyle changes to fixed3D and the rest change to FixedSingle.  But, with telerik borderstyle is not a member.  Is there a work away around this?  Do i need to change it from a panel to a label for this feature?  Below is my code.

Thank You

#Region "PRIORITY PANEL SELECT"
    Private Sub Panel2_Clicked(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Panel2.Click
        Try
            If Panel2. = BorderStyle.FixedSingle Then
                Panel2.BorderStyle = BorderStyle.Fixed3D
                Panel3.BorderStyle = BorderStyle.FixedSingle
                Panel4.BorderStyle = BorderStyle.FixedSingle
                Panel5.BorderStyle = BorderStyle.FixedSingle
                Panel6.BorderStyle = BorderStyle.FixedSingle
            Else
                Panel2.BorderStyle = BorderStyle.FixedSingle
            End If
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
    End Sub

    Private Sub Panel3_Clicked(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Panel3.Click
        Try
            If Panel3.BorderStyle = BorderStyle.FixedSingle Then
                Panel3.BorderStyle = BorderStyle.Fixed3D
                Panel2.BorderStyle = BorderStyle.FixedSingle
                Panel4.BorderStyle = BorderStyle.FixedSingle
                Panel5.BorderStyle = BorderStyle.FixedSingle
                Panel6.BorderStyle = BorderStyle.FixedSingle
            Else
                Panel3.BorderStyle = BorderStyle.FixedSingle
            End If
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
    End Sub

    Private Sub Panel4_Clicked(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Panel4.Click
        Try
            If Panel4.BorderStyle = BorderStyle.FixedSingle Then
                Panel4.BorderStyle = BorderStyle.Fixed3D
                Panel3.BorderStyle = BorderStyle.FixedSingle
                Panel2.BorderStyle = BorderStyle.FixedSingle
                Panel5.BorderStyle = BorderStyle.FixedSingle
                Panel6.BorderStyle = BorderStyle.FixedSingle
            Else
                Panel4.BorderStyle = BorderStyle.FixedSingle
            End If
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
    End Sub

    Private Sub Panel5_Clicked(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Panel5.Click
        Try
            If Panel5.BorderStyle = BorderStyle.FixedSingle Then
                Panel5.BorderStyle = BorderStyle.Fixed3D
                Panel3.BorderStyle = BorderStyle.FixedSingle
                Panel4.BorderStyle = BorderStyle.FixedSingle
                Panel2.BorderStyle = BorderStyle.FixedSingle
                Panel6.BorderStyle = BorderStyle.FixedSingle
            Else
                Panel5.BorderStyle = BorderStyle.FixedSingle
            End If
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
    End Sub

    Private Sub Panel6_Clicked(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Panel6.Click
        Try
            If Panel6.BorderStyle = BorderStyle.FixedSingle Then
                Panel6.BorderStyle = BorderStyle.Fixed3D
                Panel3.BorderStyle = BorderStyle.FixedSingle
                Panel4.BorderStyle = BorderStyle.FixedSingle
                Panel5.BorderStyle = BorderStyle.FixedSingle
                Panel2.BorderStyle = BorderStyle.FixedSingle
            Else
                Panel6.BorderStyle = BorderStyle.FixedSingle
            End If
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
    End Sub
#End Region





1 Answer, 1 is accepted

Sort by
0
George
Telerik team
answered on 30 Sep 2014, 08:25 AM
Hello Sanchit,

Your question was answered in your other support thread - "Panel Borderstyle". Since someone may find this information helpful, I am posting the answer here as well. 

You can customize the BorderPrimitive by modifying the RadPanel.PanelElement.PanelBorder property. Thus, you can change the border's width, color, box style etc. in order to simulate BorderStyle.Fixed3D. Here is a sample code snippet:
Private Sub RadPanel1_Click(sender As Object, e As EventArgs) Handles RadPanel1.Click
    Try
        If Me.RadPanel1.PanelElement.PanelBorder.BoxStyle = Telerik.WinControls.BorderBoxStyle.FourBorders Then
  
            SetSingleBorder(Me.RadPanel1.PanelElement.PanelBorder)
            SetFourBorders(Me.RadPanel2.PanelElement.PanelBorder)
        Else
            SetFourBorders(Me.RadPanel1.PanelElement.PanelBorder)
            SetSingleBorder(Me.RadPanel2.PanelElement.PanelBorder)
        End If
    Catch ex As Exception
        MessageBox.Show(ex.ToString)
    End Try
End Sub
  
Private Sub RadPanel2_Click(sender As Object, e As EventArgs) Handles RadPanel2.Click
    Try
        If Me.RadPanel2.PanelElement.PanelBorder.BoxStyle = Telerik.WinControls.BorderBoxStyle.FourBorders Then
            SetSingleBorder(Me.RadPanel2.PanelElement.PanelBorder)
            SetFourBorders(Me.RadPanel1.PanelElement.PanelBorder)
        Else
            SetFourBorders(Me.RadPanel2.PanelElement.PanelBorder)
            SetSingleBorder(Me.RadPanel1.PanelElement.PanelBorder)
        End If
    Catch ex As Exception
        MessageBox.Show(ex.ToString)
    End Try
End Sub
  
Private Sub SetFourBorders(borderPrimitive As Telerik.WinControls.Primitives.BorderPrimitive)
    borderPrimitive.BoxStyle = Telerik.WinControls.BorderBoxStyle.FourBorders
    borderPrimitive.TopWidth = 3
    borderPrimitive.TopColor = Color.Gray
    borderPrimitive.TopShadowColor = Color.LightGray
    borderPrimitive.LeftWidth = 3
    borderPrimitive.LeftColor = Color.Gray
    borderPrimitive.LeftShadowColor = Color.LightGray
    borderPrimitive.BottomWidth = 1
    borderPrimitive.BottomColor = Color.Gray
    borderPrimitive.RightWidth = 1
    borderPrimitive.RightColor = Color.Gray
End Sub
  
Private Sub SetSingleBorder(borderPrimitive As Telerik.WinControls.Primitives.BorderPrimitive)
    borderPrimitive.BoxStyle = Telerik.WinControls.BorderBoxStyle.SingleBorder
    borderPrimitive.Width = 1
    borderPrimitive.ForeColor = Color.Gray
End Sub

I hope this is helpful. Do not hesitate to let me know, should you have further questions.

Regards,
George
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
Panel
Asked by
Sanchit
Top achievements
Rank 2
Answers by
George
Telerik team
Share this question
or