I ve designed a project containing of some forms. The problem is that it doesn t display correctly on wide monitors. I ve searched for it and found out that it works correctly for dpi= 96. I wanna change dpi via registry in vb.net (not manually) Here is the code I use:
Dim dpi As Graphics = Me.CreateGraphics
If (dpi.DpiX <> 96 And dpi.DpiY <> 96) Then
Dim DPISetting As RegistryKey = My.Computer.Registry.CurrentUser.OpenSubKey("HKEY_CURRENT_USERControl PanelDesktopWindowsMetrics", True)
DPISetting.SetValue("AppliedDPI", 96) **
End If
但我在 ** 的线条上得到了一个“ 取消重复” 例外。 对象引用没有设定一个对象的例子。 我花了很长时间才真正研究它,但找不到问题所在。 如果您有任何建议或解决办法, 我非常感激 。