archive-com.com » COM » E » EFG2.COM

Total: 878

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".

  • background wasn t redrawn to fit The same thing happened when you moved the child window back into the center of the parent and the scroll bars disappeared I did some searching into the Windows messages and found that if I trapped the message WM WINDOWPOSCHANGED and invalidated the client area then it would catch this event and my background always redrew properly I m not sure if this is the best way to do it but it works well for me Here is the original code with many thanks to Peter Below with my code changes blocked with New Code Richard Speiss unit Main interface uses Windows Messages SysUtils Classes Graphics Controls Forms Dialogs Menus StdCtrls ToolWin ComCtrls type TForm1 class TForm ToolBar1 TToolBar ToolButton1 TToolButton ToolButton2 TToolButton procedure FormCreate Sender TObject procedure FormDestroy Sender TObject procedure FormResize Sender TObject private Private declarations FLogoBitmap TBitmap FOldProc Pointer public Public declarations end var Form1 TForm1 implementation R DFM Function ClientWindowProc wnd HWND msg Cardinal wparam lparam Integer Integer stdcall Var f TForm1 r Trect Begin f TForm1 GetWindowLong wnd GWL USERDATA Case msg of WM ERASEBKGND Begin GetClientrect wnd r StretchBlt wparam r left r top r right r bottom

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/2001/0621c.txt (2016-02-14)
    Open archived version from archive



  • bit more Applications in Windows have a somewhat device independent view of the hardware Your application manipulates color values as 24 bit quantities However that s not what the hardware sees If you are on a 256 color system and you do a solid fill with clBlue here s what happens Delphi creates a solid brush requesting color FF0000 GDI eventually calls the display driver asking it to realize the brush which means to translate that logical color to a PHYSICAL color as used on the hardware The driver translates this by scanning the palette Bright blue is entry 0C in the standard Windows palette so that s what it returns Now you do a solid fill of some kind GDI hands the brush to the driver which then fills the rectangle with bytes of 0C The screen and device dependent bitmaps do not use 24 bit RGBs unless you re in a true color mode They use the screen format When you give CopyRect a bitmap filled with blue what you re actually giving it is a big rectangle filled with 0C bytes When you give it a bitmap filled with gray it sees a whole set of 08

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/1999/1112.txt (2016-02-14)
    Open archived version from archive


  • pascal delphi misc Robert Till heeft geschreven in bericht I m wondering how to plot an X Y graph using the Teechart that came with delphi 4 The demo says to add lines on FormCreate like this Series1 Add 25 Rome clTeeColor Series1 Add 50 New York clTeeColor etc This puts the cities on the X axis and the numbers on the Y axis I just want to graph numbers

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/1999/0503b.txt (2016-02-14)
    Open archived version from archive


  • Produced By Microsoft MimeOLE V5 00 2314 1300 NNTP Posting Host 203 39 181 43 Message ID X Trace dnews 993084440 203 39 181 43 20 Jun 2001 17 47 20 0700 Path dnews Xref dnews borland public delphi graphics 39925 This algorithm only works for concave polygons with no holes in them eg triangles quads etc const x 0 y 1 z 2 type TReal Single TVector array 0 3 of TReal function Vector ax ay az TReal TVector begin Result x ax Result y ay Result z az end function Subtract v1 v2 TVector TVector begin Result Vector v1 x v2 x v1 y v2 y v1 z v2 z end function Magnitude v TVector TReal begin Result Sqrt Sqr v x Sqr v y Sqr v z end function Cross u v TVector TVector begin Result X u y v z u z v y Result Y u z v x u x v z Result Z u x v y u y v x end function PolygonArea Polygon array of TVector TReal var i N Integer u v TVector begin Result 0 N High Polygon 1 for i 0 to N 3 do begin u VectorSubtract

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/2001/0620b.txt (2016-02-14)
    Open archived version from archive


  • the Earth to be spherical In this case the following Delphi code may be used use the function TriangleArea type PointType record px floating py floating pz floating end PointType LongLatType record Long floating East is positive Lat floating North is positive end LongLatType function TriangleArea LL1 LL2 LL3 LongLatType var Error boolean floating const EarthMeanRadiusKilometers 6371 0 RadiansPerDegree Pi 180 var a1 a2 a3 floating p1 p2 p3 PointType u1 u2 u3 PointType function ComputeDihedralAngles u1 u2 PointType floating forward function ComputeUnitNormals p1 p2 PointType PointType forward function ConvertLongLatToXYZ const LL LongLatType PointType forward function CosD x floating floating forward function SinD x floating floating forward function ComputeDihedralAngles u1 u2 PointType floating begin Result ArcCos u1 px u2 px u1 py u2 py u1 pz u2 pz end ComputeDihedralAngles function ComputeUnitNormals p1 p2 PointType PointType var a floating begin with Result do begin px p1 py p2 pz p1 pz p2 py py p1 pz p2 px p1 px p2 pz pz p1 px p2 py p1 py p2 px a 1 Sqrt Sqr px Sqr py Sqr pz px px a py py a pz pz a end end ComputeUnitNormals function ConvertLongLatToXYZ const LL LongLatType PointType begin with LL Result do begin px CosD Lat CosD Long py CosD Lat SinD Long pz SinD Lat end end ConvertLongLatToXYZ function CosD x floating floating begin Result Cos x RadiansPerDegree end CosD function SinD x floating floating begin Result Sin x RadiansPerDegree end SinD begin Result 0 Error true try p1 ConvertLongLatToXYZ LL1 p2 ConvertLongLatToXYZ LL2 p3 ConvertLongLatToXYZ LL3 u1 ComputeUnitNormals p2 p3 u2 ComputeUnitNormals p3 p1 u3 ComputeUnitNormals p1 p2 a1 ComputeDihedralAngles u2 u3 a2 ComputeDihedralAngles u3 u1 a3 ComputeDihedralAngles u1 u2 Result a1 a2 a3 Pi Sqr EarthMeanRadiusKilometers Error false except end end TriangleArea function L x y

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/2001/0423.txt (2016-02-14)
    Open archived version from archive


  • TempZ SinTable ATheta X CosTable ATheta Z X TempX Z TempZ end end end function FixIntDegrees const Angle Integer Integer var MakeZeroTo360 Boolean begin MakeZeroTo360 Angle 0 Result Angle mod 360 if Result 0 and MakeZeroTo360 then begin if Angle 0 then Result 360 else Result 360 end end function AngleD2 X Y Single Single var Q Integer begin if X 0 then begin if Y 0 then Result Pi 2 else begin if Y 0 then Result 0 else Result 3 Pi 2 end Exit end if Y 0 then begin if X 0 then Result 0 else Result Pi Exit end if X 0 then begin if Y 0 then Q 1 else Q 4 end else begin if Y 0 then with Result do begin X X M Y Y M Z Z M end end function MinAngleBetweenVectors const P Q R TZPoint Single var CosAngle Single V1 V2 TVector Mag1 Mag2 Single MagMult Single begin V1 DirectionVector P Q V2 DirectionVector P R Mag1 Magnitude V1 Mag2 Magnitude V2 MagMult Mag1 Mag2 if MagMult 0 then Result 0 else begin CosAngle Dot V1 V2 MagMult Round errors if CosAngle 1 then CosAngle 1 else if CosAngle 1 then CosAngle 1 ifdef ver80 Result ArcTan sqrt 1 sqr CosAngle CosAngle else Result ArcCos CosAngle endif end end function Cross const U V TVector TVector begin Result Vector U Y V Z U Z V Y U X V Z U Z V X U X V Y U Y V X end function Dot const U V TVector Single begin Result U X V X U Y V Y U Z V Z end function DistPoint2Line const Point LineP1 LineP2 TZPoint single var U TVector MU Single P TZPoint PQ TVector PQCrossU TVector begin Bottom of Page 715 in Swokowski Calculus 5th Edition U DirectionVector LineP1 LineP2 MU Magnitude U if MU 0 0000000001 then begin Result Magnitude DirectionVector Point LineP1 end else begin P LineP1 PQ DirectionVector P Point PQCrossU Cross PQ U try Result Magnitude PQCrossU MU except Result Magnitude DirectionVector Point LineP1 end end end function DistPoint2LineSegment const Point LineStart LineEnd TZPoint single Concept If the angle between either endpoint and the dot is greater than 90 then the dot is outside of the line segment I use a test and use the dot product because if the cos is negative then the angle is greater than 90 The dot product will be negative if the angle is greater than 90 See page 703 in Swokowski Calculus 5th Edition for dot product cos reason begin if Dot DirectionVector LineStart Point DirectionVector LineStart LineEnd 0 then Result Magnitude DirectionVector LineStart Point else if Dot DirectionVector LineEnd Point DirectionVector LineEnd LineStart 0 then Result Magnitude DirectionVector LineEnd Point else Result DistPoint2Line Point LineStart LineEnd end function MidPoint const P1 P2 TZPoint TZPoint const CHalf Single 0 5 begin Result X P1 X P2 X CHalf Result Y P1 Y P2 Y CHalf Result Z P1 Z

    Original URL path: http://www.efg2.com/Lab/Library/Delphi/Graphics/WilliamEgge_EMath.txt (2016-02-14)
    Open archived version from archive


  • and y to access fields PROCEDURE MapRealToPixel CONST x y TReal VAR i j INTEGER PROCEDURE MapPixelToReal CONST i j INTEGER VAR x y TReal PROCEDURE MoveTo CONST x y TReal PROCEDURE LineTo CONST x y TReal PROCEDURE Ellipse CONST x1 y1 x2 y2 TReal PROCEDURE Arc CONST x1 y1 x2 y2 x3 y3 x4 y4 TReal PROPERTY Canvas TCanvas READ FCanvas END FUNCTION RealPoint CONST aX aY DOUBLE TRealPoint FUNCTION RealRect CONST aLeft aTop aRight aBottom DOUBLE TRealRect IMPLEMENTATION USES SysUtils Exception TYPE ESimplePantographError CLASS Exception FUNCTION RealPoint CONST aX aY DOUBLE TRealPoint BEGIN WITH RESULT DO BEGIN X aX Y aY END END RealRect FUNCTION RealRect CONST aLeft aTop aRight aBottom DOUBLE TRealRect BEGIN WITH RESULT DO BEGIN Left aLeft Top aTop Switch top and bottom in world coordinates Right aRight Bottom aBottom Switch top and bottom in world coordinates END END RealRect CONSTRUCTOR TSimplePantograph Create Canvas TCanvas PixelRect TRect RealRect TRealRect BEGIN FCanvas Canvas FPixelRect PixelRect FRealRect RealRect FiDelta PixelRect Right PixelRect Left FjDelta PixelRect Bottom PixelRect Top FxDelta RealRect Right RealRect Left FyDelta RealRect Top RealRect Bottom IF FiDelta 0 OR FjDelta 0 THEN RAISE ESimplePantographError Create Invalid Rectangle IF FxDelta 0 0 OR FyDelta 0 0 THEN RAISE ESimplePantographError Create Invalid Real Rectangle FxDeltaOveriDelta FxDelta FiDelta FyDeltaOverjDelta FyDelta FjDelta FiDeltaOverxDelta FiDelta FxDelta FjDeltaOveryDelta FjDelta FyDelta END Create PROCEDURE TSimplePantograph MapRealToPixel CONST x y TReal VAR i j INTEGER BEGIN i ROUND FPixelRect Left x FRealRect Left FiDeltaOverxDelta j ROUND FPixelRect Top y FRealRect Top FjDeltaOveryDelta END MapRealToPixel PROCEDURE TSimplePantograph MapPixelToReal CONST i j INTEGER VAR x y TReal BEGIN x FRealRect Left i FPixelRect Left FxDeltaOveriDelta y FRealRect Top j FPixelRect Top FyDeltaOverjDelta END MapPixelToReal PROCEDURE TSimplePantograph MoveTo CONST x y TReal VAR i j INTEGER BEGIN MapRealToPixel x y i j FCanvas MoveTo i

    Original URL path: http://www.efg2.com/Lab/Library/Delphi/Graphics/MapWorldToPixel.pas.TXT (2016-02-14)
    Open archived version from archive


  • i 1 x Points i x sqr Points i 1 y Points i y if sc 0 then sc 1 step PointStep sc l 0 Application ProcessMessages repeat x Bezier l k Points i 1 x Bezier l k 1 Points i x Bezier l k 2 Points i 1 x Bezier l k 3 Points i 2 x y Bezier l k Points i 1 y Bezier l k 1 Points i y Bezier l k 2 Points i 1 y Bezier l k 3 Points i 2 y Point TXYPoint Create Point X X Point Y Y VCTemp Add Point l l step until l 1 End handle end of vector max 1 max if Closed then with Vc do begin sc sqrt sqr Points MaxPoint x Points MaxPoint 1 x sqr Points MaxPoint y Points MaxPoint 1 y if sc 0 then sc 1 step PointStep sc l 0 Repeat for j 0 to 3 do begin x Bezier l k Points MaxPoint 2 x Bezier l k 1 Points MaxPoint 1 x Bezier l k 2 Points MaxPoint x Bezier l k 3 Points 2 x y Bezier l k Points MaxPoint 2 y Bezier l k 1 Points MaxPoint 1 y Bezier l k 2 Points MaxPoint y Bezier l k 3 Points 2 y end Point TXYPoint Create Point X X Point Y Y VCTemp Add Point l l step until l 1 End Vc Clear Vc Copy VcTemp AppWin Status smooth polygons num after IntToStr VC MaxPoint VcTemp Destroy End TXYPoint and TXYPointList have definitions like this TXYPoint Class TObject private fX fY Double Public Constructor Create Destructor Destroy Override Function ToStr String Procedure Copy X TXYPoint Procedure Write Port TWriter Procedure Read Port TReader Procedure List Port TStrings Procedure Transform TRFM TXForm

    Original URL path: http://www.efg2.com/Lab/Library/UseNet/2001/0122.txt (2016-02-14)
    Open archived version from archive



  •