Jump to content

Anders Melander

Members
  • Content Count

    2562
  • Joined

  • Last visited

  • Days Won

    133

Everything posted by Anders Melander

  1. Anders Melander

    32bit bitmap

    Yes but it's a nasty mess. Better than nothing I guess.
  2. Anders Melander

    32bit bitmap

    To use alpha transparency you need to set Transparent=False. Here's what it looks like (Delphi 10.3):
  3. Anders Melander

    32bit bitmap

    If you're using Delphi 7 then you will have to use 3rd party components. For example Graphics32 - and better hurry because I plan to drop support for Delphi 7 in Graphics32 the first chance I get.
  4. Anders Melander

    32bit bitmap

    Works fine for me. Here's a form with two TImage controls, one overlapping the other. The top one contains a 32-bit bitmap with alpha, the bottom a PNG. I have set Image1.Transpartent=False and Image1.Picture.Bitmap.AlphaFormat=afDefined (at run-time) for the bitmap.
  5. Anders Melander

    Hashing Street Addresses ?

    I solve most of my problems in the shower. Eureka!
  6. Anders Melander

    Issue about calling Canvas.Polygon

    Yes, they're designed to be nested. I have no idea about why it doesn't work though. Maybe TCanvas gets confused when the HDC is modified outside its control.
  7. Anders Melander

    ANN: Better Translation Manager released

    In newer versions of Delphi there's an project option "Output resource string .drc file" but I don't believe that it's there in Delphi 5. Since Delphi 5 was the first version to include the ITE and the ITE uses DRC files it must be possible somehow. I have the Delphi 5 files on my system but I'm afraid I don't have it installed so I can't run it to find out. Maybe try to compile with the "detailed map file" linker option enabled and see if that makes a difference.
  8. Anders Melander

    Issue about calling Canvas.Polygon

    I know the SaveDC/RestoreDC doesn't solve your problem. In my code it's just there to leave the canvas in the same state as it was in when I got it. The key point from my code was the clearing of the pen handle since in my case I had problems with the pen color. Try reversing the order of the pen and brush assignments. I've had similar problems and as far as I remember that was what I did to solve it.
  9. Anders Melander

    Issue about calling Canvas.Polygon

    My mistake. The ACanvas in my code is a DevExpress TcxCanvas - I didn't think about that. I think that if you use SaveDC/RestoreDC with a TCanvas then you'll need to lock the canvas to guard against the DC being changed. Something like this: ACanvas.Lock; try SaveDC(ACanvas.Handle); try ... finally RestoreDC(ACanvas.Handle, -1); end; finally ACanvas.Unlock; end;
  10. Anders Melander

    Issue about calling Canvas.Polygon

    They are Windows API functions: https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-savedc
  11. Anders Melander

    ANN: Better Translation Manager released

    I've just read the Delphi 5 help and as far as I can see Delphi 5 does produce DRC files. What makes you say it doesn't?
  12. Anders Melander

    Issue about calling Canvas.Polygon

    I use the following to draw corners (top-right in this example): const CornerSize = 8; var Triangle: array[0..2] of TPoint; begin ACanvas.SaveDC; try ACanvas.Brush.Color := clRed; ACanvas.Brush.Style := bsSolid; ACanvas.Pen.Handle := 0; // Work around for messed up pen handle sporadically causing line not to be drawn ACanvas.Pen.Color := GetHighLightColor(ACanvas.Brush.Color); ACanvas.Pen.Style := psSolid; Triangle[0].X := AViewInfo.BoundsRect.Right-1; Triangle[0].Y := AViewInfo.BoundsRect.Top; Triangle[1].X := Triangle[0].X - CornerSize; Triangle[1].Y := Triangle[0].Y; Triangle[2].X := Triangle[0].X; Triangle[2].Y := Triangle[0].Y + CornerSize; ACanvas.Polygon(Triangle); finally ACanvas.RestoreDC; end;
  13. Anders Melander

    Install recent Delphi versions on Windows XP

    Why would you want to do that? Just curious.
  14. You're the only one talking about timers, but even if you used a grandfather clock the method would work. If you break the application at random you will have 50% higher likelihood of hitting lineB than lineA and each time you do this the likelihood increases. This is exactly how a sampling profiler works. Are you saying sampling profilers are a hoax?
  15. Why wouldn't a profiler, real or not, help there? What do you think a profiler does?
  16. Yes, of course that didn't do anything. Why would you expect it to? I think you need to take a step back and think about what you are doing instead of just trying random stuff. Take control of the problem. The numbers you have posted shows that you are either measuring time in microseconds or using the thousand separator incorrectly. If you are measuring microseconds then stop that. Numbers that small are not relevant here. One of the first things you should have done would be to locate the bottleneck by profiling your code. If you don't have a profiler or don't understand how to use one then you can emulate a sampling profiler by just running the application a few times and pause it in the debugger. Unless the slowdown is evenly distributed then there's a statistic likelihood that the call stack will show you where the application is spending the majority of its time.
  17. Anders Melander

    Can the width of TaskMessageDlg be set?

    No you're right - I misread the documentation of the callback. The callback function does get passed the window handle of the task dialog though: ...which can then be used to modify the window. Not that I would recommend it.
  18. Anders Melander

    Can the width of TaskMessageDlg be set?

    No. TaskMessageDlg is just wrapper around a TTaskDialog component and unfortunately TTaskDialog doesn't provide any way to specify the cxWidth parameter of the TASKDIALOGCONFIG structure passed to TaskDialogIndirect. You could create your own wrapper that calls the TaskDialogIndirect API function instead. Actually now that I think of it you might subclass TTaskDialog and override the TCustomTaskDialog.CallbackProc method to intercept the TDN_CREATED or TDN_DIALOG_CONSTRUCTED notifications. The notification messages gives you access to a pointer to the TASKDIALOGCONFIG structure used to create the dialog but I'm unsure if you can do anything with that. There are no messages you can send the task dialog to update the width. By the way, take note that the cxWidth member specifies the width in dialog units - not pixels.
  19. No, not using a standard TPopupMenu. The menu loop is being handled by Windows (via the TrackPopupMenu API function) and you do not have any control of how it behaves - and that's how it should be; Altering the behavior of something like a menu just leads to poor usability. The fact that you've had to resort to keyboard & mouse hooks should be a hint that they don't want you messing with it. I suggest you display a non-modal form instead. You can easily make that behave like a popup menu, with your custom behavior, without raping the system.
  20. Anders Melander

    win32metadata

    Yes, that's what I wrote. However the metadata comes from WinMD, which is also used by WinRT:
  21. Anders Melander

    Problem with clearing ADO Tables

    @Jeff Overcash Maybe read the whole thread before you reply. The issue has already been resolved.
  22. Anders Melander

    win32metadata

    Edit post seems to be broken so here's the link on how to read from WinMD: https://stackoverflow.com/questions/54375771/how-to-read-a-winmd-winrt-metadata-file
  23. Anders Melander

    win32metadata

    Isn't this just something that read metadata from WinMD and write wrappers? You can do that already so I guess the news is that they're generating WinMD from the SDK headers.
  24. Anders Melander

    Problem with clearing ADO Tables

    Could you give it a rest with the formatting? Your posts are hard enough to tolerate without it.
  25. Anders Melander

    Problem with clearing ADO Tables

    Read the documentation or example some existing code that works. The error message is pretty clear about what the problem is. I don't need to explain it to you.
×