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

📄 mvscroll.cpp

📁 飞虹 vision仿windows开发
💻 CPP
字号:
#include"\sunshine\include\mvscroll.h"
#include"\sunshine\include\mapp.h"
#include"\sunshine\include\define.h"
#include"\sunshine\include\app.h"
#define SW 14
#define HH 15
VMPButton::VMPButton(int x,int y,char *filename)
 : MPButton(x,y,HH,HH,filename,"BUT","NOS",0)
 {
 }
MVScroll::MVScroll(int xx,int yy,int l,int inc1,int pageinc1,
 char *idname):MObj(xx,yy,HH,l,idname)
  {
	button1= new VMPButton(x(),y(),"VS1.bmp");
	button2= new VMPButton(x(),y()+h()-1-SW,"VS2.bmp");
	count=0;
	inc=inc1;pageinc=pageinc1;
	maxcount=0;
	while((y()+HH+maxcount*inc+SW)<(y()+h()-1-HH)) maxcount++;
	firstrun=1;
  }
 MVScroll::~MVScroll()
  {
	delete button1;
	delete button2;
  }
void MVScroll::UnFocus()
  {
	Mouse am(1);
	setcolor(BLACK);
	rectangle(x(),y(),x()+w()-1,y()+h()-1);
	setfillstyle(SOLID_FILL,LIGHTGRAY);
	bar(x()+1,y()+1,x()+w()-2,y()+h()-2);
	button1->UnFocus();button2->UnFocus();
	SetSumble(x()+1,y()+button1->h());
  }
void MVScroll::SetSumble(int xx,int yy)
 {
	MBmp ab("sumb.bmp");
	setfillstyle(SOLID_FILL,LIGHTGRAY);
	bar(x()+1,y()+HH,x()+w()-2,y()+h()-HH);
	ab.BitBlt(xx,yy);
 }
void MVScroll::GetFocus()
 {
  Mouse am(1);
  int sl=y()+HH+count*inc;
  if(count==maxcount) sl=y()+h()-HH-SW;
  SetSumble(x()+1,sl);
 }
int MVScroll::F(char *idname)
 {
  if(!idname) return 1;
  (MApp::Application->GetObj(idname)).TransMes(CLICK,NULL,(long)(count/maxcount*100));
  return 1;
 }
int MVScroll::Process()
 {
  Mouse am;
  if(firstrun){UnFocus();firstrun=0;return 1;}
  if(!am.lp()) return 1;
  if(am.x()<x()||am.y()<y()||am.x()>(x()+w()-1)||
	  am.y()>(y()+h()-1)) return 1;
  if(button1->Process()==CLICK)
	{
	 count--;
	 if(count<0) count=0;
	 GetFocus();
	 return F();
	}
  if(button2->Process()==CLICK)
	{
	 count++;
	 if(count>maxcount) count=maxcount;
	 GetFocus();
	 return F();
	}
  if(am.y()>(y()+HH)&&am.y()<(y()+HH+count*inc))
	{
	 count-=pageinc;
	 if(count<0) count=0;
	 GetFocus();
	 while(am.lp()) am.Reset();
	 return F();
	}
  if(am.y()>(y()+HH+count*inc+SW)&&am.y()<(y()+h()-1-HH))
	{
	 count+=pageinc;
	 if(count>maxcount) count=maxcount;
	 GetFocus();
	 while(am.lp()) am.Reset();
	 return F();
	}
  return 1;
 }

⌨️ 快捷键说明

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