我正在尝试遵循这篇文章,它很容易实现text over image
,现在我的问题是在上面提到的文章中,图像水印被放置在距离左边 10 个像素的位置,所以我如何将图像放置在右上角,中上,左中,中心,右中,与底部相似。
这是它被放置在右上角的方式:
int xPosOfWm = ((phWidth - wmWidth)-10);
int yPosOfWm = 10;
grWatermark.DrawImage(
imgWatermark,
new Rectangle(
xPosOfWm, yPosOfWm,
wmWidth, wmHeight
),
0, 0,
wmWidth, wmHeight,
GraphicsUnit.Pixel,
imageAttributes
);