Click the "fail" form in the application below

I made a shape with an opacity of 30%, and I want it to overlap on my screen so that I can draw a grid, while maintaining the ability to control any programs under it. Therefore, I want the form that I created using the grid to ignore my mouse events, so I can go to the program below it, but still display it on top.

Any ideas on this?

+5
source share
1 answer

You can specify a Transparent KeyColor for a certain color value of the inverse form colors for the clickthru area, this color should be different from the mesh color you selected.

VB.Net, , #

Private Sub frmTest_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
    Dim rc As Rectangle = New Rectangle(0, 0, Me.Width - 1, Me.Height - 1)
    Using br As New Drawing2D.HatchBrush(Drawing2D.HatchStyle.Cross, Color.Silver, Color.Transparent)
        e.Graphics.FillRectangle(br, rc)
    End Using
End Sub

Private Sub frmTest_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Me.TopMost = True : Me.Opacity = 10% : Me.WindowState = FormWindowState.Maximized
    Me.BackColor = Color.White
    Me.TransparencyKey = Color.White
    Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
End Sub
+5

All Articles