Putting a background before drawn on lines

Started by
3 comments, last by Captain P 15 years, 8 months ago
Hey. I am trying to put a background to my project. I could drag a picture across the whole of the screen and set it too back, but i have a little problem. I cant get the picture to go behind the lines that i drew on using formpaint. I have tryed setting the image to SendToBack on both formpaint and formcreate and still no look. Below is where i am at. Is there anyway to get the image to go behind FormPaint? void __fastcall TForm1::FormPaint(TObject *Sender) { Image2-> ... // drawing in the sqares using the function i wrote DrawSquare(300, 280, squaresize); DrawSquare(400, 280, squaresize); DrawSquare(500, 280, squaresize); DrawSquare(600, 280, squaresize); DrawSquare(700, 280, squaresize); DrawSquare(800, 280, squaresize); DrawSquare(900, 280, squaresize); Thanks Peter
Advertisement
anyone?
What libraries are you using? What language? How does your DrawSquare function look and what code did you write to display an image? The more (relevant) information you give, the higher the chance that someone is able to help you. :)
Create-ivity - a game development blog Mouseover for more information.
ok.

I am using Borland Compiler.

Libraries :-

#include <vcl.h>
#pragma hdrstop

#include "pma4Q1U.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;


DrawSquare function looks like this :-

void DrawSquare(int x, int y, int size)
{

// writing in the function to draw the sqares

Form1->Canvas->Pen->Color = clBlack;
Form1->Canvas->Pen->style = psSolid;
Form1->Canvas->MoveTo(x, y);
Form1->Canvas->LineTo(x + size, y);
Form1->Canvas->LineTo(x + size, y + size);
Form1->Canvas->LineTo(x, y + size);
Form1->Canvas->LineTo(x, y);
}

Quote:Original post by Twinsen LBA
I am using Borland Compiler.

Borland is a company that has produced several products. Judging from the source-code you've posted however, it looks like you're using Borland C++ Builder.

Quote:Libraries :-

Looks like you're at least using Borlands VCL component library.

I'm not familiar with VCL, but I think the problem here is that you're drawing your lines to the forms canvas, which is more or less the background of your whole application. Any GUI object you put in it is rendered on top of that canvas. Try drawing an empty, transparent image on top of the other image, while drawing your lines into that empty image.


What exactly are you working on bytheway? An editor or such?
Create-ivity - a game development blog Mouseover for more information.

This topic is closed to new replies.

Advertisement