Ewomazino Ukah
Ewomazino Ukah

Reputation: 2366

i'm trying to make d background color of a radpanel ( using telerik) transluscent

i have tried using this code below but it doesnt seem to work:

Public Class TransparentPanel
      Inherits Panel
      Protected Overrides ReadOnly Property CreateParams() As CreateParams
      Get
        Dim cp As CreateParams = MyBase.CreateParams
        cp.ExStyle = cp.ExStyle Or &H20
        ' WS_EX_TRANSPARENT
        Return cp
      End Get
End Property

Protected Overrides Sub OnPaint(e As PaintEventArgs)
    e.Graphics.FillRectangle(New SolidBrush(Me.BackColor), Me.ClientRectangle)
End Sub
End Class

'======================================================= 'Service provided by Telerik (www.telerik.com) 'Conversion powered by NRefactory. 'Twitter: @telerik 'Facebook: facebook.com/telerik '=======================================================

Here is my code :

Imports Telerik.WinControls

Public Class Form1


  Private Sub Button1_Click(sender As System.Object, e As System.EventArgs)    Handles Button1.Click

      '' RadPanel1.BackColor = Color.Red
       RadPanel1.Visible = True
    RadPanel1.AutoSize = True
    RadPanel1.RootElement.StretchVertically = True
    RadPanel1.RootElement.StretchHorizontally = True
    RadPanel1.Location = New Point(2, 2)
    RadPanel1.Size = New Size(200, 1)
    RadPanel1.Text = "I am RadPanel"

    Dim setting As New AnimatedPropertySetting()
    setting.[Property] = RadElement.BoundsProperty
    setting.StartValue = New Rectangle(0, 0, 200, 1)
    setting.EndValue = New Rectangle(0, 0, 280, 250)
    setting.Interval = 30
    setting.NumFrames = 35
    setting.ApplyValue(RadPanel1.RootElement)
End Sub


End Class

Upvotes: 0

Views: 257

Answers (2)

checho
checho

Reputation: 3120

When working with transparency in WinForms you should have in mind that a control can be transparent only compared to its parent control. Therefore, you will be able to observe RadPanel transparency compared to the Form, if the Form is its parent. However, if you have two RadPanels, both children to the Form, but not children to each other, you will not see transparency in the place where they overlap each other.

Here are some articles on the matter:

Upvotes: 1

Seano666
Seano666

Reputation: 2238

Have you tried using setting the color with Alpha property? From what I can see, others have had success with this.

RadPanel1.BackColor = Color.FromArgb(100, 88, 44, 55);

How can I set the opacity or transparency of a Panel in WinForms?

Upvotes: 1

Related Questions