簡體   English   中英

如何獲取圖片框的基礎圖像的坐標

[英]how to get the co-ordinates of an underlying image of a picture box

我有一個帶有與之相關的圖片的圖片框。

PictureBox的大小模式已設置為CenterImage

我的問題是如何獲得底層圖像的圖像坐標。

問候

我認為您最好的選擇是使用以下公式自己計算:

int xOffset = (pictureBox1.Width / 2) - (pictureBox1.Image.Width / 2);
int yOffset = (pictureBox1.Height / 2) - (pictureBox1.Image.Height / 2);

xOffset和yOffset應該等於圖片框左上角圖像的(x,y)。 請記住,上面的公式使用整數數學,它可能會截斷值。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM