⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit1.cpp

📁 与Action相结合,可以解决中文件显示乱码
💻 CPP
字号:
/*=============================================================================}
{ Demo of basic using of hypertext                                             }
{ In this demo were modified styles: RVStyle1->TextStyles>[4] and              }
{ RVStyle->TextStyles->Items[5]                                                }
{ Setting RVStyle->TextStyles->Items[i].Jump to True turns this text style into}
{ hypertext style.                                                             }
{ Properties of text styles affecting hypertext appearance:                    }
{ - HoverColor (color of hypertext under mouse (clNone for not changing)       }
{ - HoverBackColor (color of hypertext background under mouse (clNone for      }
{   transparent)                                                               }
{ - JumpCursor                                                                 }
{------------------------------------------------------------------------------}
{ Key events and properties:                                                   }
{ - OnJump, OnRVMouseMove                                                      }
{ - FirstJumpNo                                                                }
{=============================================================================*/
#include <vcl\vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma link "RichView"
#pragma link "RVScroll"
#pragma link "RVStyle"
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
  // RVStyle1->TextStyles->Items[4].Jump == RVStyle1->TextStyles->Items[5].Jump == True
  // This causes these styles to represent hypertext
  RichView1->AddNL("Hypertext",1,1);
  RichView1->AddNL("Some text styles can be chosen as hypertext styles. ",0,0);
  RichView1->AddNL("Like this one.",4,-1);
  RichView1->AddNL(" You can have as many hypertext styles as you want.  ",0,-1);
  RichView1->AddNL("Here is one more.",5,-1);
  RichView1->Format();

  /*
    The basic method to use hypertext is "hypertext IDs".
    All hypertext jumps are numbered sequentially (0,1,...) from top of
    document to bottom. These numbers are called "hypertext IDs".
    Hypertext id is passed in OnJump and OnRVMouseMove events.

    More correct, jumps are numbered as FirstJumpNo, FirstJumpNo+1,
    FirstJumpNo+2,...
    FirstJumpNo is a property of RichView, 0 by default
  */
}
//---------------------------------------------------------------------------
void __fastcall TForm1::RichView1Jump(TObject *Sender, int id)
{
  Panel1->Caption = AnsiString("Clicked: ")+IntToStr(id);    
}
//---------------------------------------------------------------------------
void __fastcall TForm1::RichView1RVMouseMove(TObject *Sender, int id)
{
  // id==-1 when mouse leaves hypertext jump area
  if (id!=-1)
    Label1->Caption = IntToStr(id);
  else
    Label1->Caption = "---";
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -