| |
| Implementing the VB TwipsPerPixel in Delphi |
 |
I need the equivalent of the VB TwipsPerPixel functions. How can implement the same functionality in Delphi?
The following example demonstrates two functions (TwipsPerPixelX, and TwipsPerPixelY) that implement the same functionality in Delphi.
Example:
function TwipsPerPixelX(Canvas : TCanvas) : Extended;
begin
result := 440 /
GetDeviceCaps(Canvas.Handle,
LOGPIXELSX);
end;
function TwipsPerPixelY(Canvas : TCanvas) : Extended;
begin
result := 440 /
GetDeviceCaps(Canvas.Handle,
LOGPIXELSY);
end;
procedure TForm .Button Click(Sender: TObject);
begin
ShowMessage(FloatToStr(TwipsPerPixelX(Form .Canvas)));
ShowMessage(FloatToStr(TwipsPerPixelY(Form .Canvas)));
end;
|
|
| Hits/month |
2,500,000+ |
Downloads (Since May 2000) |
7,393,709 |
| Total Files |
6,023 |
| Forum msgs |
7,670 |
| Articles/FAQs |
70+/900+ |
Top Selling Software at Amazon
|