Solved

big big trouble with image

Posted on 1998-02-09
14
169 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
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 
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
 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

820 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