【问题标题】:Adding transparent Gif images to list view in c#在 C# 中将透明 Gif 图像添加到列表视图
【发布时间】:2012-04-22 10:25:45
【问题描述】:

我正在尝试将透明 Gif 图像添加到列表视图,我使用了以下代码 sn-p 添加 gif 图片。

// control as ListView 
void AddGiftoListView(Control parent)
{
    Bitmap img = (Bitmap)Properties.Resources.madLoader; // Transparent gif image
    Size sz = img.Size;
    PictureBox pbGif = new PictureBox();
    pbGif.Size = img.Size;
    pbGif.Image = img;

    parent.Controls.Add(pbGif);
    Point p = new Point(1, 1);
    pbGif.Location = p;
    pbGif.Show();
} 

但是 gif 不是透明的,当列表视图填充文本时,我们可以在白色背景的顶部看到 gif。有什么办法可以解决这个问题吗?

谢谢, 石菊P K

【问题讨论】:

    标签: c# listview transparency gif


    【解决方案1】:

    尝试将表单的 TransparencyKey 设为白色

    this.TransparencyKey = Color.White;
    

    【讨论】:

      猜你喜欢
      • 2015-04-18
      • 1970-01-01
      • 2017-02-09
      • 1970-01-01
      • 2016-08-12
      • 1970-01-01
      • 1970-01-01
      • 2011-04-07
      • 1970-01-01
      相关资源
      最近更新 更多