تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
مشكلة اختلاف شكل عرض المشروع من جهاز الي جهاز اخر
#1
السلام عليكم ورحمة الله وبركاته الاخوة الاحباب

عملت هذا المشروع المرفق ولكن تظهر معي مشكلتبن

1- حينما يفتح البرنامج علي الجهاز الذي صممت عليه البنامج يكون تمام العرض

وحينما اعمل maximize   للشاشه تتلخبط الحكاية ويكون العرض غير مناسب تماما

2- حينما افتح البرنامج  علي جهاز اخر اجد شكل العرض مختلف تماما

المطلوب ان يكون شكل العرض متناسق في اي وضع وعلي اي جهاز

المشروع عبارة عن خمسة Picture box

اتنين picture box  علي الجانب الايمن  و  اثنين picture box  علي الجاني الايسر

وواحدة picture box  في المنتصف وتحتها  عدد من ال Textboxes

ملاحظه : بالنسبة للصور التي علي الجاني الايمن والجانب الايسر عرفت اتعامل معها

ووضعت Panel لكل واحدة منهما ولكن المشكلة مع التي بالمنتصف

برجاء فحص المرفقات التي وضعتها كصورة لان حجم المشروع كبير جدا

واسف للاطالة

مع جزيل الشكر


الملفات المرفقة صورة/صور
   
الرد }}}
تم الشكر بواسطة: ابو انس
#2
(02-06-17, 03:15 AM)khaled12345 كتب : Smile Smile Smile Smile

تفظل اخي اتمنى يكون مناسب


الملفات المرفقة
.rar   ResizeControls.rar (الحجم : 370.32 ك ب / التحميلات : 428)
الرد }}}
تم الشكر بواسطة: Rabeea Qbaha , mohammed moh , asemshahen5 , asemshahen5 , ابو انس
#3
(02-06-17, 03:48 AM)anes كتب :
(02-06-17, 03:15 AM)khaled12345 كتب : Smile Smile Smile Smile

تفظل اخي اتمنى يكون مناسب

مشكور اخي الحبيب

بس علشان الامر يكون مفهوم عندي

هل هو class   يجن ان اضيفة للمشروع دون عمل اعي شيء في الادوات او الفورم

مع الشكر لحضرتك
الرد }}}
تم الشكر بواسطة: asemshahen5 , asemshahen5 , ابو انس
#4
(02-06-17, 04:03 AM)khaled12345 كتب :
(02-06-17, 03:48 AM)anes كتب :
(02-06-17, 03:15 AM)khaled12345 كتب : Smile Smile Smile Smile

تفظل اخي اتمنى يكون مناسب

مشكور اخي الحبيب

بس علشان الامر يكون مفهوم عندي

هل هو class   يجن ان اضيفة للمشروع دون عمل اعي شيء في الادوات او الفورم

مع الشكر لحضرتك
نعم اخي اظف للمشروع كلاس وسميه مثلا كما بالمشروع ResizeControls
 وهذا هو الكود الخاص بالكلاص
كود :
Public Class ResizeControls

   Dim RatioTable As New Hashtable

   Private WindowHeight As Single
   Private WindowWidth As Single
   Private HeightRatio As Single
   Private WidthRatio As Single

   Private _Container As New Control

   Private Shared m_FormWidth As Long                          'Original form width.
   Private Shared m_FormHeight As Long

   Public Property Container() As Control
       Get
           Return _Container
       End Get
       Set(ByVal Ctrl As Control)
           _Container = Ctrl
           FullRatioTable()
       End Set

   End Property

   Private Structure SizeRatio
       Dim TopRatio As Single
       Dim LeftRatio As Single
       Dim HeightRatio As Single
       Dim WidthRatio As Single
   End Structure

   Private Sub FullRatioTable()
       WindowHeight = _Container.Height
       WindowWidth = _Container.Width
       RatioTable = New Hashtable
       AddChildrenToTable(_Container)

   End Sub

   Private Sub AddChildrenToTable(ByRef ChildContainer As Control)
       Dim R As New SizeRatio

       For Each C As Control In ChildContainer.Controls
           With C
               R.TopRatio = CSng(.Top / WindowHeight)
               R.LeftRatio = CSng(.Left / WindowWidth)
               R.HeightRatio = CSng(.Height / WindowHeight)
               R.WidthRatio = CSng(.Width / WindowWidth)
               RatioTable(.Name) = R
               If .HasChildren Then
                   AddChildrenToTable(C)
               End If
           End With
       Next

   End Sub

   Public Sub ResizeControls()


       HeightRatio = CSng(_Container.Height / WindowHeight)
       WidthRatio = CSng(_Container.Width / WindowWidth)

       WindowHeight = _Container.Height
       WindowWidth = _Container.Width

       ResizeChildren(_Container)



   End Sub

   Private Sub ResizeChildren(ByRef ChildContainer As Control)

       Dim R As New SizeRatio
       For Each C As Control In ChildContainer.Controls
           With C
               R = CType(RatioTable(.Name), SizeRatio)
               .Top = CInt(WindowHeight * R.TopRatio)
               .Left = CInt(WindowWidth * R.LeftRatio)
               .Height = CInt(WindowHeight * R.HeightRatio)
               .Width = CInt(WindowWidth * R.WidthRatio)

               If .HasChildren Then
                   ResizeChildren(C)

               End If

           End With


           Select Case True
               Case TypeOf C Is ListBox
                   Dim L As New ListBox
                   L = CType(C, ListBox)
                   L.IntegralHeight = False
           End Select

           ResizeControlFont(C, WidthRatio, HeightRatio)

       Next





   End Sub

   Public Shared Sub SubResize(ByVal F As Form, ByVal percentW As Single, ByVal percentH As Single)

       Dim FormHeight As Long
       Dim FormWidth As Long
       Dim HeightChange As Single, WidthChange As Single


       FormHeight = Int((Screen.PrimaryScreen.WorkingArea.Height) * (percentH / 100))
       FormWidth = Int((Screen.PrimaryScreen.WorkingArea.Width) * (percentW / 100))

       With F
           .Height = FormHeight
           .Width = FormWidth

           HeightChange = .ClientSize.Height / m_FormHeight
           WidthChange = .ClientSize.Width / m_FormWidth


       End With


   End Sub



   Private Sub ResizeControlFont(ByRef Ctrl As Control, ByVal RatioW As Single, ByVal RatioH As Single)

       Dim FSize As Single = Ctrl.Font.Size
       Dim FStyle As FontStyle = Ctrl.Font.Style
       Dim FNome As String = Ctrl.Font.Name
       Dim NewSize As Single = FSize

       NewSize = CSng(FSize * Math.Sqrt(RatioW * RatioH))
       Dim NFont As New Font(FNome, CSng(NewSize), FStyle)
       Ctrl.Font = NFont

   End Sub

End Class

وفي الفورم اضف التالي

في الحدث Form1_Load
كود :
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       ResizeControls.SubResize(Me, 50, 70)
       Me.StartPosition = FormStartPosition.CenterScreen
       Me.CenterToScreen()
       Me.WindowState = FormWindowState.Normal
   End Sub

وفي الحدث Form1_HandleCreated
اضف
كود :
 R.Container = Me


وفي الحدث Form1_Resize
كود :
  Me.StartPosition = FormStartPosition.CenterScreen

       R.ResizeControls()


كدا برنامجك انشاء الله تمام اخي
Big Grin Big Grin Big Grin Big Grin
الرد }}}
#5
(02-06-17, 04:51 AM)anes كتب :
(02-06-17, 04:03 AM)khaled12345 كتب :
(02-06-17, 03:48 AM)anes كتب :
(02-06-17, 03:15 AM)khaled12345 كتب : Smile Smile Smile Smile

تفظل اخي اتمنى يكون مناسب

مشكور اخي الحبيب

بس علشان الامر يكون مفهوم عندي

هل هو class   يجن ان اضيفة للمشروع دون عمل اعي شيء في الادوات او الفورم

مع الشكر لحضرتك
نعم اخي اظف للمشروع كلاس وسميه مثلا كما بالمشروع ResizeControls
 وهذا هو الكود الخاص بالكلاص
كود :
Public Class ResizeControls

   Dim RatioTable As New Hashtable

   Private WindowHeight As Single
   Private WindowWidth As Single
   Private HeightRatio As Single
   Private WidthRatio As Single

   Private _Container As New Control

   Private Shared m_FormWidth As Long                          'Original form width.
   Private Shared m_FormHeight As Long

   Public Property Container() As Control
       Get
           Return _Container
       End Get
       Set(ByVal Ctrl As Control)
           _Container = Ctrl
           FullRatioTable()
       End Set

   End Property

   Private Structure SizeRatio
       Dim TopRatio As Single
       Dim LeftRatio As Single
       Dim HeightRatio As Single
       Dim WidthRatio As Single
   End Structure

   Private Sub FullRatioTable()
       WindowHeight = _Container.Height
       WindowWidth = _Container.Width
       RatioTable = New Hashtable
       AddChildrenToTable(_Container)

   End Sub

   Private Sub AddChildrenToTable(ByRef ChildContainer As Control)
       Dim R As New SizeRatio

       For Each C As Control In ChildContainer.Controls
           With C
               R.TopRatio = CSng(.Top / WindowHeight)
               R.LeftRatio = CSng(.Left / WindowWidth)
               R.HeightRatio = CSng(.Height / WindowHeight)
               R.WidthRatio = CSng(.Width / WindowWidth)
               RatioTable(.Name) = R
               If .HasChildren Then
                   AddChildrenToTable(C)
               End If
           End With
       Next

   End Sub

   Public Sub ResizeControls()


       HeightRatio = CSng(_Container.Height / WindowHeight)
       WidthRatio = CSng(_Container.Width / WindowWidth)

       WindowHeight = _Container.Height
       WindowWidth = _Container.Width

       ResizeChildren(_Container)



   End Sub

   Private Sub ResizeChildren(ByRef ChildContainer As Control)

       Dim R As New SizeRatio
       For Each C As Control In ChildContainer.Controls
           With C
               R = CType(RatioTable(.Name), SizeRatio)
               .Top = CInt(WindowHeight * R.TopRatio)
               .Left = CInt(WindowWidth * R.LeftRatio)
               .Height = CInt(WindowHeight * R.HeightRatio)
               .Width = CInt(WindowWidth * R.WidthRatio)

               If .HasChildren Then
                   ResizeChildren(C)

               End If

           End With


           Select Case True
               Case TypeOf C Is ListBox
                   Dim L As New ListBox
                   L = CType(C, ListBox)
                   L.IntegralHeight = False
           End Select

           ResizeControlFont(C, WidthRatio, HeightRatio)

       Next





   End Sub

   Public Shared Sub SubResize(ByVal F As Form, ByVal percentW As Single, ByVal percentH As Single)

       Dim FormHeight As Long
       Dim FormWidth As Long
       Dim HeightChange As Single, WidthChange As Single


       FormHeight = Int((Screen.PrimaryScreen.WorkingArea.Height) * (percentH / 100))
       FormWidth = Int((Screen.PrimaryScreen.WorkingArea.Width) * (percentW / 100))

       With F
           .Height = FormHeight
           .Width = FormWidth

           HeightChange = .ClientSize.Height / m_FormHeight
           WidthChange = .ClientSize.Width / m_FormWidth


       End With


   End Sub



   Private Sub ResizeControlFont(ByRef Ctrl As Control, ByVal RatioW As Single, ByVal RatioH As Single)

       Dim FSize As Single = Ctrl.Font.Size
       Dim FStyle As FontStyle = Ctrl.Font.Style
       Dim FNome As String = Ctrl.Font.Name
       Dim NewSize As Single = FSize

       NewSize = CSng(FSize * Math.Sqrt(RatioW * RatioH))
       Dim NFont As New Font(FNome, CSng(NewSize), FStyle)
       Ctrl.Font = NFont

   End Sub

End Class

وفي الفورم اضف التالي

في الحدث Form1_Load
كود :
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       ResizeControls.SubResize(Me, 50, 70)
       Me.StartPosition = FormStartPosition.CenterScreen
       Me.CenterToScreen()
       Me.WindowState = FormWindowState.Normal
   End Sub

وفي الحدث Form1_HandleCreated
اضف
كود :
 R.Container = Me


وفي الحدث Form1_Resize
كود :
  Me.StartPosition = FormStartPosition.CenterScreen

       R.ResizeControls()


كدا برنامجك انشاء الله تمام اخي
Big Grin Big Grin Big Grin Big Grin



مشكووووور اخي الحبيب

كدا تمام

وربنا يجزاك كل الخير يارب


Smile Smile Smile Smile
الرد }}}
تم الشكر بواسطة: anes , anes , ابو انس , ابراهيم ايبو
#6
(02-06-17, 05:00 AM)khaled12345 كتب :
(02-06-17, 04:51 AM)anes كتب :
(02-06-17, 04:03 AM)khaled12345 كتب :
(02-06-17, 03:48 AM)anes كتب :
(02-06-17, 03:15 AM)khaled12345 كتب : Smile Smile Smile Smile

تفظل اخي اتمنى يكون مناسب

مشكور اخي الحبيب

بس علشان الامر يكون مفهوم عندي

هل هو class   يجن ان اضيفة للمشروع دون عمل اعي شيء في الادوات او الفورم

مع الشكر لحضرتك
نعم اخي اظف للمشروع كلاس وسميه مثلا كما بالمشروع ResizeControls
 وهذا هو الكود الخاص بالكلاص
كود :
Public Class ResizeControls

   Dim RatioTable As New Hashtable

   Private WindowHeight As Single
   Private WindowWidth As Single
   Private HeightRatio As Single
   Private WidthRatio As Single

   Private _Container As New Control

   Private Shared m_FormWidth As Long                          'Original form width.
   Private Shared m_FormHeight As Long

   Public Property Container() As Control
       Get
           Return _Container
       End Get
       Set(ByVal Ctrl As Control)
           _Container = Ctrl
           FullRatioTable()
       End Set

   End Property

   Private Structure SizeRatio
       Dim TopRatio As Single
       Dim LeftRatio As Single
       Dim HeightRatio As Single
       Dim WidthRatio As Single
   End Structure

   Private Sub FullRatioTable()
       WindowHeight = _Container.Height
       WindowWidth = _Container.Width
       RatioTable = New Hashtable
       AddChildrenToTable(_Container)

   End Sub

   Private Sub AddChildrenToTable(ByRef ChildContainer As Control)
       Dim R As New SizeRatio

       For Each C As Control In ChildContainer.Controls
           With C
               R.TopRatio = CSng(.Top / WindowHeight)
               R.LeftRatio = CSng(.Left / WindowWidth)
               R.HeightRatio = CSng(.Height / WindowHeight)
               R.WidthRatio = CSng(.Width / WindowWidth)
               RatioTable(.Name) = R
               If .HasChildren Then
                   AddChildrenToTable(C)
               End If
           End With
       Next

   End Sub

   Public Sub ResizeControls()


       HeightRatio = CSng(_Container.Height / WindowHeight)
       WidthRatio = CSng(_Container.Width / WindowWidth)

       WindowHeight = _Container.Height
       WindowWidth = _Container.Width

       ResizeChildren(_Container)



   End Sub

   Private Sub ResizeChildren(ByRef ChildContainer As Control)

       Dim R As New SizeRatio
       For Each C As Control In ChildContainer.Controls
           With C
               R = CType(RatioTable(.Name), SizeRatio)
               .Top = CInt(WindowHeight * R.TopRatio)
               .Left = CInt(WindowWidth * R.LeftRatio)
               .Height = CInt(WindowHeight * R.HeightRatio)
               .Width = CInt(WindowWidth * R.WidthRatio)

               If .HasChildren Then
                   ResizeChildren(C)

               End If

           End With


           Select Case True
               Case TypeOf C Is ListBox
                   Dim L As New ListBox
                   L = CType(C, ListBox)
                   L.IntegralHeight = False
           End Select

           ResizeControlFont(C, WidthRatio, HeightRatio)

       Next





   End Sub

   Public Shared Sub SubResize(ByVal F As Form, ByVal percentW As Single, ByVal percentH As Single)

       Dim FormHeight As Long
       Dim FormWidth As Long
       Dim HeightChange As Single, WidthChange As Single


       FormHeight = Int((Screen.PrimaryScreen.WorkingArea.Height) * (percentH / 100))
       FormWidth = Int((Screen.PrimaryScreen.WorkingArea.Width) * (percentW / 100))

       With F
           .Height = FormHeight
           .Width = FormWidth

           HeightChange = .ClientSize.Height / m_FormHeight
           WidthChange = .ClientSize.Width / m_FormWidth


       End With


   End Sub



   Private Sub ResizeControlFont(ByRef Ctrl As Control, ByVal RatioW As Single, ByVal RatioH As Single)

       Dim FSize As Single = Ctrl.Font.Size
       Dim FStyle As FontStyle = Ctrl.Font.Style
       Dim FNome As String = Ctrl.Font.Name
       Dim NewSize As Single = FSize

       NewSize = CSng(FSize * Math.Sqrt(RatioW * RatioH))
       Dim NFont As New Font(FNome, CSng(NewSize), FStyle)
       Ctrl.Font = NFont

   End Sub

End Class

وفي الفورم اضف التالي

في الحدث Form1_Load
كود :
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       ResizeControls.SubResize(Me, 50, 70)
       Me.StartPosition = FormStartPosition.CenterScreen
       Me.CenterToScreen()
       Me.WindowState = FormWindowState.Normal
   End Sub

وفي الحدث Form1_HandleCreated
اضف
كود :
 R.Container = Me


وفي الحدث Form1_Resize
كود :
  Me.StartPosition = FormStartPosition.CenterScreen

       R.ResizeControls()


كدا برنامجك انشاء الله تمام اخي
Big Grin Big Grin Big Grin Big Grin



مشكووووور اخي الحبيب

كدا تمام

وربنا يجزاك كل الخير يارب


Smile Smile Smile Smile



==========================================================================

السلام عليكم اخي الحبيب

هل يجوز اجراء نفس الخطوات مع فيجوال بيسك 2010

ام هذا الكلاس خاص فقط بالفيجوال بيسك 2017

لاني حاولت مع الفيجوال بيسك 2010 للاسف ما مشي الحال

فبرجاء النصيحة

مع الشكر الجزيل
الرد }}}
تم الشكر بواسطة: asemshahen5 , asemshahen5 , ابو انس , ابو انس
#7
[quote pid='100436' dateline='1496442541']

السلام عليكم اخي الحبيب

هل يجوز اجراء نفس الخطوات مع فيجوال بيسك 2010

ام هذا الكلاس خاص فقط بالفيجوال بيسك 2017

لاني حاولت مع الفيجوال بيسك 2010 للاسف ما مشي الحال

فبرجاء النصيحة

مع الشكر الجزيل
[/quote]

تفظل اخي هذا معمول بالفيجول 10 Smile


الملفات المرفقة
.rar   ResizeControls.rar (الحجم : 369.02 ك ب / التحميلات : 623)
الرد }}}
تم الشكر بواسطة: Rabeea Qbaha , Rabeea Qbaha , asemshahen5 , abomo3ath , abomo3ath , ابو انس
#8
(03-06-17, 06:24 PM)anes كتب : [quote pid='100436' dateline='1496442541']

السلام عليكم اخي الحبيب

هل يجوز اجراء نفس الخطوات مع فيجوال بيسك 2010

ام هذا الكلاس خاص فقط بالفيجوال بيسك 2017

لاني حاولت مع الفيجوال بيسك 2010 للاسف ما مشي الحال

فبرجاء النصيحة

مع الشكر الجزيل

تفظل اخي هذا معمول بالفيجول 10 Smile
[/quote]

اخي الحبيب المرفق  ايضا  2017
 
هي هي اللي فاتت

Smile Smile Smile Smile Smile
الرد }}}
تم الشكر بواسطة: asemshahen5 , ابو انس
#9
(03-06-17, 07:36 PM)khaled12345 كتب :
(03-06-17, 06:24 PM)anes كتب : [quote pid='100436' dateline='1496442541']

السلام عليكم اخي الحبيب

هل يجوز اجراء نفس الخطوات مع فيجوال بيسك 2010

ام هذا الكلاس خاص فقط بالفيجوال بيسك 2017

لاني حاولت مع الفيجوال بيسك 2010 للاسف ما مشي الحال

فبرجاء النصيحة

مع الشكر الجزيل

تفظل اخي هذا معمول بالفيجول 10 Smile

اخي الحبيب المرفق  ايضا  2017
 
هي هي اللي فاتت

Smile Smile Smile Smile Smile
[/quote]

اخي الكريم
اولا لا يوجد مشكل لو شغلنا الكود على اي نسخة
ثانيا المشروع الذي ارسلته لك معمول بالنسخة 10 عندما كنت مثبتها على الجهاز
ثالثا اظن الخطء من عندك ليس في المثال
ارجو ان تتقبل انتقادي وشكرا
الرد }}}
تم الشكر بواسطة:
#10
(03-06-17, 08:43 PM)anes كتب :
(03-06-17, 07:36 PM)khaled12345 كتب :
(03-06-17, 06:24 PM)anes كتب : [quote pid='100436' dateline='1496442541']

السلام عليكم اخي الحبيب

هل يجوز اجراء نفس الخطوات مع فيجوال بيسك 2010

ام هذا الكلاس خاص فقط بالفيجوال بيسك 2017

لاني حاولت مع الفيجوال بيسك 2010 للاسف ما مشي الحال

فبرجاء النصيحة

مع الشكر الجزيل

تفظل اخي هذا معمول بالفيجول 10 Smile

اخي الحبيب المرفق  ايضا  2017
 
هي هي اللي فاتت

Smile Smile Smile Smile Smile

اخي الكريم
اولا لا يوجد مشكل لو شغلنا الكود على اي نسخة
ثانيا المشروع الذي ارسلته لك معمول بالنسخة 10 عندما كنت مثبتها على الجهاز
ثالثا اظن الخطء من عندك ليس في المثال
ارجو ان تتقبل انتقادي وشكرا
[/quote]



اولا تقبلت انتقادك وشكرك Smile Smile Smile Smile Smile

ثانيا مشي الحال الحمد لله

مع الشكر الجزيل لحضرتك
الرد }}}
تم الشكر بواسطة: anes , anes , asemshahen5 , muaamar



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


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