Splash window

Using (or providing) Microsoft.NET Classes

Splash window

Postby Tomas Gustafsson on Wed Jan 06, 2016 1:24 am

Just s random note. Sometimes you want to have a splash screen when the prog starts up BUT you don't want the image to sit in a directory on disk, since you want to prohibit someone replacing it with another image. Ie. you bake the image with the ws, in a variable. Heres how to:



⍝ Grab the bits from bitmap, store in #._GDI.splashBits
⍝ ---
⍝ bmp←#.Bitmap.New⊂'c:\stormwind\splash.bmp'
⍝ str←⎕NEW #.IO.MemoryStream
⍝ bmp.Save str #.Drawing.Imaging.ImageFormat.Jpeg

⍝ #._GDI.splashBits←str.ToArray
⍝ str.Dispose
⍝ bmp.Dispose
⍝ ⎕EX¨'str' 'bmp'
⍝ ---

⍝ Persistent: B1, F1, L1, S1

S1←⎕NEW #.IO.MemoryStream
B1←#.Bitmap.New S1

F1←#.Form.New ⍬
F1.(Width Height StartPosition FormBorderStyle MaximizeBox MinimizeBox ControlBox)←500 286 #.FormStartPosition.CenterScreen #.FormBorderStyle.FixedToolWindow 0 0 0

L1←#.Label.New ⍬
L1.(Location Width TextAlign BackColor)←(#.Point.New 30 70)460 L1.TextAlign.MiddleLeft #.Color.Transparent
F1.Controls.Add L1


⎕DL 0.01

Dispose when the splash screen has done it job:
      GDI.(F1 L1 S1 B1).Dispose ⋄ GDI.(⎕EX¨'F1' 'L1' 'S1' 'B1')

Note: Must be in this order, F1 L1 S1 B1. If opposite order, WIndows displays a red cross on the image before deleting the form.
Tomas Gustafsson
Posts: 101
Joined: Mon Sep 19, 2011 6:43 pm

Return to Microsoft.NET

Who is online

Users browsing this forum: No registered users and 1 guest