在 Silverlight 中绘制一条线...画布宽度无效
我知道这一定很简单,但这让我发疯。我正在尝试制作一个非常简单的 Silverlight 应用程序。我希望它是全屏的,并且我想在画布上画一条线。
我的问题是画布的 .Width 和 .Height 似乎从来没有有效值。
该网站以 400x300 像素左右显示画布,当您单击它时,它会进入全屏模式。我想使用高度和宽度来查找屏幕的可用空间。我尝试添加事件(认为画布尚未准备好在全屏代码行之后立即使用),但 LayoutChanged 和 Resized 事件似乎没有产生任何结果。
我做错了什么?
I know this has to be simple, but it's driving me crazy. I'm trying to make a very simple Silverlight application. I want it to be full-screen, and I want to draw a line onto a Canvas.
My problem is that the .Width and .Height of the canvas never seem to have a valid value.
The website shows the canvas at 400x300 pixels or so, and when you click on it, it goes into Fullscreen mode. I want to use the Height and Width to find the usable space of the screen. I've tried adding events (thinking that the canvas wasn't yet ready to be used immediate after the full-screen line of code) but the LayoutChanged and Resized events don't seem to yield anything.
What am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试过使用。 ActualWidth 和 .实际高度。您还可以参考这篇文章< /a>
Have you tried using .ActualWidth and .ActualHeight. You could also reference this Article