Solved

big big trouble with image

Posted on 1998-02-09
14
166 Views
Last Modified: 2010-04-04
hi,

I have a program that uses a background image. Since the release of my program 3 people contacted me, saying that the picture only showed half of it. I first had a jpg file, so I switched to bmp, then I locked the form dimensions, I tried a res file and everything else, still they have the problem that half of the image is missing. I am completely at a loss with this problem, i cannot recreate the problem. and it is rare. the only thing they have in common is that they have w95 osr2.
some with ie4 and one without, I use D3 and no ie4 is installed. Does any one have a idea what may be wrong
if you want to look at the program then goto my site at
http://users.skynet.be/hellfire/
Is it a windows problem, is it delphi????????  
0
Comment
Question by:hellfire052497
  • 5
  • 5
  • 4
14 Comments
 
LVL 8

Expert Comment

by:ZifNab
ID: 1358784
Hi,

I saw your site : really nice, ... but were can I find the program? Which one is it?

Regards,
Zif.

(Are you from Belgium? Dutch or French part?)
0
 
LVL 4

Accepted Solution

by:
d003303 earned 100 total points
ID: 1358785
Yo,

this depends on the different screen DPI resolutions. Depending on your graphics driver and/or the screen resolution you can get 72, 96 or 120 DPI. There are 3 things you can do.
1. (a hack) Check the Scaled property of your form. Set it to false.
2. (more graceful) If you have locked the form size, determine its size in pixels on runtime and assign this value to the background image (assuming you are using TImage), and allow stretching.
3. (like M$ wants you to) Set your calculation base to inches. Calculate your image size in inches by getting Screen.PixelsPerInch. When your app starts, re-size your image by getting Screen.PixelsPerInch and multiplicate it with your stored size in inches.

Hope this helps,

Slash/d003303
0
 

Author Comment

by:hellfire052497
ID: 1358786
it's Empire word processor, and yes i'm from Belgium (the dutch side) :-)
response from zofnab comment
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1358787
Ok, let's find a solution.
First, does d003303 proprosels work? If so, work is done. If not we've to dig further.
Vriendelijke groeten, BanZif.
0
 
LVL 4

Expert Comment

by:d003303
ID: 1358788
I took a look at your Empire word processor. Cool design ! Do you also plan one with a federal design ;-)
OK, I tried around a bit. Here is the ultimate solution from the federal headquarters :
The first solution should be the best. Set the form's scaled property to false. You can see if it works by setting your system from small to large fonts (settings tab on the display control panel).

Slash/d003303
0
 

Author Comment

by:hellfire052497
ID: 1358789
the scaling seems to work, I sent the new exe to one of the users, should have definite answer by tomorrow, so stay tuned.
And yes I am planning to release a federation editor the next weeks.

Maybe you can help me with another small problem I have, well an annoyance more, I set an icon with the form, and with project options too, and it compiled with the executable, but now it uses the delphi default icon again, I tried resetting all the icons, but it still keeps using the default icon. any ideas to get my icon in the exe again
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1358790
Hi hellfire,

If you look at the resource file of your program. In the Icon section, how does the MAINICON look like?

Regards, Zif.
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 4

Expert Comment

by:d003303
ID: 1358791
exactly, have in Delphi a look at Projects->Options on the Application tab. Here has to be your application's icon. Your icon seems only be bound to the form.

Slash/d003303
0
 

Author Comment

by:hellfire052497
ID: 1358792
The scaling works, so success.

The icon, I checked the res file and the icon is the one I use.
And the icon in "project" "options" is also the same, but delphi compiles it with the standard one (the delphi 2 one even, the house with the torche) and I use Delphi 3 so what is wrong???
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1358793
In the project source :

 Is there a resource file? Like {$R *.RES}
 Have you included other resource, ... Files?

Zif.
0
 
LVL 4

Expert Comment

by:d003303
ID: 1358794
I have taken a look at your compiled EXE and DLL. In the EXE the main icon is the standard Delphi icon. So there seems to be a duplicate resource identifier at link time. This can happen if there are several *.RES files in your link path that contain a "MAINICON" resource.
About your DLL, it is just a renamed bitmap. Is there a special reason for this ? Maybe there is another, more graceful solution for that.

Slash/d003303
0
 

Author Comment

by:hellfire052497
ID: 1358795
hi,

I checked and I have 2 res files, Klingon.res (from klingon.dpr the project name) and klingon_800x600.res from klingon_800x600.pas (mainform1) do I need to delete one of these?
no res files are used in my project.

The dll, well that may be not very elegant. but functional because I have 3 versions of the exe. And I am planning to make some more programs with the same background. So this solution has the advantage of, Making the exe smaller, cutting download time for future versions. Less hard disk space. If there is a better solution, I am open to ideas.
bye
0
 
LVL 4

Expert Comment

by:d003303
ID: 1358796
1. No, these two files are OK. They are created by Delphi. Try to copy your project to another location, create a new project and add your forms and units to the project. Hopfuly this helps.

2. Consider putting the bitmap into a resource file and compile it as a dll. You can use API functions to access the resource, and multiple instances of your app will share the image.
For this, open image editor and create a new resource, load your background image into the editor, create a new bitmap with the same properties in the resource file, name it, say klingon, copy and paste the contents over, save it as klingon.res (hope this is clear enough).
In Delphi, create a new, empty DLL and save the project as, say klingon.dpr. Then overwrite the project with the following lines:

library klingon;

{$R klingon.res}
begin
end.

Compile it and that's it.
To access the bitmap in your app, use
HKlingonDll := LoadLibrary('klingon.dll');
// klingon is the name of the bitmap in the resource
HKlingonBMP := LoadBitmap(HKlingonDll, 'klingon');
and assign HKlingonBMP to a TBitmap.Handle.

Slash/d003303
0
 

Author Comment

by:hellfire052497
ID: 1358797
1. nope, no go
2. That works great thanks. Had to use brcc32 instead of image because it screwed up the picture but for the rest, EXCELLENT.

Thanks again
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now