Salut,
j'essaie de créer un Splash Screen avec une image (png avec des zones transparentes) pour la propriété BackGroundImage avec supression d'une couleur.
J'ai met la couleur Lime comme couleur de BackColor de la form. La couleur Lime aussi pour la propriété TransparencyKey
En fin voilà le code de frmSplash.Designer.vb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class frmSplash
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected 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
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.SuspendLayout()
'
'frmSplash
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.BackColor = System.Drawing.Color.Lime
Me.BackgroundImage = Global.Librairie.My.Resources.Resources.splash
Me.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center
Me.ClientSize = New System.Drawing.Size(196, 348)
Me.ControlBox = False
Me.DoubleBuffered = True
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmSplash"
Me.ShowInTaskbar = False
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.TransparencyKey = System.Drawing.Color.Lime
Me.ResumeLayout(False)
End Sub
End Class |
Avec le code suivant :
1 2 3 4 5 6 7 8 9 10 11 12
| Dim gPic As Graphics = Me.CreateGraphics
'on récupère l'image de fond qui est incorporée à l'assembly en tant que ressource
Dim asmPic As System.Reflection.Assembly = System.Reflection.Assembly.GetExecutingAssembly
Dim bmpPic As Bitmap = New Bitmap(asmPic.GetManifestResourceStream("Librairie.SPALSH.png"))
Dim myRect As New Rectangle 'rectangle d'affichage de l'image
With myRect
.X = 0
.Y = 0
.Width = 198
.Height = 350
End With |
L'erreur est sur la ligne suivante :
Dim bmpPic As Bitmap = New Bitmap(asmPic.GetManifestResourceStream("Librairie.SPALSH.png"))
Erreur :
La valeur de 'null' n'est pas valide pour 'stream'.
Détails:
1 2 3
| L'exception System.ArgumentException n'a pas été gérée
Message="La valeur de 'null' n'est pas valide pour 'stream'."
Source="System.Drawing" |
Pouvez vous m'aidez svp
merci
Partager