10-11-15, 07:23 PM
اهلين حابة اشوف لي حل لمشكلة ال .net لما اشتغل جهاز معين وانقل البروجكت او المشروع لجهاز اخر ينخرب عندي الديزاين في حل مناسب للمشكلة هاذي لو سمحتو تقدر تفيدوني ؟؟ ومشكورين
(10-11-15, 07:54 PM)Mr. DotNet كتب : [ -> ]اذا كانت المشكلة تكن في حجم الشاشة فقومي بتثبيت حجم العرض و الارتفاع للبرنامج .. عن طريق الخواص MaximumSize و MinimumSize
إقتباس :الحل في الخاصية Anchorيا ريت حد يفيدنا عن خاصية Anchor لأنها أصلا مش موجودة ضمن خصائص الفورم فى الدوت نت !!!!!!!!!
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 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