WinフォームアプリでPictureBoxの上にPictureBoxを重ねて背景を透過させる方法
画像の上に画像を乗せて、前面の画像の背景を透過させたい場合があります
その方法についてみていきましょう
PictureBoxを乗せただけの場合
背景が白色になってしまいます

手順
プロパティの変更
透過させたいPictureBoxを選択し、BackColorを変更します

親コンテナの変更
透過させたいPictureBoxの親コンテナを変更します
コードでは、pictureBox1は背景の山のイラストでpictureBox2は、りんごのイラストになります
using System.Windows.Forms;
namespace CustomButton
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
pictureBox2.Parent = pictureBox1;
}
}
}
実行
画像背景が透過されているのを確認します

ディスカッション
コメント一覧
まだ、コメントがありません