Wenn Sie meinen Tipp Bitte ergänzen Sie in: Region "Enumeration" ... Texture ... Region "Variables" ... Private theTexBitmap As Bitmap = Nothing Private theRotation As RotateFlipType = Nothing ... Region "Public properties" ... Public Property textureBitmap() As Bitmap Get Return theTexBitmap End Get Set(value As Bitmap) theTexBitmap = value End Set End Property Public Property textureBitmapRotation() As RotateFlipType Get Return theRotation End Get Set(value As RotateFlipType) theRotation = value End Set End Property ... Region "Public methods" ... Case ShadowMode.Texture Dim rect As New Rectangle(New Point(0, 0), Me.ClientSize) Dim image As New Bitmap(Me.ClientSize.Width, Me.ClientSize.Height) Dim gr As Graphics = Graphics.FromImage(image) ' Initialisieren color matrix ' mit Wert 0.8 in Zeile 4, Spalte 4 wird das Image mit Wert von theOpacityMax transparent Dim matrixItems As Single()() = { _ New Single() {1, 0, 0, 0, 0}, _ New Single() {0, 1, 0, 0, 0}, _ New Single() {0, 0, 1, 0, 0}, _ New Single() {0, 0, 0, theOpacityMax, 0}, _ New Single() {0, 0, 0, 0, 1}} Dim colorMatrix As New ColorMatrix(matrixItems) ' erstellen von ImageAttributen zur color matrix Dim imageAtt As New ImageAttributes() imageAtt.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap) ' Bitmap als TextureBrush Dim img As Image = New Bitmap(textureBitmap) If Not IsNothing(theRotation) Then img.RotateFlip(theRotation) Dim theTBrush As New TextureBrush(img, New Rectangle(0, 0, img.Width, img.Height), imageAtt) theTBrush.WrapMode = WrapMode.Tile gr.FillRectangle(theTBrush, rect) gr.Dispose() theTBrush.Dispose() Me.BackgroundImage = image ... Diese Code-Snippets an den entsprechenden Stellen des Form-Codes einfügen. Zur Anwendung benötigt man natürlich eine entsprechende Bitmap, die als Texture für das Zeichnen verwendet wird. Am Besten man nimmt oder macht sich selbst eine, die eine Größe von 24x24 Bit hat. Ich liefere mit diesem Tipp eine Bitmap mit, die ein dunkles Streifenmuster erzeugt. Man bereitet dann den Einsatz vor mit bspw.: Randomize(Now.Ticks) Dim rot() As RotateFlipType = [Enum].GetValues(GetType(RotateFlipType)) With myDimmingForm .Owner = theSpecForm .ActiveShadowMode = .ShadowMode.Texture ' (meine Bitmap habe ich in den Resources des Projekts gespeichert) .textureBitmap = My.Resources.diag .textureBitmapRotation = rot(CInt(Math.Floor((rot.Length + 1) * Rnd()))) .Show() End With Da man als Eigenschaft für die Dimmingform auch die Rotation der vorgegebenen Bitmap einstellen kann, habe ich im Beispiel die Rotation mal zufällig eingestellt. Dieser Tipp wurde bereits 7.574 mal aufgerufen.
Anzeige
![]() ![]() ![]() (einschl. Beispielprojekt!) Ein absolutes Muss - Geballtes Wissen aus mehr als 8 Jahren vb@rchiv! - nahezu alle Tipps & Tricks und Workshops mit Beispielprojekten - Symbol-Galerie mit mehr als 3.200 Icons im modernen Look Weitere Infos - 4 Entwickler-Vollversionen (u.a. sevFTP für .NET), Online-Update-Funktion u.v.m. |
Neu! sevCommand 4.0 ![]() Professionelle Schaltflächen im modernen Design! Mit nur wenigen Mausklicks statten auch Sie Ihre Anwendungen ab sofort mit grafischen Schaltflächen im modernen Look & Feel aus (WinXP, Office, Vista oder auch Windows 8), inkl. große Symbolbibliothek. Tipp des Monats TOP Entwickler-Paket ![]() TOP-Preis!! Mit der Developer CD erhalten Sie insgesamt 24 Entwickler- komponenten und Windows-DLLs. Die Einzelkomponenten haben einen Gesamtwert von 1866.50 EUR... |
||||||||||||||||
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein. |