Jump to content
  • Advertisement
Sign in to follow this  
Twinsen LBA

Putting a background before drawn on lines

This topic is 3627 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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
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
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!