program.vb

来自「Microsoft Mobile Development Handbook的代码」· VB 代码 · 共 56 行

VB
56
字号
Imports Microsoft.VisualBasic
Imports System
Imports System.Windows.Forms

Namespace CodeForChapter2
  Friend Class Program
	''' <summary>
	''' The main entry point for the application.
	''' </summary>
	Private Sub New()
	End Sub
	<MTAThread> _
	Shared Sub Main()
	  'Application.Run(new frmDocListSoftKeys());
	  'Application.Run(new frmMenuPlusToolbar());
	  'Application.Run(new frmSquare());
	  'Application.Run(new frmBaseWithSIP());
	  'Application.Run(new frmBrokenChild());
	  'Application.Run(new frmMain());
	  Application.Run(New frmDockAnchor())
	End Sub

	Friend Shared ScaleFactor As Single = 1
  End Class

#Region "Scaling"
  'Friend Class Program
  '  ''' <summary>
  '  ''' The main entry point for the application.
  '  ''' </summary>
  '  Private Sub New()
  '  End Sub
  '  <MTAThread()> _
  '  Shared Sub Main()
  '    Dim f As New frmScaling()

  '    Const designResolution As Single = 96.0 'typical
  '    System.Drawing.Graphics(g = f.CreateGraphics())
  '    Dim runningResolution As Single = g.DpiX 'g.DpiY will return the same value
  '    ScaleFactor = runningResolution / designResolution
  '    g.Dispose()

  '    Application.Run(f)
  '  End Sub

  '  '  // multiply all custom drawing with Program.ScaleFactor
  '  '  // most of the time this will have one of 3 values
  '  '  // 1   , when we designed for exactly what we run on
  '  '  // 2   , when we designed for 96 dpi but we are running on 192
  '  '  // 1.365, when we designed for 96 dpi but we are running on 131 (qvga smartphone)
  '  Friend Shared ScaleFactor As Single
  'End Class
#End Region
End Namespace

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?