Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Zoury
Salut Stéphane ! :O)
Voici un exemple : '*** Option Explicit On
Imports System.ComponentModel
Public Class Form1 Inherits System.Windows.Forms.Form
#Region " Code généré par le Concepteur Windows Form "
Public Sub New() MyBase.New()
'Cet appel est requis par le Concepteur Windows Form. InitializeComponent()
If (IsMdiContainer) Then BackColor = SystemColors.AppWorkspace Else BackColor = SystemColors.Control End If
End Sub
'La méthode substituée Dispose du formulaire pour nettoyer la liste des composants. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub
'Requis par le Concepteur Windows Form Private components As System.ComponentModel.IContainer
'REMARQUE : la procédure suivante est requise par le Concepteur Windows Form 'Elle peut être modifiée en utilisant le Concepteur Windows Form. 'Ne la modifiez pas en utilisant l'éditeur de code. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() ' 'Form1 ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(568, 366) Me.DockPadding.All = 50 Me.IsMdiContainer = True Me.KeyPreview = True Me.Name = "Form1" Me.Text = "Form1"
DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)> _ Public Overrides Property BackColor() As Color Get Return MyBase.BackColor End Get Set(ByVal Value As Color) MyBase.BackColor = Value If (Me.Controls.Count) Then PaintMDIClientBackColor() End If End Set End Property
Protected Sub PaintMDIClientBackColor() Dim ctl As Control For Each ctl In Me.Controls If (ctl.GetType() Is GetType(MdiClient)) Then DirectCast(ctl, MdiClient).BackColor = BackColor End If Next End Sub
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs) e.Graphics.FillRectangle(New SolidBrush(BackColor), e.ClipRectangle) End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load PaintMDIClientBackColor() End Sub
Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress ' on test la propriété Me.BackColor = Color.Firebrick End Sub
End Class '***
-- Cordialement Yanick MVP pour Visual Basic "Stéphane" a écrit dans le message de news:
Bonjour,
J'ai trouvé un article de Microsoft qui démontre comment changer la
Cette façon de faire ne convient pas si l'on utilise une valeur de "DockPadding"...
La couleur de l'espace client est changé mais pas celle du padding....
Quelqu'un peut m'aider à changer la couleur du "DockPadding" .....
Merci !
Stéphane
Salut Stéphane ! :O)
Voici un exemple :
'***
Option Explicit On
Imports System.ComponentModel
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Code généré par le Concepteur Windows Form "
Public Sub New()
MyBase.New()
'Cet appel est requis par le Concepteur Windows Form.
InitializeComponent()
If (IsMdiContainer) Then
BackColor = SystemColors.AppWorkspace
Else
BackColor = SystemColors.Control
End If
End Sub
'La méthode substituée Dispose du formulaire pour nettoyer la liste des
composants.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Requis par le Concepteur Windows Form
Private components As System.ComponentModel.IContainer
'REMARQUE : la procédure suivante est requise par le Concepteur Windows
Form
'Elle peut être modifiée en utilisant le Concepteur Windows Form.
'Ne la modifiez pas en utilisant l'éditeur de code.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(568, 366)
Me.DockPadding.All = 50
Me.IsMdiContainer = True
Me.KeyPreview = True
Me.Name = "Form1"
Me.Text = "Form1"
DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)> _
Public Overrides Property BackColor() As Color
Get
Return MyBase.BackColor
End Get
Set(ByVal Value As Color)
MyBase.BackColor = Value
If (Me.Controls.Count) Then
PaintMDIClientBackColor()
End If
End Set
End Property
Protected Sub PaintMDIClientBackColor()
Dim ctl As Control
For Each ctl In Me.Controls
If (ctl.GetType() Is GetType(MdiClient)) Then
DirectCast(ctl, MdiClient).BackColor = BackColor
End If
Next
End Sub
Protected Overrides Sub OnPaint(ByVal e As
System.Windows.Forms.PaintEventArgs)
e.Graphics.FillRectangle(New SolidBrush(BackColor), e.ClipRectangle)
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
PaintMDIClientBackColor()
End Sub
Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
' on test la propriété
Me.BackColor = Color.Firebrick
End Sub
End Class
'***
--
Cordialement
Yanick
MVP pour Visual Basic
"Stéphane" <Stphane@discussions.microsoft.com> a écrit dans le message de
news:468D8E54-E9E6-4C4B-90D4-C87E1F940694@microsoft.com...
Bonjour,
J'ai trouvé un article de Microsoft qui démontre comment changer la
Public Class Form1 Inherits System.Windows.Forms.Form
#Region " Code généré par le Concepteur Windows Form "
Public Sub New() MyBase.New()
'Cet appel est requis par le Concepteur Windows Form. InitializeComponent()
If (IsMdiContainer) Then BackColor = SystemColors.AppWorkspace Else BackColor = SystemColors.Control End If
End Sub
'La méthode substituée Dispose du formulaire pour nettoyer la liste des composants. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub
'Requis par le Concepteur Windows Form Private components As System.ComponentModel.IContainer
'REMARQUE : la procédure suivante est requise par le Concepteur Windows Form 'Elle peut être modifiée en utilisant le Concepteur Windows Form. 'Ne la modifiez pas en utilisant l'éditeur de code. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() ' 'Form1 ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(568, 366) Me.DockPadding.All = 50 Me.IsMdiContainer = True Me.KeyPreview = True Me.Name = "Form1" Me.Text = "Form1"
DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)> _ Public Overrides Property BackColor() As Color Get Return MyBase.BackColor End Get Set(ByVal Value As Color) MyBase.BackColor = Value If (Me.Controls.Count) Then PaintMDIClientBackColor() End If End Set End Property
Protected Sub PaintMDIClientBackColor() Dim ctl As Control For Each ctl In Me.Controls If (ctl.GetType() Is GetType(MdiClient)) Then DirectCast(ctl, MdiClient).BackColor = BackColor End If Next End Sub
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs) e.Graphics.FillRectangle(New SolidBrush(BackColor), e.ClipRectangle) End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load PaintMDIClientBackColor() End Sub
Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress ' on test la propriété Me.BackColor = Color.Firebrick End Sub
End Class '***
-- Cordialement Yanick MVP pour Visual Basic "Stéphane" a écrit dans le message de news:
Bonjour,
J'ai trouvé un article de Microsoft qui démontre comment changer la
Cette façon de faire ne convient pas si l'on utilise une valeur de "DockPadding"...
La couleur de l'espace client est changé mais pas celle du padding....
Quelqu'un peut m'aider à changer la couleur du "DockPadding" .....
Merci !
Stéphane
Stéphane
Merci beaucoup Zoury,
Je ne pouvais demander mieux...
Au plaisir !
Stéphane
"Zoury" wrote:
Salut Stéphane ! :O)
Voici un exemple : '*** Option Explicit On
Imports System.ComponentModel
Public Class Form1 Inherits System.Windows.Forms.Form
#Region " Code généré par le Concepteur Windows Form "
Public Sub New() MyBase.New()
'Cet appel est requis par le Concepteur Windows Form. InitializeComponent()
If (IsMdiContainer) Then BackColor = SystemColors.AppWorkspace Else BackColor = SystemColors.Control End If
End Sub
'La méthode substituée Dispose du formulaire pour nettoyer la liste des composants. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub
'Requis par le Concepteur Windows Form Private components As System.ComponentModel.IContainer
'REMARQUE : la procédure suivante est requise par le Concepteur Windows Form 'Elle peut être modifiée en utilisant le Concepteur Windows Form. 'Ne la modifiez pas en utilisant l'éditeur de code. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() ' 'Form1 ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(568, 366) Me.DockPadding.All = 50 Me.IsMdiContainer = True Me.KeyPreview = True Me.Name = "Form1" Me.Text = "Form1"
DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)> _ Public Overrides Property BackColor() As Color Get Return MyBase.BackColor End Get Set(ByVal Value As Color) MyBase.BackColor = Value If (Me.Controls.Count) Then PaintMDIClientBackColor() End If End Set End Property
Protected Sub PaintMDIClientBackColor() Dim ctl As Control For Each ctl In Me.Controls If (ctl.GetType() Is GetType(MdiClient)) Then DirectCast(ctl, MdiClient).BackColor = BackColor End If Next End Sub
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs) e.Graphics.FillRectangle(New SolidBrush(BackColor), e.ClipRectangle) End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load PaintMDIClientBackColor() End Sub
Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress ' on test la propriété Me.BackColor = Color.Firebrick End Sub
End Class '***
-- Cordialement Yanick MVP pour Visual Basic "Stéphane" a écrit dans le message de news: > Bonjour, > > J'ai trouvé un article de Microsoft qui démontre comment changer la couleur > de fond d'un fenêtre MDI... > > http://support.microsoft.com/default.aspx?scid=kb;en-us;319417 > > Le problème... > > Cette façon de faire ne convient pas si l'on utilise une valeur de > "DockPadding"... > > La couleur de l'espace client est changé mais pas celle du padding.... > > Quelqu'un peut m'aider à changer la couleur du "DockPadding" ..... > > > Merci ! > > > Stéphane
Merci beaucoup Zoury,
Je ne pouvais demander mieux...
Au plaisir !
Stéphane
"Zoury" wrote:
Salut Stéphane ! :O)
Voici un exemple :
'***
Option Explicit On
Imports System.ComponentModel
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Code généré par le Concepteur Windows Form "
Public Sub New()
MyBase.New()
'Cet appel est requis par le Concepteur Windows Form.
InitializeComponent()
If (IsMdiContainer) Then
BackColor = SystemColors.AppWorkspace
Else
BackColor = SystemColors.Control
End If
End Sub
'La méthode substituée Dispose du formulaire pour nettoyer la liste des
composants.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Requis par le Concepteur Windows Form
Private components As System.ComponentModel.IContainer
'REMARQUE : la procédure suivante est requise par le Concepteur Windows
Form
'Elle peut être modifiée en utilisant le Concepteur Windows Form.
'Ne la modifiez pas en utilisant l'éditeur de code.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(568, 366)
Me.DockPadding.All = 50
Me.IsMdiContainer = True
Me.KeyPreview = True
Me.Name = "Form1"
Me.Text = "Form1"
DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)> _
Public Overrides Property BackColor() As Color
Get
Return MyBase.BackColor
End Get
Set(ByVal Value As Color)
MyBase.BackColor = Value
If (Me.Controls.Count) Then
PaintMDIClientBackColor()
End If
End Set
End Property
Protected Sub PaintMDIClientBackColor()
Dim ctl As Control
For Each ctl In Me.Controls
If (ctl.GetType() Is GetType(MdiClient)) Then
DirectCast(ctl, MdiClient).BackColor = BackColor
End If
Next
End Sub
Protected Overrides Sub OnPaint(ByVal e As
System.Windows.Forms.PaintEventArgs)
e.Graphics.FillRectangle(New SolidBrush(BackColor), e.ClipRectangle)
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
PaintMDIClientBackColor()
End Sub
Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
' on test la propriété
Me.BackColor = Color.Firebrick
End Sub
End Class
'***
--
Cordialement
Yanick
MVP pour Visual Basic
"Stéphane" <Stphane@discussions.microsoft.com> a écrit dans le message de
news:468D8E54-E9E6-4C4B-90D4-C87E1F940694@microsoft.com...
> Bonjour,
>
> J'ai trouvé un article de Microsoft qui démontre comment changer la
couleur
> de fond d'un fenêtre MDI...
>
> http://support.microsoft.com/default.aspx?scid=kb;en-us;319417
>
> Le problème...
>
> Cette façon de faire ne convient pas si l'on utilise une valeur de
> "DockPadding"...
>
> La couleur de l'espace client est changé mais pas celle du padding....
>
> Quelqu'un peut m'aider à changer la couleur du "DockPadding" .....
>
>
> Merci !
>
>
> Stéphane
Public Class Form1 Inherits System.Windows.Forms.Form
#Region " Code généré par le Concepteur Windows Form "
Public Sub New() MyBase.New()
'Cet appel est requis par le Concepteur Windows Form. InitializeComponent()
If (IsMdiContainer) Then BackColor = SystemColors.AppWorkspace Else BackColor = SystemColors.Control End If
End Sub
'La méthode substituée Dispose du formulaire pour nettoyer la liste des composants. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub
'Requis par le Concepteur Windows Form Private components As System.ComponentModel.IContainer
'REMARQUE : la procédure suivante est requise par le Concepteur Windows Form 'Elle peut être modifiée en utilisant le Concepteur Windows Form. 'Ne la modifiez pas en utilisant l'éditeur de code. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() ' 'Form1 ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(568, 366) Me.DockPadding.All = 50 Me.IsMdiContainer = True Me.KeyPreview = True Me.Name = "Form1" Me.Text = "Form1"
DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)> _ Public Overrides Property BackColor() As Color Get Return MyBase.BackColor End Get Set(ByVal Value As Color) MyBase.BackColor = Value If (Me.Controls.Count) Then PaintMDIClientBackColor() End If End Set End Property
Protected Sub PaintMDIClientBackColor() Dim ctl As Control For Each ctl In Me.Controls If (ctl.GetType() Is GetType(MdiClient)) Then DirectCast(ctl, MdiClient).BackColor = BackColor End If Next End Sub
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs) e.Graphics.FillRectangle(New SolidBrush(BackColor), e.ClipRectangle) End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load PaintMDIClientBackColor() End Sub
Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress ' on test la propriété Me.BackColor = Color.Firebrick End Sub
End Class '***
-- Cordialement Yanick MVP pour Visual Basic "Stéphane" a écrit dans le message de news: > Bonjour, > > J'ai trouvé un article de Microsoft qui démontre comment changer la couleur > de fond d'un fenêtre MDI... > > http://support.microsoft.com/default.aspx?scid=kb;en-us;319417 > > Le problème... > > Cette façon de faire ne convient pas si l'on utilise une valeur de > "DockPadding"... > > La couleur de l'espace client est changé mais pas celle du padding.... > > Quelqu'un peut m'aider à changer la couleur du "DockPadding" ..... > > > Merci ! > > > Stéphane