hii all i want to make background for form to be transparent i need the background only not the controls on it plz ....

i dont need to use transparent key or opacity properties

i have example to do it but it by vb 0.6 i need any one to convert it to vb.net plzzzzzzzzzz .................

i tryed to open the project in vs but it failed some code on vb 0.6 not supported on dot net plz some one help me

Recommended Answers

All 8 Replies

Member Avatar for iamthwee

>I don't need to use transparent of opacity
So how do you intend to do it then?

yeah, just use form.opacity

Well if you do come up with a solution other than using opacity do let me know.

opacity not works every-time for example if i want to use a image as my form base then every thing else must be hidden including form border.
to achieve this you have to set first form.border=none
and now to move form without border you need this code .....
http://www.daniweb.com/forums/thread31022.html
and to make the form transparent use
form.backcolor=color.hottrack
form.transperencykey=color.hottrack
you can change the colors but i suggest to use non regular colors only.

Transparent Form

Imports System.Runtime.InteropServices

Public Class Form1
<Runtime.InteropServices.StructLayout(Runtime.InteropServices.LayoutKind.Sequential)> Public Structure MARGINS
Public LeftWidth As Integer
Public RightWidth As Integer
Public TopHeight As Integer
Public Buttomheight As Integer
End Structure

<Runtime.InteropServices.DllImport("dwmapi.dll")> Public Shared Function DwmExtendFrameIntoClientArea(ByVal hWnd As IntPtr, ByRef pMarinset As MARGINS) As Integer
End Function

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
Me.BackColor = Color.Black
Dim margins As MARGINS = New MARGINS
margins.LeftWidth = -1
margins.RightWidth = -1
margins.TopHeight = -1
margins.Buttomheight = -1
Dim result As Integer = DwmExtendFrameIntoClientArea(Me.Handle, margins)
Catch ex As Exception
MsgBox("Sistemul tau de operare nu are aero style!", vbCritical, "Fatal Error")
Application.Exit()
End Try
End Sub
End Class

done by "Ram basa"
Ty IT student
sandesh college

hii all i want to make background for form to be transparent i need the background only not the controls on it plz ....

i dont need to use transparent key or opacity properties

i have example to do it but it by vb 0.6 i need any one to convert it to vb.net plzzzzzzzzzz .................

i tryed to open the project in vs but it failed some code on vb 0.6 not supported on dot net plz some one help me

Try this one:

Public Sub InitializeMyForm()
    BackColor = Color.White
    ' Make the background color of form display transparently.
    TransparencyKey = BackColor
End Sub 'InitializeMyForm

Well if you do come up with a solution other than using opacity do let me know.

would also like the have the new idea

hii all i want to make background for form to be transparent i need the background only not the controls on it plz ....

i dont need to use transparent key or opacity properties

i have example to do it but it by vb 0.6 i need any one to convert it to vb.net plzzzzzzzzzz .................

i tryed to open the project in vs but it failed some code on vb 0.6 not supported on dot net plz some one help me

Just decrease the opacity in the form properties

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.