回复 1楼leadcom的帖子
请修改合并菜单点击事件代码如下,需要设置 AlphaBlendCommand 类的 AlphaBlendCommand.SourcePoint 属性为 (0, 0) :
- private void combineImagesToolStripMenuItem_Click(object sender, EventArgs e)
- {
- RasterImage watermarkClone = watermarkImg;
- if (resizeCheckBox.Checked)
- {
- watermarkClone = watermarkImg.Clone();
- SizeCommand sizeCom = new SizeCommand();
- sizeCom.Flags = RasterSizeFlags.Bicubic;
- sizeCom.Width = (int)numericWidth.Value;
- sizeCom.Height = (int)numericHeight.Value;
- sizeCom.Run(watermarkClone);
- }
- RasterImage destImage = sourceImg.Clone();
- AlphaBlendCommand alphaBlend = new AlphaBlendCommand();
- alphaBlend.SourcePoint = LeadPoint.Create(0, 0);
- alphaBlend.DestinationRectangle = LeadRect.Create((int)numericX.Value, (int)numericY.Value, (int)numericWidth.Value, (int)numericHeight.Value);
- alphaBlend.SourceImage = watermarkClone;
- alphaBlend.Opacity = (int)(numericOpacity.Value);
- alphaBlend.Run(destImage);
- _viewer.Image = destImage;
- if (resizeCheckBox.Checked)
- watermarkClone.Dispose();
- }
复制代码 |