【问题标题】:Transparent, clickable through, Text Displayable form c# [closed]透明,可点击,文本可显示表单c#[关闭]
【发布时间】:2017-11-13 06:22:06
【问题描述】:

您好,我想制作全屏透明且可点击的表单应用程序,但它会显示文本。如果有办法在屏幕顶部显示文本,我什至不需要表单(如果会打开更多应用程序)enter image description here

像这样。

谢谢。

【问题讨论】:

  • 什么样的应用程序,Web应用程序,控制台应用程序等,到目前为止你做了什么?我建议阅读How to Ask 一个好问题。此外,请务必使用tour,您可以发布您尝试过的内容,并清楚说明哪些内容不起作用,并提供Minimal, Complete, and Verifiable example
  • 我有整个应用程序(Windows 窗体)。该应用程序应该只显示标签。
  • 现有问题有很好的答案,还有很多谷歌搜索结果。 start here...

标签: c# winforms


【解决方案1】:

使用此示例代码:

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);
        }
    }
}

【讨论】:

  • 正是我需要的。谢谢。
猜你喜欢
  • 1970-01-01
  • 2015-12-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-08-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多