Unit1.cpp
上传用户:daoqigc
上传日期:2021-04-20
资源大小:2795k
文件大小:3k
源码类别:

RichEdit

开发平台:

Delphi

  1. /*=============================================================================}
  2. { Example of new item type for RichView:                                       }
  3. { - TRVBlendBitmapItemInfo                                                     }
  4. {   (semi-transparent image)                                                   }
  5. { - TRVHotBlendBitmapItemInfo                                                  }
  6. {   (semi-transparent image - hypertext link)                                  }
  7. {------------------------------------------------------------------------------}
  8. { (c) 2001 by Sergey Tkachenko (svt@trichview.com)                             }
  9. { http://www.trichview.com                                                     }
  10. { http://www.richedit.com                                                      }
  11. {=============================================================================*/
  12. #include <vcl.h>
  13. #include <shellapi.h>
  14. #pragma hdrstop
  15. #include "Unit1.h"
  16. #include "RVBlendBitmap.hpp"
  17. //---------------------------------------------------------------------------
  18. #pragma package(smart_init)
  19. #pragma link "RichView"
  20. #pragma link "RVScroll"
  21. #pragma link "RVStyle"
  22. #pragma resource "*.dfm"
  23. TForm1 *Form1;
  24. //---------------------------------------------------------------------------
  25. __fastcall TForm1::TForm1(TComponent* Owner)
  26.     : TForm(Owner)
  27. {
  28. }
  29. //---------------------------------------------------------------------------
  30. void __fastcall TForm1::FormCreate(TObject *Sender)
  31. {
  32.  // Note: not very fast drawing, so do not use for large images
  33.  // Note: you can save RVF documents with semitransparent images
  34.  //       (RVF reader must have RVBlendBMP.pas unit in order to
  35.  //       load such files)
  36.   RichView1->AddBreak();
  37.   RichView1->AddNL("Example of Semi-transparent Image",1,1);
  38.   RichView1->AddBreak();
  39.   int i;
  40.   for (i=0; i<=10; i++)
  41.     RichView1->AddNL("some text",0,0);
  42.   Graphics::TBitmap* bmp = new Graphics::TBitmap;
  43.   bmp->Assign(Image1->Picture->Bitmap);
  44.   TRVHotBlendBitmapItemInfo* item = new TRVHotBlendBitmapItemInfo(RichView1->RVData, bmp, rvvaBaseline);
  45.   item->Transparency = 100;
  46.   item->HotTransparency = 0;
  47.   // 0 - no transparency,
  48.   // 255 - fully transparent (invisible)
  49.   item->ParaNo = 1;
  50.   RichView1->AddItem("", item);
  51.   RichView1->AddNL("games at www.sapphiregames.com",4,1);
  52.   for (i=0; i<=10; i++)
  53.     RichView1->AddNL("some text",0,0);
  54.   bmp = new Graphics::TBitmap;
  55.   bmp->Assign(Image2->Picture->Bitmap);
  56.   item = new TRVHotBlendBitmapItemInfo(RichView1->RVData, bmp, rvvaBaseline);
  57.   item->Transparency = 200;
  58.   item->HotTransparency = 100;
  59.   item->ParaNo = 1;
  60.   RichView1->AddItem("", item);
  61.   RichView1->AddNL("games at www.sapphiregames.com",4,1);
  62.   for (i=0; i<=10; i++)
  63.     RichView1->AddNL("some text",0,0);
  64.   RichView1->Format();
  65. }
  66. //---------------------------------------------------------------------------
  67. void __fastcall TForm1::RichView1Jump(TObject *Sender, int id)
  68. {
  69.   ShellExecute(0, "open", "http://www.sapphiregames.com", NULL, NULL, SW_SHOW);
  70. }
  71. //---------------------------------------------------------------------------