开发者

Maintain the Relative Control's Position in WPF

开发者 https://www.devze.com 2023-01-27 00:10 出处:网络
I have a Canvas in which I have some UserControls. You can imagine it as a Map with city points. Say, the canvas size is 100x100.

I have a Canvas in which I have some UserControls.

You can imagine it as a Map with city points.

Say, the canvas size is 100x100. Say I have only two UserControls A (10, 20)开发者_如何学Python and B (50, 50).

Now, user resizes the canvas to 1000x1000.

Is there a way to keep the UserControls at the same scale: A(100, 200) and B(500, 500) WITHOUT cycle all the controls and updating its individual positions to the manually calculated new ones.


You might want to take a look at my answer to this post. If you have lat/longs for your cities it's ideal. If not, it sounds like you'd be best writing your own panel that uses relative coordinates rather than absolute.

0

精彩评论

暂无评论...
验证码 换一张
取 消