Click here to Skip to main content
15,892,517 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I have a problem using Windows Aero on a form in VB.NET.
If anything (text, pictures, controls) have black in them, then they appear invisible. Does anyone know how to solve the problem?

Code:
C++
Imports System.Runtime.InteropServices

XML
Public Class Form1

    '***********************************
    'Windows Aero Code
    <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
    '***********************************

VB
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
    End Try

C++
End Sub

C++
End Class


Thank-You!


--------------------------------

I know it turns everything black invisible, just wondering if anybody knows how to solve the problem.
Posted
Updated 22-Mar-11 20:31pm
v2

1 solution

They appear invisible because you set the BackColor of your form to black. Because they are the same color, they appear invisible.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900