How to set a background for my form in c++builder6?
up vote
0
down vote
favorite
I am new to C++Builder 6, but I have used C++. My question is, how do I set a background for my form? When I open the application I want the background to have a specific image. I tried with Graphics::TBitmap
but it says that the image is not valid even if it is bmp.
Graphics::TBitmap *BmpTabla = new Graphics::TBitmap;
try {
BmpTabla->LoadFromFile("board.bmp");
}
__finally
{
delete BmpTabla;
}
Edit: I just changed the picture and worked fine.
c++ background c++builder
New contributor
add a comment |
up vote
0
down vote
favorite
I am new to C++Builder 6, but I have used C++. My question is, how do I set a background for my form? When I open the application I want the background to have a specific image. I tried with Graphics::TBitmap
but it says that the image is not valid even if it is bmp.
Graphics::TBitmap *BmpTabla = new Graphics::TBitmap;
try {
BmpTabla->LoadFromFile("board.bmp");
}
__finally
{
delete BmpTabla;
}
Edit: I just changed the picture and worked fine.
c++ background c++builder
New contributor
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am new to C++Builder 6, but I have used C++. My question is, how do I set a background for my form? When I open the application I want the background to have a specific image. I tried with Graphics::TBitmap
but it says that the image is not valid even if it is bmp.
Graphics::TBitmap *BmpTabla = new Graphics::TBitmap;
try {
BmpTabla->LoadFromFile("board.bmp");
}
__finally
{
delete BmpTabla;
}
Edit: I just changed the picture and worked fine.
c++ background c++builder
New contributor
I am new to C++Builder 6, but I have used C++. My question is, how do I set a background for my form? When I open the application I want the background to have a specific image. I tried with Graphics::TBitmap
but it says that the image is not valid even if it is bmp.
Graphics::TBitmap *BmpTabla = new Graphics::TBitmap;
try {
BmpTabla->LoadFromFile("board.bmp");
}
__finally
{
delete BmpTabla;
}
Edit: I just changed the picture and worked fine.
c++ background c++builder
c++ background c++builder
New contributor
New contributor
edited yesterday
New contributor
asked 2 days ago
Gabi5537
33
33
New contributor
New contributor
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
accepted
Drop TImage component to the form, send it to back of the all controls, set the Align property to alClient.
In runtime
Image1->Picture->LoadFromFile("board.bmp");
It worked, but now it says that "Bitmap image is not valid", there are certain standars for images?
– Gabi5537
2 days ago
1
Picture object load the file according to its type (file extension). If.bmp
file has other format regardless the type, an exception will be thrown. Try to test some trusted bitmap file i.e. included in C++Builder distribution package. Also try to open.bmp
in some graphic editor (GIMP, XnView...) and re-save it.
– serge
2 days ago
add a comment |
up vote
0
down vote
The easiest way to have a custom background is to use a client-aligned TImage
, like @serge suggested.
Another way is to load the BMP image into a Graphics::TBitmap
object (like you are already attempting to do) and then use the Form's OnPaint
event to draw the TBitmap
onto the Form's Canvas
.
The "image is not valid" error means you are trying to load a .bmp
file that is not a valid BMP image. Double check the contents of the file.
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
Drop TImage component to the form, send it to back of the all controls, set the Align property to alClient.
In runtime
Image1->Picture->LoadFromFile("board.bmp");
It worked, but now it says that "Bitmap image is not valid", there are certain standars for images?
– Gabi5537
2 days ago
1
Picture object load the file according to its type (file extension). If.bmp
file has other format regardless the type, an exception will be thrown. Try to test some trusted bitmap file i.e. included in C++Builder distribution package. Also try to open.bmp
in some graphic editor (GIMP, XnView...) and re-save it.
– serge
2 days ago
add a comment |
up vote
0
down vote
accepted
Drop TImage component to the form, send it to back of the all controls, set the Align property to alClient.
In runtime
Image1->Picture->LoadFromFile("board.bmp");
It worked, but now it says that "Bitmap image is not valid", there are certain standars for images?
– Gabi5537
2 days ago
1
Picture object load the file according to its type (file extension). If.bmp
file has other format regardless the type, an exception will be thrown. Try to test some trusted bitmap file i.e. included in C++Builder distribution package. Also try to open.bmp
in some graphic editor (GIMP, XnView...) and re-save it.
– serge
2 days ago
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
Drop TImage component to the form, send it to back of the all controls, set the Align property to alClient.
In runtime
Image1->Picture->LoadFromFile("board.bmp");
Drop TImage component to the form, send it to back of the all controls, set the Align property to alClient.
In runtime
Image1->Picture->LoadFromFile("board.bmp");
answered 2 days ago
serge
1877
1877
It worked, but now it says that "Bitmap image is not valid", there are certain standars for images?
– Gabi5537
2 days ago
1
Picture object load the file according to its type (file extension). If.bmp
file has other format regardless the type, an exception will be thrown. Try to test some trusted bitmap file i.e. included in C++Builder distribution package. Also try to open.bmp
in some graphic editor (GIMP, XnView...) and re-save it.
– serge
2 days ago
add a comment |
It worked, but now it says that "Bitmap image is not valid", there are certain standars for images?
– Gabi5537
2 days ago
1
Picture object load the file according to its type (file extension). If.bmp
file has other format regardless the type, an exception will be thrown. Try to test some trusted bitmap file i.e. included in C++Builder distribution package. Also try to open.bmp
in some graphic editor (GIMP, XnView...) and re-save it.
– serge
2 days ago
It worked, but now it says that "Bitmap image is not valid", there are certain standars for images?
– Gabi5537
2 days ago
It worked, but now it says that "Bitmap image is not valid", there are certain standars for images?
– Gabi5537
2 days ago
1
1
Picture object load the file according to its type (file extension). If
.bmp
file has other format regardless the type, an exception will be thrown. Try to test some trusted bitmap file i.e. included in C++Builder distribution package. Also try to open .bmp
in some graphic editor (GIMP, XnView...) and re-save it.– serge
2 days ago
Picture object load the file according to its type (file extension). If
.bmp
file has other format regardless the type, an exception will be thrown. Try to test some trusted bitmap file i.e. included in C++Builder distribution package. Also try to open .bmp
in some graphic editor (GIMP, XnView...) and re-save it.– serge
2 days ago
add a comment |
up vote
0
down vote
The easiest way to have a custom background is to use a client-aligned TImage
, like @serge suggested.
Another way is to load the BMP image into a Graphics::TBitmap
object (like you are already attempting to do) and then use the Form's OnPaint
event to draw the TBitmap
onto the Form's Canvas
.
The "image is not valid" error means you are trying to load a .bmp
file that is not a valid BMP image. Double check the contents of the file.
add a comment |
up vote
0
down vote
The easiest way to have a custom background is to use a client-aligned TImage
, like @serge suggested.
Another way is to load the BMP image into a Graphics::TBitmap
object (like you are already attempting to do) and then use the Form's OnPaint
event to draw the TBitmap
onto the Form's Canvas
.
The "image is not valid" error means you are trying to load a .bmp
file that is not a valid BMP image. Double check the contents of the file.
add a comment |
up vote
0
down vote
up vote
0
down vote
The easiest way to have a custom background is to use a client-aligned TImage
, like @serge suggested.
Another way is to load the BMP image into a Graphics::TBitmap
object (like you are already attempting to do) and then use the Form's OnPaint
event to draw the TBitmap
onto the Form's Canvas
.
The "image is not valid" error means you are trying to load a .bmp
file that is not a valid BMP image. Double check the contents of the file.
The easiest way to have a custom background is to use a client-aligned TImage
, like @serge suggested.
Another way is to load the BMP image into a Graphics::TBitmap
object (like you are already attempting to do) and then use the Form's OnPaint
event to draw the TBitmap
onto the Form's Canvas
.
The "image is not valid" error means you are trying to load a .bmp
file that is not a valid BMP image. Double check the contents of the file.
answered yesterday
Remy Lebeau
325k18243429
325k18243429
add a comment |
add a comment |
Gabi5537 is a new contributor. Be nice, and check out our Code of Conduct.
Gabi5537 is a new contributor. Be nice, and check out our Code of Conduct.
Gabi5537 is a new contributor. Be nice, and check out our Code of Conduct.
Gabi5537 is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53186876%2fhow-to-set-a-background-for-my-form-in-cbuilder6%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password