【问题标题】:A Transparent Button over A Windows Media Player element in C# WinFormsC# WinForms 中 Windows Media Player 元素上的透明按钮
【发布时间】:2018-09-30 21:15:01
【问题描述】:

我一直在尝试在 Windows Media Player 按钮上设置一个隐藏按钮,但无论我如何尝试,它总是显示为灰色

axWindowsMediaPlayer1.Location = new Point(0, 0);
axWindowsMediaPlayer1.Size = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
axWindowsMediaPlayer1.URL = "assets//vid//INTRO//INTRO_START.mp4";
axWindowsMediaPlayer1.Ctlcontrols.play();
axWindowsMediaPlayer1.uiMode = "none";
axWindowsMediaPlayer1.enableContextMenu = false;

startButton.Location = new Point(524, 741);
startButton.Size = new Size(1070, 236);
startButton.FlatStyle = FlatStyle.Flat;
startButton.BackColor = Color.Transparent;
startButton.FlatAppearance.BorderSize = 0;
startButton.Click += StartButton_Click;
this.Controls.Add(startButton);
startButton.BringToFront();

按钮的背景是灰色的,输出总是相同的

https://imgur.com/a/r312oyC

【问题讨论】:

  • 我看不到任何按钮。但是:我认为无论如何都不允许透明元素接受用户交互;这将是一个糟糕的用户体验,不是吗?
  • 建议:试试startButton.FlatStyle = FlatStyle.Popup

标签: c# winforms button video transparent


【解决方案1】:

将背景图像和图像设置都设置为一个完整的 alpha 空白 png

【讨论】:

    【解决方案2】:

    我使用这个类 public class TransparentButton 找到了答案:按钮

    C# Windows Form Application Transparent button

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多