爱问知识人 爱问教育 医院库

NET 怎样使界面自适应WINDOWS的不同系统和不同分辨率的屏幕?

首页

NET 怎样使界面自适应WINDOWS的不同系统和不同分辨率的屏幕?

VB.NET 怎样使界面自适应WINDOWS的不同系统和不同分辨率的屏幕? 

提交回答

全部答案

    2014-01-26 09:33:48
  •   #Region " Public Sub AutoCtlSize(ByVal inObj As Control)     '自动调整控件大小" 
        Public Sub AutoCtlSize(ByVal inObj As Control)     '自动调整控件大小 
            If inObj Is Nothing Then 
                Exit Sub 
            End If 
            '显示分辨率与窗体工作区的大小的关系:分辨率width*height--工作区(没有工具栏)width*(height-46) 
            '即分辨率为*600时,子窗体只能为*554 
            '上述情况还要windows状态栏自动隐藏,如果不隐藏,则height还要减少,结果为:*524 
            '检测桌面显示分辨率(Visual Basic)请参见 
            '此示例以像素为单位确定桌面的宽度和高度。
       Dim DeskTopSize As Size = System。Windows。Forms。SystemInformation。PrimaryMonitorSize Dim FontSize As Single FontSize = 9 * DeskTopSize。
      Height / 600 '控件本身**** '控件大小 inObj。Size = New Size(Int(inObj。Size。Width * DeskTopSize。Width / 800), Int(inObj。
      Size。Height * DeskTopSize。Height / 600)) '控件位置 inObj。Location = New Point(Int(inObj。Location。X * DeskTopSize。
      Width / 800), Int(inObj。Location。Y * DeskTopSize。Height / 600)) '如果控件为Form,则设置固定边框 'Dim mType As Type 'Dim mProperty As System。
      Reflection。PropertyInfo 'mType = inObj。GetType 'mProperty = mType。GetProperty("FormBorderStyle") 'If Not mProperty Is Nothing Then 'MessageBox。
      Show(mType。ToString) ' mProperty。SetValue(inObj, FormBorderStyle。FixedSingle, Nothing) 'End If '子控件===== Dim n As Integer For n = 0 To inObj。
      Controls。Count - 1 '只调整子控件的字体。(如果调整窗体的字体,再调用窗体的show方法时,会引发resize从而导致控件的大小和布局改变) inObj。Controls。
      Item(n)。Font = New Font(inObj。Controls。Item(n)。Font。FontFamily, FontSize) '递归调用(穷举所有子控件) AutoCtlSize(inObj。
      Controls。
      Item(n)) Next End Sub #End Region 我早年写的自动调整控件大小的程序,在要show form时,通过调用AutoCtlSize(form),可以起到调整form及form中控件大小、位置的作用,你可以参考下。

    吴***

    2014-01-26 09:33:48

  • 操作系统/系统故障 相关知识

  • 电脑网络技术
  • 电脑网络

相关推荐

正在加载...
最新问答 推荐信息 热门专题 热点推荐
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200

热点检索

  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
返回
顶部
帮助 意见
反馈

确定举报此问题

举报原因(必选):