C51库函数积累
C51库函数积累:
(1)_chkfloat_:
函数定义:unsigned char _chkfloat_ ( float val); /* number to check */
函数功能:_chkfloat_函数检查浮点数 val 的类型。
返回值:_chkfloat_函数返回浮点数 val 的类型。
|
返回值 |
意义 |
|
0 |
标准浮点数 |
|
1 |
浮点0 |
|
2 |
+INF 正溢出 |
|
3 |
-INF 负溢出 |
|
4 |
NaN 非数 |
/*
本实验测试本征库中的_chkfloat_函数:
函数定义:unsigned char _chkfloat_(float val);
返回值:
Return Value Meaning
0 Standard floating-point number.
1 Floating-point value 0.
2 +INF (positive overflow).
3 -INF (negative overflow).
4 NaN (Not a Number) error status.
用P1指示返回值
*/
//函数测试:
#include <reg51.h>
#include <intrins.h>
unsigned ]={0xff,0xff,0xff,0xff};
void delay(unsigned int time)
{
while(time--);
}
void main()
{
P2=~_chkfloat_(1.2455); //Standard floating-point number.
delay();
P2=~_chkfloat_(0.00); //Floating-point value 0.
delay();
P2=~_chkfloat_(1000000000000000000000000000000000000000000000000000000000000000.0000000000); //+INF (positive overflow).
delay();
P2=~_chkfloat_(-1000000000000000000000000000000000000000000000000000000000000000.0000000000); //-INF (negative overflow).
delay();
P2=~_chkfloat_(*((float *)f)); //NaN (Not a Number) error status.
);
}
(2)_crol_:
函数定义:unsigned char _crol_ ( unsigned char c, unsigned char b); /* character to rotate left */
/* bit positions to rotate */
函数功能:_crol_函数将一个字节c循环左移b位。
返回值:_crol函数返回将c循环左移b位后的值。
/*
本实验测试本征库中的_crol_函数
函数定义:unsigned char _crol_(unsigned char c,unsigned char b);
返回值:_crol_函数返回将c循环左移b位后的值。
用P1指示返回值
*/
//函数测试:
#include <reg51.h>
#include <intrins.h>
void delay(unsigned int time)
{
while(time--);
}
void main()
{
unsigned char i;
i=;
P2=~0x01;
;i<;i++)
{
P2=_crol_(P2,);
delay();
}
);
}
(3)_cror_:
函数定义:unsigned char _cror_ ( unsigned char c, /* character to rotate right */
unsigned char b); /* bit positions to rotate */
函数功能:_cror_函数将一个字节c循环右移b位。
返回值:_cror_函数返回将c循环右移b位后的值。
/*
本实验测试本征库中的_cror_函数
函数定义:unsigned char _cror_(unsigned char c,unsigned char b);
返回值:_cror_函数返回将c循环右移b位后的值。
用P1指示返回值
*/
//函数测试:
#include <reg51.h>
#include <intrins.h>
void delay(unsigned int time)
{
while(time--);
}
void main()
{
unsigned char i;
i=;
P2=~0x80;
;i<;i++)
{
P2=_cror_(P2,);
delay();
}
);
}
(4)_getkey:
函数定义:char _getkey (void);
函数功能:等待接收串口的一个字节的数据。
返回值:从串口接收到的字节。
/*
本实验测试标准输入输出库中的_getkey函数
函数定义:char _getkey (void);
返回值:从串口接收到的字节。
用P1指示返回值
*/
//函数测试:
#include <reg51.h>
#include <stdio.h>
void delay(unsigned int time)
{
while(time--);
}
void UART_Init() /* 通讯有关参数初始化 */
{
PCON&=0x7f;
TH1=0xfd; /* T1 use sio */
TL1=0xfd; /* 选择通讯速率:0=1200,1=2400,2=4800,3=9600,4=19.2k */
/* T1 use sio */
TMOD=0x21; /* T1=MODE2,sio; T0=MODE1,16bit,use time */
PS=; /* SIO int high 优先级 */
EA=;
ET1=;
SM0=;
SM1=; /* SM0=0 SM1=1,mode1,10bit */
SM2=; /* data int,无校验(TB8=bit_duble偶) */
TR1=;
REN=;
RI=;
TI=;
ES=;
}
void main()
{
delay();
UART_Init();
P2=0xff;
)
{
P2=_getkey();
}
}
(5)_irol_:
函数定义:unsigned int _irol_ ( unsigned int i, /* integer to rotate left */
unsigned char b); /* bit positions to rotate */
函数功能:对整型数i循环左移b位。
返回值:i循环左移b位后的值。
/*
本实验测试本征库中的_irol_函数
函数定义:unsigned int _irol_(unsigned int i,unsigned char b);
返回值:i循环左移b位后的值。
*/
//函数测试:
#include <reg51.h>
#include <intrins.h>
unsigned int test;
void main()
{
test=0xa5a5;
test=_irol_(test,); //test=0x2d2d
);
}
(6)_iror_:
函数定义:unsigned int _iror_ ( unsigned int i, /* integer to rotate right */
unsigned char b); /* bit positions to rotate */
函数功能:对整型数i循环右移b位。
返回值:i循环右移b位后的值。
/*
本实验测试本征库中的_iror_函数
函数定义:unsigned int _iror_(unsigned int i,unsigned char b);
返回值:i循环右移b位后的值。
*/
//函数测试:
#include <reg51.h>
#include <intrins.h>
unsigned int test;
void main()
{
test=0xa5a5;
test=_iror_(test,); //test=0xb4b4
);
}
(7)_lrol_:
函数定义:unsigned long _lrol_ ( unsigned long i, /* 32-bit integer to rotate left */
unsigned char b); /* bit positions to rotate */
函数功能:对长整型数i循环左移b位。
返回值:i循环左移b位后的值。
/*
本实验测试本征库中的_lrol_函数
函数定义:unsigned long _lrol_(unsigned long i,unsigned char b);
返回值:i循环左移b位后的值。
*/
//函数测试:
#include <reg51.h>
#include <intrins.h>
unsigned long test;
void main()
{
test=0xa5a5a5a5;
test=_lrol_(test,); //test=0x2d2d2d2d
);
}
(8)_lror_:
函数定义:unsigned long _lror_ ( unsigned long i, /* 32-bit integer to rotate right */
unsigned char b); /* bit positions to rotate */
函数功能:对长整型数i循环右移b位。
返回值:i循环右移b位后的值。
/*
本实验测试本征库中的_lror_函数
函数定义:unsigned long _lror_(unsigned long i,unsigned char b);
返回值:i循环左移b位后的值。
*/
u函数测试:
#include <reg51.h>
#include <intrins.h>
nsigned long test;
void main()
{
test=0xa5a5a5a5;
test=_lror_(test,3); //test=0xb4b4b4b4
while(1);
}
(9)_nop_:
函数定义:void _nop_ (void);
函数功能:等同于汇编里的nop指令,用来实现一个机器周期的延时。
返回值:无
/*
本实验测试本征库中的_nop_函数
函数定义:void _nop_ (void);
返回值:无
*/
函数测试:
#include <reg51.h>
#include <intrins.h>
void main()
{
P1=0x00;
_nop_(); //如果是22.1184M的晶振,12分频后为1.8432M,机器周期为543ns
_nop_();
_nop_();
P1=0xff;
while(1);
}
(10)_pop_:
函数定义:void _pop_ ( unsigned char sfr); /* SFR to POP from the stack */
函数功能:在代码中插入一个POP指令,将一个SFR推出
返回值:无
函数测试:
#include <intrins.h>
#include <REG52.H>
sfr XXX = 0xFF;
void main (void)
{
_push_(XXX); //main函数就是一个栈,参数就是压栈进入,_push_用来将一个SFR压入此栈
XXX = 1; //对压入的SFR进行赋值
XXX = 2;
XXX = 3;
_pop_(XXX); //将SFR推出此栈,其值被释放
while (1);
}
(11)_push_:
函数定义:void _push_ ( unsigned char sfr); /* SFR to PUSH onto the stack */
函数功能:在代码中插入一个PUSH指令,将一个SFR压入
返回值:无
函数测试:
参照_pop_的测试程序。
(12)_testbit_:
函数定义:bit _testbit_ ( bit b); /* bit to test and clear */
函数功能:测试位b是1还是0
返回值:同b
/*
本实验测试本征库中的_testbit_函数
函数定义:bit _testbit_ (bit b);
返回值:同 b
*/
函数测试 :
#include <reg51.h>
#include <intrins.h>
void main()
{
bit test_flag;
test_flag=1;
if(_testbit_(test_flag))
P1=0xff;
else
P1=0x00;
while(1);
}
(13)_tolower:
函数定义:int _tolower ( int c); /* character to convert */
函数功能:将一个字符转换为相应的小写字符。
返回值:转换后的字符。
/*
本实验测试ctype库中的_tolower函数
函数定义:int _tolower (int c);
返回值:转换后的字符。
*/
函数测试 :
#include <reg51.h>
#include <ctype.h>
void main()
{
char c;
c=_tolower('A');
while(1);
}
(14)_toupper:
函数定义:int _toupper ( int c); /* character to convert */
函数功能:将一个字符转换为相应的大写字符。
返回值:转换后的字符。
/*
本实验测试ctype库中的_toupper函数
函数定义:int _toupper (int c);
返回值:转换后的字符。
*/
函数测试 :
#include <reg51.h>
#include <ctype.h>
void main()
{
char c;
c=_toupper('a');
while(1);
}
(15)abs:
函数定义:int abs ( int val); /* number to take absolute value of */
函数功能:取一个整型数的绝对值。
返回值:取绝对值后的值。
/*
本实验测试数学库中的abs函数
函数定义:int abs (int val);
返回值:取绝对值后的值。
*/
函数测试 :
#include <reg51.h>
#include <math.h>
void main()
{
int x,y;
x=-123;
y=abs(x); //y=123;
while(1);
}
(16)acos:
函数定义:float acos ( float x); /* number to calculate arc cosine of */
函数功能:取一个值反余弦值。
返回值:取反余弦后的值。
/*
本实验测试数学库中的acos函数
函数定义:float acos(float x);
返回值:取反余弦后的值。
*/
函数测试 :
#include <reg51.h>
#include <math.h>
void main()
{
float x,y;
x=0.500;
y=acos(x); // 60 degree 1.0472 rad
while(1);
}
(17)asin:
函数定义:float asin ( float x); /* number to calculate arc sine of */
函数功能:取一个值反正弦值。
返回值:取反正弦后的值。
/*
本实验测试数学库中的asin函数
函数定义:float asin(float x);
返回值:取反正弦后的值。
*/
函数测试 :
#include <reg51.h>
#include <math.h>
void main()
{
float x,y;
x=0.500;
y=asin(x); // 30 degree 0.523 rad
while(1);
}
(18)atan:
函数定义:float atan ( float x); /* number to calculate arc tangent of */
函数功能:取一个值反正切值。
返回值:取反正切后的值。
/*
本实验测试数学库中的atan函数
函数定义:float atan(float x);
返回值:取反正切后的值。
*/
函数测试 :
#include <reg51.h>
#include <math.h>
void main()
{
float x,y;
x=1.000;
y=atan(x); // 45 degree 0.7854 rad
while(1);
}
(19)atan2:
函数定义:float atan2 ( float y, /* denominator for arc tangent */
float x); /* numerator for arc tangent */
函数功能:取(x,y)确定的弧度的反正切值。
返回值:取(x,y)确定的弧度的反正切后的值。
/*
本实验测试数学库中的atan2函数
函数定义:float atan2(float y,float x);
返回值:取(x,y)确定的弧度的反正切后的值。
*/
函数测试 :
#include <reg51.h>
#include <math.h>
void main()
{
float x,y;
x=1.000;
y=1.000;
y=atan2(y,x); // 45 degree 0.7854 rad
while(1);
}
(20)atof:
函数定义:float atof ( char *string); /* string to convert */
函数功能:把一个字符串转为浮点数。
返回值:转换后的浮点数。
/*
本实验测试标准库中的atof函数
函数定义:float atof ( char *string);
返回值:转换后的浮点数。
*/
函数测试 :
#include <reg51.h>
#include <stdlib.h>
void main()
{
float f;
char s[]="12.8746";
f=atof(s); //f=12.8746
while(1);
}
(21)atoi:
函数定义:int atoi( char *string); /* string to convert */
函数功能:把一个字符串转为整型数。
返回值:转换后的整型数。
/*
本实验测试标准库中的atoi函数
函数定义:int atoi( char *string);
返回值:转换后的整型数。
*/
函数测试 :
#include <reg51.h>
#include <stdlib.h>
void main()
{
int i;
char s[]="1225";
i=atoi(s); //i=1225
while(1);
}
(22)atol:
函数定义:long atol( char *string); /* string to convert */
函数功能:把一个字符串转为长整型数。
返回值:转换后的长整型数。
/*
本实验测试标准库中的atol函数
函数定义:int atol( char *string);
返回值:转换后的长整型数。
*/
函数测试 :
#include <reg51.h>
#include <stdlib.h>
void main()
{
long l;
char s[]="1225578";
l=atol(s); //l=1225578
while(1);
}
(23)cabs:
函数定义:char cabs ( char val); /* number to take absolute value of */
函数功能:取一个char型值的绝对值。
返回值:取绝对值后的值。
/*
本实验测试标准库中的cabs函数
函数定义:char cabs(char val);
返回值:取绝对值后的值。。
*/
函数测试 :
#include <reg51.h>
#include <math.h>
void main()
{
char x;
char y;
x=-41;
y=cabs(x); //y=41
while(1);
}
(25)calloc:
函数定义:void xdata *calloc ( unsigned int num, /* number of items */
unsigned int len); /* length of each item */
函数功能:建立一个有num个元素的数组,每个元素有len个字节,并被初始化为0。数组长度为len*num个字节。
返回值:函数如果调用成功,返回一个指向数组首地址的指针,否则返回一个空指针。
函数测试 :
程序需要测试。
ceil:
函数定义:float ceil ( float val); /* number to calculate ceiling for */
函数功能:取比val大的最小的整数。
返回值:比val大的最小的整数。
/*
本实验测试标准库中的ceil函数
函数定义:float ceil(float val);
返回值:比val大的最小的整数。
*/
函数测试 :
#include <reg51.h>
#include <math.h>
void main()
{
float x,y;
x=34.234;
y=ceil(x); //y=35
while(1);
}
(26)cos:
函数定义:float cos ( float x); /* number to calculate cosine for */
函数功能:取x的余弦值。
返回值:x的余弦值。
/*
本实验测试标准库中的cos函数
函数定义:float cos(float x);
返回值:x的余弦值。
*/
函数测试 :
#include <reg51.h>
#include <math.h>
void main()
{
float x,y;
x=3.14159265;
y=cos(x); //y=-1
while(1);
}
(27)cosh:
函数定义:float cosh ( float x); /* value for hyperbolic cos function */
函数功能:取x的hyperbolic cos 值。
返回值:x的hyperbolic cos值。
/*
本实验测试标准库中的cosh函数
函数定义:float cosh(float x);
返回值:x的hyperbolic cos值。
*/
函数测试 :
#include <reg51.h>
#include <math.h>
void main()
{
float x,y;
x=3.14159265;
y=cosh(x); //y=11.59195
while(1);
}
(28)exp:
函数定义:float exp ( float x); /* power to use for ex function */
函数功能:取x的自然指数值。
返回值:x的自然指数值。
/*
本实验测试标准库中的exp函数
函数定义:float exp(float x);
返回值:x的自然指数值。
*/
函数测试 :
#include <reg51.h>
#include <math.h>
void main()
{
float x,y;
x=3.00;
y=exp(x); //y=20.08
while(1);
}
(29)fabs:
函数定义:float fabs ( float val); /* number to take absolute value of */
函数功能:取浮点val的绝对值。
返回值:浮点val的绝对值。
/*
本实验测试标准库中的fabs函数
函数定义:float fabs(float val);
返回值:浮点val的绝对值。
*/
函数测试 :
#include <reg51.h>
#include <math.h>
void main()
{
float x,y;
x=-3.00;
y=fabs(x); //y=3.00
while(1);
}
(30)floor:
函数定义:float floor ( float val); /* number to calculate floor for */
函数功能:取比val小的最大的整数。
返回值:比val小的最大的整数。
/*
本实验测试标准库中的floor函数
函数定义:float floor(float val);
返回值:比val小的最大的整数。
*/
函数测试 :
#include <reg51.h>
#include <math.h>
void main()
{
float x,y;
x=3.65;
y=floor(x); //y=3.00
while(1);
}
(31)fmod:
函数定义:float fmod ( float x, /* value to calculate modulo for */ float y); /* integer portion of modulo */
函数功能:对x取y的模。
返回值:x取y的模。
/*
本实验测试标准库中的fmod函数
函数定义:float fmod(float x,float y);
返回值:x取y的模。
*/
函数测试 :
#include <reg51.h>
#include <math.h>
void main()
{
float x,y;
x=3.65;
y=fmod(x,1.234); //y=1.182
while(1);
}
(32)free:
函数定义:void free ( void xdata *p); /* block to free */
函数功能:用来释放先前由calloc、malloc或realloc开辟的内存空间。
返回值:无。
/*
本实验测试标准库中的free函数
函数定义:void free(void xdata *p);
返回值:无
*/
函数测试 :
#include <reg51.h>
#include <stdlib.h>
void main()
{
void xdata *buf;
buf=malloc(1000);//在片外ram中开辟一块有1000个字节的空间。
if(buf!=NULL)
{
free(buf);//把由malloc开屏的空间释放掉。
}
while(1);
}
(33)getchar:
函数定义:char getchar (void);
函数功能:从串口读取一个字符。
返回值:从串口读到字符。
/*
本实验测试标准库中的getchar函数
函数定义:char getchar(void);
返回值:从串口读到字符。
*/
函数测试 :
#include <reg51.h>
#include <stdlib.h>
void main()
{
char c;
while((c=getchar())!=0x0a)
{
P1=c; //如果收到的字符不是回车,则将收到字符输出到P1口
}
//注:在程序开始要去串口进行初始,确定波特率。
while(1);
}
(34)gets:
函数定义:char *gets ( char *string, /* string to read */ int len); /* max characters to read */
函数功能:从串口读取一行字符串,len为能够读取的最大字节数。
返回值:从串口读到的字符串的指针。
/*
本实验测试标准输入输出库中的gets函数
函数定义:char *gets(char *string,int len);
返回值:从串口读到的字符串的指针。
*/
//函数测试 :
#include <reg51.h>
#include <stdio.h>
void main()
{
];
do
{
gets(buf,);
printf("Input string \"%s\"",buf);
}]!='\0');
//注:在程序开始要去串口进行初始,确定波特率。
);
}
(35)init_mempool:
函数定义:void init_mempool ( void xdata *p, /* start of memory pool */
unsigned int size); /* length of memory pool */
函数功能:用来初始化一个内容池,用calloc、free、malloc与realloc来进行管理。
返回值:无。
/*
本实验测试标准库中的init_mempool函数
函数定义:void init_mempool(void xdata *p,unsigned int size);
返回值:无。
*/
//函数测试 :
#include <reg51.h>
#include <stdlib.h>
unsigned char xdata malloc_mempool[0x1000];
void main()
{
int i;
void xdata *p;
init_mempool(&malloc_mempool,sizeof(malloc_mempool));
p=malloc();
;i<;i++)
{
((char *)p)[i]=i;
}
free(p);
);
}
(36)isalnum:
函数定义:bit isalnum ( char c); /* character to test */
函数功能:用来测试c是否是一个英文或数码字符('A'-'Z', 'a'-'z', or '0'-'9')。
返回值:如果c是一个英文或数码字符则返回1,否则为0。
/*
本实验测试ctype库中的isalnum函数
函数定义:bit isalnum(char c);
返回值:如果c是一个英文或数码字符则返回1,否则为0。
*/
//函数测试 :
#include <reg51.h>
#include <ctype.h>
void main()
{
unsigned char c=';';
unsigned char d='a';
unsigned char e='A';
unsigned ';
unsigned char result1,result2,result3,result4;
result1=isalnum(c); //result1=0
result2=isalnum(d); //result2=1
result3=isalnum(e); //result3=1
result4=isalnum(f); //result4=1
);
}
(37)isalpha:
函数定义:bit isalpha ( char c); /* character to test */
函数功能:用来测试c是否是一个英文字符('A'-'Z', 'a'-'z')。
返回值:如果c是一个英文字符则返回1,否则为0。
/*
本实验测试ctype库中的isalpha函数
函数定义:bit isalpha(char c);
返回值:如果c是一个英文字符则返回1,否则为0。
*/
//函数测试 :
#include <reg51.h>
#include <ctype.h>
void main()
{
unsigned char c=';';
unsigned char d='a';
unsigned char e='A';
unsigned ';
unsigned char result1,result2,result3,result4;
result1=isalpha(c); //result1=0
result2=isalpha(d); //result2=1
result3=isalpha(e); //result3=1
result4=isalpha(f); //result4=0
);
}
C51库函数积累的更多相关文章
- C51 库函数(1)
C-51软件包的库包含标准的应用程序,每个函数都在相应的头文件(.h)中有原型声明.如果使用库函数,必须在源程序中用预编译指令定义与该函数相关的头文件(包含了该函数的原型声明).例如: #includ ...
- Keil C51库函数原型列表
//1. CTYPE.H bit isalnum(char c): bit isalpha(char c): bit iscntrl(char c): bit isdigit(char c): bit ...
- C51 库函数
C-51软件包的库包含标准的应用程序,每个函数都在相应的头文件(.h)中有原型声明.如果使用库函数,必须在源程序中用预编译指令定义与该函数相关的头文件(包含了该函数的原型声明).例如:#include ...
- C51 库函数(3)
3.3 STRING.H:串函数 串函数通常将指针串作输入值.一个串就包括2个或多个字符.串结以空字符表示.在函数memcmp,memcpy,memchr,memccpy,memmove和memset ...
- C51 库函数(2)
3.2 STDIO.H:一般I/O函数 C51编译器包含字符I/O函数,它们通过处理器的串行接口操作,为支持其它I/O机制,只需修改getkey()和putchar()函数,其它所有I/O支持函数依赖 ...
- PHP库函数积累,持续更新
1. gethostbyname($server_name) 作用:根据给定的域名获取对应的ip 示例:echo gethostbyname("www.baidu.com"); 2 ...
- Keil C51编译及连接技术
主要介绍Keil C51的预处理方法如宏定义.常用的预处理指令及文件包含指令,C51编译库的选择及代码优化原理,C51与汇编混合编程的方法与实现以及超过64KB空间的地址分页方法的C51实现. 教学目 ...
- keil c51笔记
第一章 Keil C51开发系统基本知识 第一节 系统概述 Keil C51是美国Keil Software公司出品的51系列兼容单片机C语言软件开发系统,与汇编相比,C语言在功能上.结构性.可读性. ...
- [转]keil使用详解
第一节 系统概述 Keil C51是美国Keil Software公司出品的51系列兼容单片机C语言软件开发系统,与汇编相比,C语言在功能上.结构性.可读性.可维护性上有明显的优势,因而易学易用.用过 ...
随机推荐
- linux补包
1.挂载文件export LANG=Cmkdir -p /media/cdrommount /dev/cdrom /media/cdrommount /dev/hdc /media/cdrommoun ...
- php中的后期静态绑定("Late Static Binding")
在我们以往中,在类中使用self关键字的时候都是指向了被调用方法定义时的类,而非原始的调用类. 例如: class Animal{ static $IQ_lv_avg = 1; public stat ...
- ASP.NET页面同时发起多个ajax请求,出现阻塞情况
解决办法:假如页面对Session只读不写,可以在页面的开头加上EnableSessionState="ReadOnly".
- JAVA-1-学习历程1:基础知识1
前言:此文属于个人学习中总结记录的较重要的知识点,分享一下.望对刚開始学习的人有点用. 视频04 语句.函数.数组 1.函数的重载 2.数组内存空间的划分 栈.堆 视频05 数组 1. ...
- 二叉树(二叉链表实现)JAVA代码
publicclassTest{ publicstaticvoid main(String[] args){ char[] ch =newchar[]{'A','B ...
- LVM命令摘要
命令 描述 物理卷(PV) pvcreate 创建LVM磁盘 #pvcreate /dev/sdb pvdisplay 显示卷组中的物理卷信息 pvchange 设置PV的性能,允许或拒绝 ...
- NYOJ528 找球号(三)位运算
找球号(三) 时间限制:2000 ms | 内存限制:3000 KB 难度:2 描述 xiaod现在正在某个球场负责网球的管理工作.为了方便管理,他把每个球都编了号,且每个编号的球的总个数都是 ...
- hibernate01ORM的引入
/**01.之前的方式 在while()中书写的 * int id = rs.getInt("gradeid"); String gradeName = rs.getString( ...
- 用timer控件实现sleep效果
有时候我们需要代码延迟执行,这就需要用到Thread.Sleep()这个方法,但这个方法在主线程使用时会造成界面假死.使用timer控件既能达到代码延迟执行的效果,又不会有假死的困扰. 假设我们需要在 ...
- C#获取显示器宽度高度,桌面宽度高度等
1.C#获取显示器宽度高度,桌面宽度高度等 //获取当前显示器的宽度和高度 int width = Screen.PrimaryScreen.Bounds.Width; int height = Sc ...