User (Legacy) Posted December 12, 2001 Report Share Posted December 12, 2001 Symptom: AnnArrow::Height seems to shift the position of the arrow, not just the size. Code sample is at bottom. Please reply to group and cc: erwilleke@sep.com Thank you for any assistance. Investigation Details: I'm implementing a method to draw an arbitrary line on the chart using an AnnArrow. When I pass values indicating a horizontal line, the method works correctly. ex: drawLine( 0.0, 0.0, 8.0, 0.0 ); When I pass values for a non-horizontal line, the line displays at an incorrect location. ex: drawLine( 1.0, 0.0, 1.0, 7.0 ); I played around with the settings and discovered that whenever I passed a non-zero value to thisLine->Height, the entire line was being offset rather than just changing the position. When I played around with the code and did the following: thisLine->Height = 0; thisLine->Width = 100; the chart displayed as expected with a horizontal line at the start location. However, when I wrote: thisLine->Height = 100; thisLine->Width = 100; I expected a diagonal line dropping from the place I pointed with (Left, Top), but the line did not display. Switching to thisLine->Height = -100; thisLine->Width = 100; I found the diagonal line shifted to the top of my chart, displaying with the proper height and width, but moved to the wrong location. Advise please. Joel had my heart up with his question of a few days ago, but not quite what I need. void MyObj::drawLine( float x1, float y1, float x2, float y2 ) { IAnnArrowPtr thisLine = m_pAnnList->Add((short) OBJECT_TYPE_ARROW ); long px1, py1, px2, py2; // pixel points thisLine->HeadStyle = ARROW_NONE; thisLine->TailStyle = ARROW_NONE; // locate the screen coordinates m_pFX->ValueToPixel( x1, y1, &px1, &py1, AXIS_Y ); m_pFX->ValueToPixel( x2, y2, &px2, &py2, AXIS_Y ); // move it to the proper place thisLine->Height = py2 - py1; thisLine->Width = px2 - px1; thisLine->Left = px1; thisLine->Top = py1; // make it red thisLine->Color = RGB( 0xFF, 0, 0 ); thisLine->Refresh( VARIANT_FALSE ); } Link to comment Share on other sites More sharing options...
User (Legacy) Posted December 17, 2001 Author Report Share Posted December 17, 2001 SoftwareFX Support, Have you had a chance to begin looking at this issue? I'm curious if it's a mistake in my implementation or if it is a bug, and if there's a workaround or not. Thanks, Eric Link to comment Share on other sites More sharing options...
Software FX Posted December 19, 2001 Report Share Posted December 19, 2001 I'm having problems reproducing your situation, I've created an arrow and set Width and Height to 100 and I get a diagonal line (as expected). I think maybe you are working with attached objects (default) and then changing the chart scale from the time you set the Width and Height to the time you see the object. If you want your objects to be in absolute pixel position regardless of chart scale, you must set the objects to ATTACH_NONE using the Attach method. -- FP Software FX, Inc. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.