Sign in to follow this  
Twinsen LBA

Putting a background before drawn on lines

Recommended Posts

Twinsen LBA    124
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

Share this post


Link to post
Share on other sites
Captain P    1092
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. :)

Share this post


Link to post
Share on other sites
Twinsen LBA    124
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);
}

Share this post


Link to post
Share on other sites
Captain P    1092
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?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this