WEB开发网
开发学院软件开发C++ TRichEdit右键滚屏代码 阅读

TRichEdit右键滚屏代码

 2008-03-08 12:57:41 来源:WEB开发网   
核心提示:void __fastcall TMainForm::RichEditMouseMove(TObject *Sender,TShiftState Shift, int X, int Y){if(RightButtonFlag) { if(RightY>(Y+8)) { RightY=Y; SendMes

  void __fastcall TMainForm::RichEditMouseMove(TObject *Sender,TShiftState Shift, int X, int Y)
{
if(RightButtonFlag)
  {
  if(RightY>(Y+8))
   {
   RightY=Y;
   SendMessage(RichEdit->Handle, EM_SCROLL, SB_LINEDOWN, 0);
   }
  else if(RightY<(Y-8))
   {
   RightY=Y;
   SendMessage(RichEdit->Handle, EM_SCROLL, SB_LINEUP, 0);
   }
  RichEditDragFlag=true;
  }
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::RichEditMouseDown(TObject *Sender,TMouseButton Button, TShiftState Shift, int X, int Y)
{
if(Button==mbRight)
  {
  RightButtonFlag=true;
  Screen->Cursor=crHandPoint;
  RightX=X;
  RightY=Y;
  SetCapture(RichEdit->Handle);
  }
else
  RightButtonFlag=false;
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::RichEditMouseUp(TObject *Sender,TMouseButton Button, TShiftState Shift, int X, int Y)
{
if(RightButtonFlag)
  ReleaseCapture();
if(RichEditDragFlag)
  {
  RightButtonFlag=false;
  RichEditDragFlag=false;
  Screen->Cursor=crDefault;
  RichEdit->PopupMenu=NULL;
  }
else
  {
  RichEdit->PopupMenu=RichEditPopupMenu;
  }
}

Tags:TRichEdit 代码

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接