程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> VC >> vc教程 >> TRichEdit右鍵滾屏代碼

TRichEdit右鍵滾屏代碼

編輯:vc教程

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;
  }
}

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved