LightCap - LightCap - -4 years ago 71
C# Question

Transparent, clickable through, Text Displayeble form c#

Hello I want to make form application that will be full screen transparent and clickable throught but it will display text. I dont even need form if there is way to display text on top of the screen (if some more apps will be open)enter image description here

Like so.

Thanks.

Answer Source

Use this sample code:

using System;
using System.Drawing;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
    static class Program
    {
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var F = new Form
            {
                BackColor = Color.Black,
                TransparencyKey = Color.Black,
                Bounds = Screen.PrimaryScreen.Bounds,
                FormBorderStyle = FormBorderStyle.None,
            };

            var L = new Label
            {
                AutoSize = false,
                Text="Hello, World!",
                Dock = DockStyle.Fill,
                ForeColor = Color.White,
                Font = new Font("Consolas", 26),
                TextAlign = ContentAlignment.MiddleCenter
            };

            F.Controls.Add(L);
            Application.Run(F);
        }
    }
}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download