Jump to content

dwrbudr

Members
  • Content Count

    95
  • Joined

  • Last visited

Community Reputation

12 Good

Technical Information

  • Delphi-Version
    Delphi 13 Florence

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. dwrbudr

    DevExpress Shell Components and Problems with 3rd Party Applications

    JAM Shell Controls work better from my experience. We're using tree views and list views with overlay icons without any issue (apart from DPI ones).
  2. Or TApplicationEvents.OnIdle (not sure if that is available in D6 though)
  3. In GridMouseDown event toggle or clear the selected dates only when Button = mbLeft
  4. If you want to do specific actions based on the VCL control that was about to receive the message, like a TTreeView, TEdit, etc.
  5. Drop TApplicationEvents component on the form and implement the OnMessage event handler. procedure TMainForm.ApplicationEventsMessage(var Msg: tagMSG; var Handled: boolean); var Key: Word; ShiftState: TShiftState; ctrl: TWinControl; begin case Msg.Message of WM_KEYDOWN: begin Key := Msg.wParam; ShiftState := KeyDataToShiftState(Msg.lParam); if (ssCtrl in ShiftState) and (Key = Ord('V')) then begin ctrl := FindControl(Msg.hwnd); //do whatever you need to do Handled := true; end; end; end; end;
  6. dwrbudr

    TBitmap.SaveToFile produces invalid image file

    @ToddFrankson In order to reproduce the issue, the PNG file has to be 8bit and probably grayscale. Try to reproduce the issue with the PNG file from the sample project I've attached.
  7. dwrbudr

    TBitmap.SaveToFile produces invalid image file

    Yes, I've missed that from the sample project, but using ms.Position := 0 doesn't change the outcome - black or invalid bitmap file.
  8. dwrbudr

    TBitmap.SaveToFile produces invalid image file

    @Anders Melander It seems the issue is much more broader that I initially thought. The change proposed by you fixes the issue above, e.g. calling SaveToFile/SaveToStream twice. But the following code produces black bitmap even if the fix is included. I have attached the sample project, but in order to test it Vcl.Graphics.pas has to be patched as described in the post above. As you said, TBitmap has to be almost entirelly rewritten from scratch. bmp := TBitmap.Create; bmp2 := TBitmap.Create; png := TPNGImage.create; png.LoadFromFile('in.png'); bmp.Assign(png); ms := TMemoryStream.Create; bmp.SaveToStream(ms); bmp2.LoadFromStream(ms); bmp2.SaveToFile('out.bmp'); // out.bmp is entirelly black BmpTest.zip
  9. dwrbudr

    TBitmap.SaveToFile produces invalid image file

    Thanks @Anders Melander What do you think is the safest fix? Probably to call InternalGetDIBSizes passing 0 instead of FDIB.dsbmih.biClrUsed Another "fix" is to set the Bitmap.Palette := 0 after the Assign call. Strangely though after assigning 8bit grayscale PNG to bitmap, the bitmap becames 24bit with palette. Is that a common use at all?
  10. The following code with this specific type of image (8-bit grayscale PNG) produces invalid .bmp (out_2.bmp) file if TBitmap.SaveToFile/SaveToStream is used more than once. The corrupt file cannot be opened in Windows Photo Viewer, FastStone Image Viewer, etc. BmpHeaderViewer shows this for out_1.bmp File Name: out_1.bmp File Size: 52.9 KB ------------------------------------------------------------------------ Type: BM Size: 54214 bytes Reserved1: 0 Reserved2: 0 OffBits: 1078 bytes ------------------------------------------------------------------------ Size: 40 bytes Width: 143 pixels Height: 123 pixels Planes: 1 BitCount: 24 bpp Compression: RGB SizeImage: 53136 bytes XPelsPerMeter: 0 YPelsPerMeter: 0 ClrUsed: 256 ClrImportant: 0 ------------------------------------------------------------------------ And this for the corrupted out_2.bmp File Name: out_2.bmp File Size: 52.9 KB ------------------------------------------------------------------------ Type: BM Size: 55238 bytes Reserved1: 0 Reserved2: 0 OffBits: 2102 bytes ------------------------------------------------------------------------ Size: 40 bytes Width: 143 pixels Height: 123 pixels Planes: 1 BitCount: 24 bpp Compression: RGB SizeImage: 53136 bytes XPelsPerMeter: 0 YPelsPerMeter: 0 ClrUsed: 256 ClrImportant: 0 ------------------------------------------------------------------------ Gap to pixels: 1024 bytes ------------------------------------------------------------------------ Image corrupt or truncated. ======================================================================== Tested on Delphi 12.3/13.0 Is this a known issue or what is possibly wrong in VCL, is it Vcl.Graphics.Pas or PNGImage.pas AssignTo method wrong? procedure TForm69.FormCreate(Sender: TObject); var bmp: TBitmap; png: TPNGImage; begin bmp := TBitmap.Create; png := TPNGImage.create; png.LoadFromFile('in.png'); bmp.Assign(png); bmp.SaveToFile('out_1.bmp'); bmp.SaveToFile('out_2.bmp'); end; Sample project to reproduce the issue is attached. BmpTest.zip
  11. dwrbudr

    New Delphi features in Delphi 13

    Yes, the freeze is there, but refactoring has worked OK for me. I suppose 12.3 will have to stay forever on my PC just for refactoring. formatter.exe can be used via CMD since we have very strict coding guideline and code reviews before pull requests.
  12. dwrbudr

    New Delphi features in Delphi 13

    No refactoring is a showstopper for me to use Delphi 13.0. Big dissapointment.
  13. dwrbudr

    Screenshot each sheet in a PageControl

    Call HandleNeeded on each tab instead of activating it.
  14. dwrbudr

    Intercepting UuidCreate function

    function Detour_UuidCreate(out guid: TGUID): Longint; stdcall; begin guid := Default(TGUID); Result := 0; end; procedure TForm68.Button1Click(Sender: TObject); var myguid: TGUID; begin InterceptCreate('rpcrt4.dll', 'UuidCreate', @Detour_UuidCreate); CreateGUID(myguid); end; So the above code does not work? On my side it works if I put a breakpoint in Detour_UuidCreate
  15. dwrbudr

    TVirtualImageList Custom component

    I think TVirtualImageList is automatically scaled when DPI changes only when TVirtualImageList is placed on a TForm/TFrame (look for SendChangeScaleMessage in the VCL code). So you'll have to override the panel ChangeScale method and set the image list size.
×