C#基本语法第一天
1,软件
系统软件:windows、Android、IOS…
应用软件:QQ、微信…
2,核心工具
计算机语言:人类和机器之间的交流。
语言:
机器语言:二进制语言(0/1)
汇编语言
高级语言:C语言、C++、C#
3,客户端程序、浏览器端程序
C/S:Client Server 客户端程序,各种APP,产生一个可执行程序
B/S:Browser Server 浏览器端程序,各种网站网页
4,.NET平台:
是微软搭建的技术平台,提供了运行所必须的环境,.NET Framework类库以及CLR(公共语言运行时)。
5,常用的快捷键
win+r:开启运行窗口
win+m:最小化
win+l:锁屏
win+e:打开我的电脑
win+d:显示桌面
Alt+F4:关闭当前程序、关机
6,常用DOS命令
D:盘符切换到D盘(切换其他盘一样+:+回车)
Dir D:列出D盘下面的所有文件夹以及文件
MD New:在当前目录下面创建一个名为New的文件夹
RD New:删除当前目录下面的名为New的文件夹
CD D\360:进入D盘下面的360文件夹中
CD…:返回到当前文件夹的上层文件夹中
CD:返回根目录
Del*txt:删除当前目录下面所有的后缀名为txt的文件
Cls:清除控制台窗口
Exit:退出控制台窗口
7,对象
属性(对象的外貌特征)
方法(主动的方法:自身具备)
事件(被动的方法)
8,属性赋值
1.查看属性的类型,如果是C#中预定义的15种属性类型,直接赋值
(1)查看属性类型:鼠标悬停在属性单词上
(2)C#中预定义的属性类型:
int 32位有符号整数 int i = 200;
this.Width = 400;
string 字符串 string str=“哈哈哈哈”;
this.AccessibleDefaultActionDescription = “”;
bool 布尔类型 true/false
this.Enabled = true;
2.排除第一种,等号后面试着敲空格,如果出现智能提示,直接敲小数点,选择一个合适的选项分号结束。
this.WindowState = FormWindowState.Maximized
3.遇到特殊类型(color),等号后面直接使用属性类型单词点,选择一个分号结束。
this.BackColor = Color.Plum;
9,抖动案例
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;
namespace WindowsFormsApplication1
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void Form2_Load(object sender, EventArgs e)
{
this.BackColor = Color.Plum;
this.Width = 300;
this.Height = 300;
this.Left = 500;
this.Top = 500;
this.Text = "抖动";
}
private void button1_Click(object sender, EventArgs e)
{
for (int i=0;i<5;i++)
{
this.Left = 505;
Thread.Sleep(30);
this.Top = 505;
Thread.Sleep(30);
this.Left = 500;
Thread.Sleep(30);
this.Left = 495;
Thread.Sleep(30);
this.Top = 500;
Thread.Sleep(30);
this.Top = 495;
Thread.Sleep(30);
this.Left = 500;
Thread.Sleep(30);
this.Left = 505;
Thread.Sleep(30);
this.Top = 500;
Thread.Sleep(30);
this.Left = 500;
}
}
}
}