Adding colour and images (Advanced) By: Mad Cow This course will teach you about forms. The difficulty varies from beginner to intermediate to advanced. Requirements Pretty good knowlage of SCAR Forms Overview In Chapter 3, I will show you how to add images and change the background colour of your forms. Setting up First we need to open the form editor and either continue a project or start a new one Adding a background colour First of all, open the SCAR Form Editor(You should know how to by now ) Now click on the blank form and in object inspector Go to "Border Icons -> Color". Eg. It's that simple!!! Now save the form and exit the form editor. Implementing the Form into the script Go to "Tools -> Load DFM Form" Declare the variables and place the code in a new procedure called "InitForm"(I know you've been through this a million times, just incase someone forgets). Now add your SafeCall procedures: Code (Text): procedure SafeInitForm; var v: TVariantArray; begin setarraylength(V, 0); ThreadSafeCall('InitForm', v); end; procedure ShowFormModal; begin frmDesign.ShowModal; end; procedure SafeShowFormModal; var v: TVariantArray; begin setarraylength(V, 0); ThreadSafeCall('ShowFormModal', v); end; And also set Code (Text): frmDesign.Visible := True; to Code (Text): frmDesign.Visible := False; Finally add Code (Text): SafeInitForm; SafeShowFormModal; to your main begin Your script should look something like this: Code (Text): program FormTutorialAddingBackGroundColours; var frmDesign : TForm; procedure ShowFormModal; begin frmDesign.ShowModal; end; procedure SafeShowFormModal; var v: TVariantArray; begin setarraylength(V, 0); ThreadSafeCall('ShowFormModal', v); end; procedure SafeInitForm; var v: TVariantArray; begin setarraylength(V, 0); ThreadSafeCall('InitForm', v); end; procedure InitForm; begin frmDesign := CreateForm; frmDesign.Left := 256; frmDesign.Top := 84; frmDesign.Width := 419; frmDesign.Height := 310; frmDesign.Caption := 'frmDesign'; frmDesign.Color := clBlack; frmDesign.Font.Color := clWindowText; frmDesign.Font.Height := -11; frmDesign.Font.Name := 'MS Sans Serif'; frmDesign.Font.Style := []; frmDesign.Visible := False; frmDesign.PixelsPerInch := 96; end; begin SafeInitForm; SafeShowFormModal; end. Now your done! Moving on to the hard part - Images. Adding images to Forms So you want to add images huh? Well let me go through a few procedure's that I will be using. Code (Text): GetBitmapCanvas(ImageNameHere); This basically gets the bitmap canvas so we can use it for our next procedure Code (Text): procedure SafeCopyCanvas(Source, Dest: TCanvas; sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2: Integer); Alright. Source = The canvas Destination = frmDesign.Canvas (Copies the bitmap canvas to the form) sx1, sy1, sx2, sy2 = Basically the size of the Bitmap(Or change if you on;y want to use part of the bitmap) dx1, dy1, dx2, dy2 = Where to copy the image to(Usually the same as sx1, sy1, sx2, sy2) Now we got the procedures worked out, you will need to find a bitmap to use. Depending on how big the bitmap is, either use “Script -> Picture to Stringâ€