تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
عندي مشكلة بمقاسات الشاشات ماهو الحل المناسب
#6
PHP كود :
Public Class Form1

    Private Sub Form1_Load
(ByVal sender As System.ObjectByVal e As System.EventArgsHandles MyBase.Load

        
'FormScaleMinimize()
        FormScaleMaximize()

    End Sub

#Region "Form scale"
    Private Sub FormScaleMinimize()
        Me.AutoScaleMode = AutoScaleMode.Font
        For i = Me.Font.Size To 4 Step -1
            Me.Font = New Font(Me.Font.FontFamily, i, Me.Font.Style)
            If Me.Width < Screen.PrimaryScreen.WorkingArea.Width And Me.Height < Screen.PrimaryScreen.WorkingArea.Height Then
                Exit For
            End If
        Next
        Array.ForEach(GetAllControls(Me).ToArray, Sub(ctrl As Control) ctrl.Font = Me.Font)
        If Me.Right > Screen.PrimaryScreen.WorkingArea.Width Or Me.Bottom > Screen.PrimaryScreen.WorkingArea.Height Then
            Me.Location = New Point(0, 0)
        End If
    End Sub
    Private Sub FormScaleMaximize()
        Me.AutoScaleMode = AutoScaleMode.Font
        For i = 4 To 100
            Me.Font = New Font(Me.Font.FontFamily, i, Me.Font.Style)
            If Me.Width > Screen.PrimaryScreen.WorkingArea.Width Or Me.Height > Screen.PrimaryScreen.WorkingArea.Height Then
                Me.Font = New Font(Me.Font.FontFamily, i - 1, Me.Font.Style)
                Exit For
            End If
        Next
        Array.ForEach(GetAllControls(Me).ToArray, Sub(ctrl As Control) ctrl.Font = Me.Font)
        If Me.Right > Screen.PrimaryScreen.WorkingArea.Width Or Me.Bottom > Screen.PrimaryScreen.WorkingArea.Height Then
            Me.Location = New Point(0, 0)
        End If
    End Sub
    Private Function GetAllControls(ByVal control As Control) As IEnumerable(Of Control)
        Dim controls = control.Controls.Cast(Of Control)()
        Return controls.SelectMany(Function(ctrl) GetAllControls(ctrl)).Concat(controls)
    End Function
#End Region



End Class 
الرد }}}
تم الشكر بواسطة:


الردود في هذا الموضوع
RE: عندي مشكلة بمقاسات الشاشات ماهو الحل المناسب - بواسطة sami2015 - 03-01-16, 09:49 PM


التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم