ورود

View Full Version : سوال: تغيير رنگ زمينه فرم پدر



مهدی فرزاد
دوشنبه 17 تیر 1387, 11:30 صبح
باسلام

هنگامي كه فرم پدر فرزندي درست ميكنيم ، چطوري ميشه رنگ زمينه فرم پدر را عوض كرد؟
با تشكر

mostafaaa
سه شنبه 18 تیر 1387, 11:21 صبح
میتونی از این کد در رویداد Load فرمت استفاده کنی.

Dim ctl As Control
Dim ctlMDI As MdiClient
ctlMDI = CType(ctl, MdiClient)
For Each ctl In Me.Controls
Try
ctlMDI = CType(ctl, MdiClient)
ctlMDI.BackColor = Color.LightBlue
Catch exc As InvalidCastException
End Try
Next

مهدی فرزاد
سه شنبه 18 تیر 1387, 13:19 عصر
متشكرم مشكلم حل شد :تشویق:

Dariuosh
چهارشنبه 19 تیر 1387, 14:55 عصر
البته تو فرم لود با يه وقفه عوض ميشه فک کنم اگه تو رويداد New بزاري بهتره


PublicSubNew()
' This call is required by the Windows Form Designer.
InitializeComponent()
Me.Controls(Me.Controls.Count - 1).BackColor = System.Drawing.SystemColors.Control
' Add any initialization after the InitializeComponent() call.
EndSub


يا


PublicSubNew()
' This call is required by the Windows Form Designer.
InitializeComponent()
ForEach ctl As Control InMe.Controls
IfTypeOf (ctl) Is MdiClient Then ctl.BackColor = System.Drawing.SystemColors.Control
Next
' Add any initialization after the InitializeComponent() call.
EndSub