Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Making a usercontrol Transparent

Making a usercontrol Transparent

Scheduled Pinned Locked Moved Visual Basic
graphicstutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Fu Manchu
    wrote on last edited by
    #1

    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!

    A 1 Reply Last reply
    0
    • F Fu Manchu

      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!

      A Offline
      A Offline
      Anonymous
      wrote on last edited by
      #2

      Try here, http://www.bobpowell.net/transcontrols.htm[^] it can be converted to vb.net here: http://www.developerfusion.com/utilities/convertcsharptovb.aspx[^]

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups