Windows图形应用程序 [英] Windows Graphics Application
问题描述
我正在使用桌面图形应用程序。我在OnPaint方法中使用Graphics.DrawEllipse函数在屏幕上绘制一个实心圆。圆形大小为50,50即传递给DrawEllipse方法的矩形尺寸为50,50。但我的问题是,当我更改屏幕分辨率时,屏幕上绘制的圆形看起来宽度和高度不同。有些事情是错的,我不理解。任何人都知道如何处理不同的决议?
我也尝试过Screen.PrimaryScreen.Bounds来获得宽高比,但是对于所有分辨率仍然不能正常工作。
提前感谢您的时间。
我想(我没有测试过它)你可以:
- 使用 Graphics.SetPageUnit [ ^ ]方法指定
UnitInch
(或UnitMillimiter
)。
或
。
- 致电 Graphics.GetDpiX [ ^ ]和 Graphics.GetDpiY [ ^ ]并自己执行计算。
Hi,
I am working on a desktop Graphics Application. I am drawing a filled circle on the screen using Graphics.DrawEllipse function in OnPaint method. The circle size is 50, 50 ie Rectangle dimensions passed to DrawEllipse method is 50, 50. But my problem is that the Circle drawn on the screen does not looks of equal width and height when i change Screen resolution. Some thing is going wrong that i am not understanding. Any one have any idea how to handle different resolutions?
I have also tried the Screen.PrimaryScreen.Bounds to get the width to height ratio but that still not works fine for all resolutions.
Thanks in advance for your time.
I suppose (I've not tested it) you may either:
- Use Graphics.SetPageUnit[^] method specifying
UnitInch
(orUnitMillimiter
).
or
.
- Call Graphics.GetDpiX[^] and Graphics.GetDpiY[^] and perform yourself the computations.
这篇关于Windows图形应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!