简体   繁体   English

通过Adobe PDF Reader控件叠加透明图像

[英]Overlay transparent image over Adobe PDF Reader control

I'm trying to overlay a transparent image over the Adobe Reader Control. 我正在尝试将透明图像覆盖在Adobe Reader Control上。 So I can read the PDF while the image is overlapped. 所以我可以在图像重叠时阅读PDF。

Currently I have the reader control and an imagebox, I got an overlay button that when I click it is supposed to make the image transparent so I can read the text "through" it, well at least where it's transparent in the image. 目前我有阅读器控件和一个图像框,我有一个叠加按钮,当我点击它时应该使图像透明,所以我可以“通过”它阅读文本,至少它在图像中是透明的。

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }


    private void openToolStripMenuItem_Click(object sender, EventArgs e)
    {
        OpenFileDialog open = new OpenFileDialog();
        open.Title = "Open";
        open.Filter = "PDF|*.pdf";

        try
        {
            if (open.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                axAcroPDF1.LoadFile(open.FileName);
            }
        }
        catch (ArgumentException ex)
        {
            MessageBox.Show(ex.Message.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
    }

    private void exitToolStripMenuItem_Click(object sender, EventArgs e)
    {
        Application.Exit();
    }

    private void overlayToolStripMenuItem_Click(object sender, EventArgs e)
    {
        pictureBox1.BackColor = Color.Transparent;

        pictureBox1.Parent = axAcroPDF1;



    }
}

My designer so far: 我的设计师目前为止:

我的设计师到目前为止

I can see your issue here, You are trying to set the colour of the picture box object to Transparent, this will not affect the image in any way. 我可以在这里看到您的问题,您正在尝试将图片框对象的颜色设置为透明,这不会以任何方式影响图像。

Imagine you had no image loaded into your picture box, changing the back colour here will make a difference. 想象一下,你没有将图像加载到你的图片框中,改变背面颜色会产生影响。

To achieve your desired effect, you will need to photo edit your picture and make a version which has transparency (Lowering Alpha and saving as .PNG). 要获得所需的效果,您需要对照片进行照片编辑并制作具有透明度的版本(降低Alpha并保存为.PNG)。 Then once you click your button you need to swap the original image to the newly created transparent image. 然后,单击按钮后,需要将原始图像交换为新创建的透明图像。 You can use the line pictureBox1.Image = Image.FromFile("Path") in this case. 在这种情况下,您可以使用line pictureBox1.Image = Image.FromFile("Path")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM