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

📄 macro.lib

📁 学分管理系统的分析
💻 LIB
📖 第 1 页 / 共 2 页
字号:
      endm
;===================================================


;判断鼠标的位置,若在,则CF=1,若不在,则CF=0
ishere	macro  x1,y1,x2,y2
    local exit
    local nohere
    push ax
    mov  ax,x1
    cmp  mousex,ax
    jl  nohere
    mov  ax, x2
    cmp  mousex,ax
    jg  nohere
    mov  ax,y1
    cmp  mousey,ax
    jl  nohere
    mov  ax, y2
    cmp  mousey,ax
    jg  nohere
    stc
    jmp  exit

nohere:    clc
exit: pop  ax
     endm
    
;判断鼠标左键按下,若按下,CF=1,若未按下,CF=0
isleftkey  macro  
	local nodown
	local exit
	push ax
	push bx
	mov  ax, 0003h
	int  33h
	and  bx, 1
	or   bx, bx
	jz   nodown
	stc
	jmp  exit
nodown: clc
exit:   pop  bx
	pop  ax
	endm	
;检测鼠标右健	
isrightkey  macro
	local nodown
	local exit
	push ax
	push bx
	mov  ax, 0003h
	int  33h
	and  bx, 10b
	or   bx, bx
	jz   nodown
	stc
	jmp  exit
nodown: clc
exit:   pop  bx
	pop  ax
	endm	
	
;检测鼠标是否双击
isdoublehit  macro
;	local exit
;	push  ax
;	push  bx
;	mov   ax,0005h
;	mov   bx,0
;	int   33h
;;	cmp   bx, 2
;	jne    nodouble
;	stc
;	jmp   exit
;nodouble:
;	clc
exit:	pop   bx	
	pop   ax
	endm			    
;===================================================

clearscreen macro color
            local lopa
            push cx
            mov  cx,600
            mov  bp,color
lopa:       setxy 0,si,799,si
            call  drawline
            loop  lopa
            pop   cx
            endm
         
      
;向下滚屏      
downscreen macro x1,y1,x2,y2,lines
           mov ah,7
           mov al,lines
           mov ch,x1
           mov cl,y1
           mov dh,x2
           mov dl,y2
           mov bh,0ffh
           int 10h
           endm
;向上滚屏
upscreen   macro x1,y1,x2,y2,lines
           mov ah,6
           mov al,lines
           mov ch,x1
           mov cl,y1
           mov dh,x2
           mov dl,y2
           mov bh,0ffh
           int 10h
           endm
           
           
;画凸起来的框
up_button   macro  x1,y1,x2,y2
	  mov  ax,y1
	  mov  bx,x1
	  mov  cx,x2
	  sub  cx,bx
	  inc  cx
	  mov  bp,0ffffh
	  call horizontal
	  inc  ax
	  call horizontal
	  mov  ax,y2
	  mov  bp,0h
	  call horizontal
	  dec  ax
	  call horizontal
	  
	  
	  mov  ax,y1
	  mov  bx,x1
	  mov  cx,y2
	  sub  cx,ax          
	  inc  cx
	  mov  bp,0ffffh
	  call vertical
	  inc  bx
	  call vertical
	  mov  bx,x2
	  mov  bp,0h
	  call vertical
	  dec  bx
	  call vertical
	  endm
down_button  macro  x1,y1,x2,y2
	  mov  ax,y1
	  mov  bx,x1
	  mov  cx,x2
	  sub  cx,bx
	  inc  cx
	  mov  bp,0h
	  call horizontal
	  inc  ax
	  call horizontal
	  mov  ax,y2
	  mov  bp,0ffffh
	  call horizontal
	  dec  ax
	  call horizontal
	  
	  mov  ax,y1
	  mov  bx,x1
	  mov  cx,y2
	  sub  cx,ax          
	  inc  cx
	  mov  bp,0h
	  call vertical
	  inc  bx
	  call vertical
	  mov  bx,x2
	  mov  bp,0ffffh
	  call vertical
	  dec  bx
	  call vertical
	  endm

	  	  
;===========================================================           
;画表格di为列数,si指向列转换表
drawtab   macro x1,y1,x2,y2
          local lopa
          local lopb
          pusha
          push x1
lopa:     setxy x1,y1,x1,y2               ;画竖线
          mov bp,0h
          call drawline
          mov ax,[si]
          add x1,ax
          inc si
          inc si
          dec di
          jnz lopa
          pop x1
          mov ax,y2
          sub ax,y1
          mov cl,32
          div cl
          mov di,ax
          inc di
          push y1
lopb:     setxy x1,y1,x2,y1              ;画横线
          mov bp,0h
          call drawline
          add y1,32
          dec di
          jnz lopb
          pop y1
          popa
	  endm
;===========================================================           
;修改输入的宏
update   macro  x1,y1,x2,y2,highlight,subprocess,nextflag
	local  next1
	local  next2
	ishere	  x1,y1,x2,y2
	jnc  next2                  ;鼠标不在该区域
	cmp  highlight,0            ;鼠标在该区域,看是否高亮
	jne  next1                  ;高亮,则检查是否左键按下
	mov  busy,1                 ;暂停鼠标显示,点亮菜单
	rect  x1,y1,x2,y2,<RGB 0,0,255>
	mov  highlight,1
	mov  busy,0
next1:	isleftkey
	jnc  nextflag
	background  x1,y1,x2,y2,<RGB 0,0,0>
	mov  si, store_si
	subprocess                   ;修改输入的宏	
	mov  highlight,0
	
next2:	cmp highlight,1
	jne nextflag
	mov  busy,1
	call restore_m
	rect  x1,y1,x2,y2,    <RGB 0,0,0>
	call store_m
	
	mov  busy,0
	mov  highlight,0
	endm
;显示按钮的宏
button  macro  x1,y1,x2,y2,highlight,subprocess,nextflag
	local  next1
	local  next2
	ishere	  x1,y1,x2,y2
	jnc  next2                  ;鼠标不在该区域
	cmp  highlight,0            ;鼠标在该区域,看是否高亮
	jne  next1                  ;高亮,则检查是否左键按下
	mov  busy,1                 ;暂停鼠标显示,点亮菜单
	up_button x1,y1,x2,y2
	mov  highlight,1
	mov  busy,0
next1:	isleftkey
	jnc  nextflag
	down_button x1,y1,x2,y2
	delay 30
	rect  x1,y1,x2,y2,<RGB	2,140,220>
	rect  %x1+1,%y1+1,%x2-1,%y2-1,<RGB 2,140,220>
	subprocess                   ;修改输入的宏	
	mov  highlight,0
	
next2:	cmp highlight,1
	jne nextflag
	mov  busy,1
	call restore_m
	rect  x1,y1,x2,y2,    <RGB 2,140,220>
	rect  %x1+1,%y1+1,%x2-1,%y2-1,<RGB 2,140,220>
	call store_m
	
	mov  busy,0
	mov  highlight,0
	endm
;============================================================


;显示的菜单宏
submenu   macro  x1,y1,x2,y2,highlight,string,help,subprocess,nextflag,BACKFLAG
	local  next1
	local  next2
	
	ishere	  x1,y1,x2,y2
	jnc  next2                  ;鼠标不在该区域
	cmp  highlight,0            ;鼠标在该区域,看是否高亮
	jne  next1                  ;高亮,则检查是否左键按下
	mov  busy,1                 ;暂停鼠标显示,点亮菜单
	box_jiao  x1,y1,x2,y2,<RGB 255,0,0>
	out_hz	  %x1+80,%y1+5,string, <RGB 255,255,255>
	mov  highlight,1
	quick_zi	110,578,help,<RGB 0,255,0>
	call  beep
	mov  busy,0
next1:	isleftkey
	jnc  nextflag
	call subprocess 
	
	mov  highlight,0
	MOV  AL,BACKFLAG
	.BREAK	   .IF	AL == 1
next2:	cmp highlight,1
	jne nextflag
	mov  busy,1
	call restore_m
	box_jiao  x1,y1,x2,y2,    <RGB 125,0,32>
	out_hz	  %x1+80,%y1+5,string, <RGB	80,150,30>
	call store_m
	background  100,575,700,595,<RGB 0,0,0>
	mov  busy,0
	mov  highlight,0
	endm
		
;=======================================================

;显示的排序横菜单宏
submenu_h   macro  x1,y1,x2,y2,highlight,string,help,subprocess,nextflag,BACKFLAG
	local  next1
	local  next2
	
	ishere	  x1,y1,x2,y2
	jnc  next2                  ;鼠标不在该区域
	cmp  highlight,0            ;鼠标在该区域,看是否高亮
	jne  next1                  ;高亮,则检查是否左键按下
	mov  busy,1                 ;暂停鼠标显示,点亮菜单
	box_jiao  x1,y1,x2,y2,<RGB 255,0,0>
	out_hz	  %x1+20,%y1+2,string, <RGB 255,255,255>
	mov  highlight,1
	quick_zi	110,578,help,<RGB 0,255,0>
	call  beep
	mov  busy,0
next1:	isleftkey
	jnc  nextflag
	call subprocess 
	
	mov  highlight,0
	MOV  AL,BACKFLAG
	.BREAK	   .IF	AL == 1
next2:	cmp highlight,1
	jne nextflag
	mov  busy,1
	call restore_m
	box_jiao  x1,y1,x2,y2,    <RGB 125,0,32>
	out_hz	  %x1+20,%y1+2,string, <RGB	80,150,30>
	call store_m
	background  100,575,700,595,<RGB 0,0,0>
	mov  busy,0
	mov  highlight,0
	endm
		
;=======================================================
;向用户报告相应的信息,提示等
message_box macro   x1,y1,x2,y2,message,textcolor,clearscreen
	local  again
	setxy 300,100,500,400
	call  clearscreen_out
	box_jiao  x1,y1,x2,y2,<RGB 128,128,128>
	box_jiao  %x1+3,%y1+3,%x2-3,%y2-3,<RGB 232,23,23>
	quick_zi  %x1+20,%y1+45,message, <RGB 0,255,0>

again:  
	isleftkey
	jnc  again
	setxy  110, 60, 770,500	
	call   clearscreen	
	endm
;接受用户输入的对话框
dialouge  macro   
	box_jiao   150,150,550,450,<RGB 128,128,128>
	box_jiao   153,153,547,447,<RGB 232,23, 23>
	submenu    160,480,260,510,yesflag,yes,yeshelp,<mov  value , 1>,next1,1
	submenu    
	ENDM
;=============================================
;控制翻页按钮
submenu_p   macro  x1,y1,x2,y2,highlight,string,help,subprocess,nextflag
	local  next1
	local  next2
	ishere	  x1,y1,x2,y2
	jnc  next2                  ;鼠标不在该区域
	cmp  highlight,0            ;鼠标在该区域,看是否高亮
	jne  next1                  ;高亮,则检查是否左键按下
	mov  busy,1                 ;暂停鼠标显示,点亮菜单
	box_jiao  x1,y1,x2,y2,<RGB 255,0,0>
	out_asc	  %x1+5,%y1+2,string, <RGB 255,255,255>
	mov  highlight,1
	quick_zi	110,578,help,<RGB 0,255,0>
	call  beep
	mov  busy,0
next1:	isleftkey
	jnc  nextflag
	call subprocess 
	
	mov  highlight,0
	
next2:	cmp highlight,1
	jne nextflag
	mov  busy,1
	call restore_m
	box_jiao  x1,y1,x2,y2,    <RGB 125,0,32>
	out_asc	  %x1+5,%y1+2,string, <RGB	80,150,30>
	call store_m
	background  100,575,700,595,<RGB 0,0,0>
	mov  busy,0
	mov  highlight,0
	endm
showpagebutton  macro  x1,y1,x2,y2,string
	box_jiao  x1,y1,x2,y2,<RGB 255,0,0>
	out_asc	  %x1+5,%y1+2,string, <RGB 255,255,255>
	endm	

⌨️ 快捷键说明

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