Making a usercontrol Transparent
-
Hi all, I am making a usercontrol but i would like it to make its background colour transparent?:) Does anyone know how to do this? i would like the background colour to be transperent when the control is moved as well, so it does not affect other controls on the form this is my code so far..... Public Class MyTransparentControl Inherits UserControl Protected Overrides Sub OnPaint(ByVal e As Windows.Forms.PaintEventArgs) Dim myPath As New System.Drawing.Drawing2D.GraphicsPath Dim myGraphics As Graphics = e.Graphics Dim myPen As New Pen(Color:=Me.ForeColor, Width:=2) Me.Size = New Size(100, 100) myPath.AddLine(0, 0, 100, 0) myPath.AddLine(100, 0, 100, 100) myPath.AddLine(100, 100, 0, 100) myPath.AddLine(0, 100, 0, 0) myGraphics.DrawPath(Pen:=myPen, path:=myPath) End Sub End Class Dont forget to rock and roll this summer!
-
Hi all, I am making a usercontrol but i would like it to make its background colour transparent?:) Does anyone know how to do this? i would like the background colour to be transperent when the control is moved as well, so it does not affect other controls on the form this is my code so far..... Public Class MyTransparentControl Inherits UserControl Protected Overrides Sub OnPaint(ByVal e As Windows.Forms.PaintEventArgs) Dim myPath As New System.Drawing.Drawing2D.GraphicsPath Dim myGraphics As Graphics = e.Graphics Dim myPen As New Pen(Color:=Me.ForeColor, Width:=2) Me.Size = New Size(100, 100) myPath.AddLine(0, 0, 100, 0) myPath.AddLine(100, 0, 100, 100) myPath.AddLine(100, 100, 0, 100) myPath.AddLine(0, 100, 0, 0) myGraphics.DrawPath(Pen:=myPen, path:=myPath) End Sub End Class Dont forget to rock and roll this summer!
Try here, http://www.bobpowell.net/transcontrols.htm[^] it can be converted to vb.net here: http://www.developerfusion.com/utilities/convertcsharptovb.aspx[^]