[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 176
  • Last Modified:

big big trouble with image

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
hellfire052497
Asked:
hellfire052497
  • 5
  • 5
  • 4
1 Solution
 
ZifNabCommented:
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
 
d003303Commented:
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
 
hellfire052497Author Commented:
it's Empire word processor, and yes i'm from Belgium (the dutch side) :-)
response from zofnab comment
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
ZifNabCommented:
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
 
d003303Commented:
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
 
hellfire052497Author Commented:
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
 
ZifNabCommented:
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
 
d003303Commented:
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
 
hellfire052497Author Commented:
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
 
ZifNabCommented:
In the project source :

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

Zif.
0
 
d003303Commented:
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
 
hellfire052497Author Commented:
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
 
d003303Commented:
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
 
hellfire052497Author Commented:
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 5
  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now