trichview.com

trichview.support




Re: Image positions


Return to index


Author

Message

Sergey Tkachenko

Posted: 05/08/2005 22:54:10


The code is below.

See also my answer in "Counting images in TRichViewEdit"



void __fastcall TForm1::EnumPicsProc (TCustomRVData* RVData, int ItemNo,

  int&UserData1, const AnsiString UserData2, bool&ContinueEnum)

{

  if (RVData->GetItemStyle(ItemNo)==rvsPicture ||

      RVData->GetItemStyle(ItemNo)==rvsHotPicture)

  {

    int X, Y, AX, AY;

    ((TCustomRVFormattedData*)RVData)->GetOriginEx(AX, AY);

    ((TCustomRVFormattedData*)RVData)->GetItemCoords(ItemNo, X, Y);

    X+=AX;

    Y+=AY;

    // now X and Y - coordinates relative to the top left corner of the

document

    // converting them to client coordinates:

    X-=RichViewEdit1->HScrollPos;

    Y-=RichViewEdit1->VScrollPos*RichViewEdit1->VSmallStep;

    // <do something here>

  }

  ContinueEnum=true;

}


void __fastcall TForm1::Button1Click(TObject *Sender)

{

  int v;

  RichViewEdit1->RVData->EnumItems(EnumPicsProc, v, "");

}





Powered by ABC Amber Outlook Express Converter