首页 > 解决方案 > C# WinForms 中 Windows Media Player 元素上的透明按钮

问题描述

我一直在尝试在 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

标签: c#winformsbuttonvideotransparent

解决方案


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


推荐阅读