I have some code for converting a color bitmap to 8-bit grayscale bitmap (GrayBmp: TBitmap) which includes the following:
var
GrayPalette: TMaxLogPalette;
begin
GrayBmp.PixelFormat := pf8Bit;
SetGray256Palette(GrayPalette); // Set palette colors
GrayBmp.Palette :=...
Clive,
Your reply has been invaluable! I used it to persuade my customer that this really was a BAD idea, even though he had originally insisted that was what he wanted (the customer is always right!).
I had thought it was easy from reading the Delphi help and the fact that Hint was a...
I have several forms that use a TMainMenu. I want to display the Hint item for the various menu and (where applicable) submenu items. However none of the hints I set are displayed.
I have buttons on the same forms that correctly display their hints.
I have checked that Application.ShowHint is...
I'm trying to use the ActiveX PDF component that comes with Delphi 7. All works fine, EXCEPT the area used by the component to display the document on the form doesn't change as the form size changes. The component reports the correct changed size for both the width/height and...
In the end bit the bullet and went through a full Delphi 7 reinstall. After reinstalling various associated packages and customizing the toolbars (again!) everything seems to be back to normal.
Thanks to all for spending the time to read and respond.
Please learn from my problem -
Exit...
Tried renaming directories and deleting files, but all to no avail.
Problem occurs with all projects, even if I just open Delphi with blank project. I have never saved any desktops and don't even have any .dst files on my disks.
Any other suggestions gratefully received.
Bob "To err is...
I made the mistake of doing some testing on the effects of changing the user setting of the windows Font Size while having Delphi 7 open. After I changed from Normal to Extra Large my Delphi toolbar layout had been thrown into complete disarray. Worst of all after I changed back to Normal the...
Many thanks to you all for your suggestions. Plenty of options for me choose from.
Bob
"To err is human, but you have to be a programmer to really screw things up!"
The program I am working on incorporates a large amount of ascii data which is input as RC_Data within a .res file.
This data dominates the size of the executable.
Is there any way of storing the data in a compressed format (e.g. zip) within a res file, and then uncompressing when it is loaded...
Forgot to mention a problem I encountered while implementing Pikkunero's code. At first the ShowWindow and SetForegroundWindow lines weren't doing anything. After much investigation found that the problem was because the program name and Application.Title were the same.
For example the...
Many thanks Pikkunero for your help (I have given you a star for your efforts!). Obviously I should have been looking for the handle to TApplication rather than the main window.
I have now implemented the multiple instance checking with the Mutex check and using a single FindWindow of the form...
Searching more through other threads and looking more into the API seem to suggest IsIconic(PrevHandle) should return True when the window is minimized.
However, inserting
PrevIconic := IsIconic(PrevHandle);
before
ShowWindow(PrevHandle, SW_RESTORE);
in my earlier example returns False...
SetActiveWindow doesn't do it and I'm not sure how to use WM_ACTIVATEAPP and WM_ACTIVATE (even after reading the Win32API help!).
Maybe it would be best if I showed a very simplified example of the problem. Open a new project and replace Project1 with the following and compile.program Project1...
Unfortunately SW_RESTORE has the same effect!
Although the window is being displayed correctly, if you right click on the symbol in the task bar the Restore item is bold and Minimize is greyed out. It's as though windows hasn't realised the window is no longer minimized.
I am running Win XP if...
I have the handle of another application's main form of a known type. I want to display that form in the foreground in the Default (Normal) condition. The current state of the form is either Minimized or Normal.
The best I have achieved is by using:
ShowWindow(FormHandle, SW_SHOWDEFAULT)...
I want to convert a truecolor bitmap with HandleType bmDIB and PixelFormat pf24Bit into a 256 grayscale with PixelFormat pf8Bit.
I have a function for converting a pf24Bit bitmap to grayscale
procedure ConvertBmpToGrayscale(var Bmp: TBitmap);
const
MaxPixelCount = 32768;
type...
jb
Could you include some of the code you have tried that does not work. It is much easier to understand and solve the problems if real code is included.
Bob
I can use the bitmap canvas in a CopyRect using the following code. Just open Delphi and add a button and a TImage to the form, then insert this code in Unit1. You will need to insert a file path to a .jpg on your hard disk.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants...
Thanks guys, but my emphasis was on generating useful messages instead of the annoying "failed" with no hint what caused it. For instance failures to save a file might include file access problems, or problems during the write process (e.g. disk full).
Any ideas what exceptions to catch to...
I'm not clear from your post what you are what you are trying to do.
Assuming you are trying to print from a bitmap, I have successfully used something similar to the following code.
Note: The input bmp must be a device independent bitmap (Bmp.HandleType := bmDIB)
{ Print a device independent...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.