最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

C#使用三層架構(gòu)開發(fā)Winform的詳細(xì)案例

 更新時(shí)間:2022年04月29日 11:04:55   作者:農(nóng)碼一生  
這篇文章介紹了C#使用三層架構(gòu)開發(fā)Winform的詳細(xì)案例,文中通過(guò)示例代碼介紹的非常詳細(xì)。對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

三層架構(gòu)將整個(gè)業(yè)務(wù)應(yīng)用劃分為:

  • (1)界面UI層
  • (2)業(yè)務(wù)邏輯層
  • (3)數(shù)據(jù)訪問層

對(duì)于復(fù)雜的系統(tǒng)分層可以讓結(jié)構(gòu)更加清晰,模塊更加獨(dú)立,便于維護(hù)。

各層的任務(wù):

  • (1)數(shù)據(jù)訪問層:負(fù)責(zé)數(shù)據(jù)庫(kù)的操作。
  • (2)業(yè)務(wù)邏輯層:實(shí)現(xiàn)功能模塊的業(yè)務(wù)邏輯。
  • (3)界面UI層:繪制界面,以及負(fù)責(zé)界面相關(guān)代碼。
  • (4)實(shí)體類:將數(shù)據(jù)庫(kù)中的表轉(zhuǎn)化為面向?qū)ο笏枷胫械念悺?/li>

一、案例需求

使用三層架構(gòu)實(shí)現(xiàn)學(xué)生管理:

(1)專業(yè)下拉框綁定專業(yè)表數(shù)據(jù),網(wǎng)格控件綁定學(xué)生數(shù)據(jù),并且點(diǎn)擊"搜索"按鈕可以多條件組合查詢。

(2)選中某一行,右鍵可以彈出"刪除"菜單,點(diǎn)擊"刪除"菜單可以刪除學(xué)生數(shù)據(jù)。

(3)點(diǎn)擊"新增"按鈕,彈出新增窗體,在此窗體中完成學(xué)生的新增操作。

(4)選中某一行,點(diǎn)擊"編輯"按鈕,彈出編輯窗體,在此窗體中完成數(shù)據(jù)的修改。

備注:其中性別的單選框,以及愛好的多選框分別用兩個(gè)Pannel容器包含。

數(shù)據(jù)庫(kù)準(zhǔn)備:

--專業(yè)
create table ProfessionInfo
(
	ProfessionID int primary key identity(1,1), --專業(yè)編號(hào)
	ProfessionName varchar(50) not null unique --專業(yè)名稱
)
--學(xué)生
create table StudentInfo
(
	StuID varchar(20) primary key,  --學(xué)生學(xué)號(hào)
	StuName varchar(50) not null,		--學(xué)生姓名
	StuAge int not null check(StuAge > 0 and StuAge < 130), --學(xué)生年齡
	StuSex char(2) not null check(StuSex in('男','女')),  --學(xué)生性別
	StuHobby nvarchar(100), --愛好
	ProfessionID int not null references ProfessionInfo(ProfessionID), --所屬專業(yè)編號(hào)
)
--添加專業(yè)信息
insert into ProfessionInfo(ProfessionName) values('電子競(jìng)技')
insert into ProfessionInfo(ProfessionName) values('軟件開發(fā)')
insert into ProfessionInfo(ProfessionName) values('醫(yī)療護(hù)理')
--插入學(xué)生信息
insert into StudentInfo(StuID,StuName,StuAge,StuSex,StuHobby,ProfessionID)
values('001','劉備',18,'男','',1)
insert into StudentInfo(StuID,StuName,StuAge,StuSex,StuHobby,ProfessionID)
values('002','關(guān)羽',20,'男','',2)
insert into StudentInfo(StuID,StuName,StuAge,StuSex,StuHobby,ProfessionID)
values('003','張飛',19,'男','',2)
insert into StudentInfo(StuID,StuName,StuAge,StuSex,StuHobby,ProfessionID)
values('004','孫尚香',17,'女','',3)

二、項(xiàng)目結(jié)構(gòu)

(1)創(chuàng)建一個(gè)空白解決方案。

(2)在解決方案中創(chuàng)建類庫(kù)項(xiàng)目MyEntity代表"實(shí)體類"。

(3)在解決方案中創(chuàng)建類庫(kù)項(xiàng)目MyDAL代表"數(shù)據(jù)訪問層"。

(4)在解決方案中創(chuàng)建類庫(kù)項(xiàng)目MyBLL代表"業(yè)務(wù)邏輯層"。

(5)在解決方案中創(chuàng)建Windows窗體應(yīng)用程序MyUI代表"界面UI層"。

三、實(shí)體類編寫

在MyEntity項(xiàng)目中添加兩個(gè)實(shí)體類,實(shí)體類代碼如下:

ProfessionInfoEntity:

public class ProfessionInfoEntity
{
    public ProfessionInfoEntity()
    {
        this.ProfessionID = 0;
        this.ProfessionName = "";
    }
    public int ProfessionID { get; set; }  //專業(yè)編號(hào)
    public string ProfessionName { get; set; }//專業(yè)名稱
}

StudentInfoEntiy:

public class StudentInfoEntiy
{
    public StudentInfoEntiy()
    {
        this.StuID = "";
        this.StuName = "";
        this.StuAge = 0;
        this.StuSex = "";
        this.StuHobby = "";
        this.ProfessionID = 0;
        this.ProfessionName = "";
    }
    public string StuID { get; set; }  //學(xué)生學(xué)號(hào)
    public string StuName { get; set; }  //學(xué)生姓名
    public int StuAge { get; set; }  //學(xué)生年齡
    public string StuSex { get; set; }  //學(xué)生性別
    public string StuHobby { get; set; }  //學(xué)生愛好
    public int ProfessionID { get; set; }  //學(xué)生所屬專業(yè)編號(hào)
    public string ProfessionName { get; set; } //學(xué)生所屬專業(yè)名稱
}

四、數(shù)據(jù)訪問層編寫

(1)由于數(shù)據(jù)訪問層需要使用實(shí)體類,所以需要添加實(shí)體類的引用。

即在MyDAL項(xiàng)目上右鍵-->添加-->引用-->項(xiàng)目,在項(xiàng)目中勾選MyEntity項(xiàng)目。

(2)將之前封裝好的DBHelper文件復(fù)制到MyDAL項(xiàng)目中,并通過(guò)添加現(xiàn)有項(xiàng),將DBHelper加入項(xiàng)目。

(3)在MyDAL項(xiàng)目中添加兩個(gè)類,類代碼如下:

ProfessionInfoDAL:

public class ProfessionInfoDAL
{
    #region 新增
    public int Add(ProfessionInfoEntity entity)
    {
        string sql = "insert into ProfessionInfo(professionName) values(@professionName)";
        DBHelper.PrepareSql(sql);
        DBHelper.SetParameter("ProfessionName",entity.ProfessionName);
        return DBHelper.ExecNonQuery();
    }
    #endregion

    #region 刪除
    public int Delete(int id)
    {
        string sql = "delete from ProfessionInfo where ProfessionID=@ProfessionID";
        DBHelper.PrepareSql(sql);
        DBHelper.SetParameter("ProfessionID", id);
        return DBHelper.ExecNonQuery();
    }
    #endregion

    #region 修改
    public int Update(ProfessionInfoEntity entity)
    {
        string sql = "update ProfessionInfo set professionName=@professionName where ProfessionID=@ProfessionID";
        DBHelper.PrepareSql(sql);
        DBHelper.SetParameter("professionName", entity.ProfessionName);
        DBHelper.SetParameter("ProfessionID", entity.ProfessionID);
        return DBHelper.ExecNonQuery();
    }
    #endregion

    #region 列表
    public List<ProfessionInfoEntity> List()
    {
        string sql = "select * from ProfessionInfo";
        DataTable dt = new DataTable();
        DBHelper.PrepareSql(sql);
        dt = DBHelper.ExecQuery();
        List<ProfessionInfoEntity> list = new List<ProfessionInfoEntity>();
        foreach (DataRow item in dt.Rows)
        {
            ProfessionInfoEntity entity = new ProfessionInfoEntity();
            entity.ProfessionID = int.Parse(item["ProfessionID"].ToString());
            entity.ProfessionName = item["ProfessionName"].ToString();
            list.Add(entity);
        }
        return list;
    }
    #endregion

    #region 詳情
    public ProfessionInfoEntity Detail(int id)
    {
        string sql = "select * from ProfessionInfo where ProfessionID=@ProfessionID";
        DataTable dt = new DataTable();
        DBHelper.PrepareSql(sql);
        DBHelper.SetParameter("ProfessionID", id);
        dt = DBHelper.ExecQuery();
        if (dt.Rows.Count == 0)
            return null;
        ProfessionInfoEntity entity = new ProfessionInfoEntity();
        entity.ProfessionID = int.Parse(dt.Rows[0]["ProfessionID"].ToString());
        entity.ProfessionName = dt.Rows[0]["ProfessionName"].ToString();
        return entity;
    }
    #endregion
}

StudentInfoDAL:

public class StudentInfoDAL
{
    #region 新增
    public int Add(StudentInfoEntiy entity)
    {
        string sql = "insert into StudentInfo(StuID,StuName,StuAge,StuSex,StuHobby,ProfessionID) values(@StuID,@StuName,@StuAge,@StuSex,@StuHobby,@ProfessionID)";
        DBHelper.PrepareSql(sql);
        DBHelper.SetParameter("StuID", entity.StuID);
        DBHelper.SetParameter("StuName", entity.StuName);
        DBHelper.SetParameter("StuAge", entity.StuAge);
        DBHelper.SetParameter("StuSex", entity.StuSex);
        DBHelper.SetParameter("StuHobby", entity.StuHobby);
        DBHelper.SetParameter("ProfessionID", entity.ProfessionID);
        return DBHelper.ExecNonQuery();
    }
    #endregion

    #region 刪除
    public int Delete(string id)
    {
        string sql = "delete from StudentInfo where StuID=@StuID";
        DBHelper.PrepareSql(sql);
        DBHelper.SetParameter("StuID", id);
        return DBHelper.ExecNonQuery();
    }
    #endregion

    #region 修改
    public int Update(StudentInfoEntiy entity)
    {
        string sql = "update StudentInfo set StuName=@StuName,StuAge=@StuAge,StuSex=@StuSex,StuHobby=@StuHobby,ProfessionID=@ProfessionID where StuID=@StuID";
        DBHelper.PrepareSql(sql);
        DBHelper.SetParameter("StuName", entity.StuName);
        DBHelper.SetParameter("StuAge", entity.StuAge);
        DBHelper.SetParameter("StuSex", entity.StuSex);
        DBHelper.SetParameter("StuHobby", entity.StuHobby);
        DBHelper.SetParameter("ProfessionID", entity.ProfessionID);
        DBHelper.SetParameter("StuID", entity.StuID);
        return DBHelper.ExecNonQuery();
    }
    #endregion

    #region 列表
    public List<StudentInfoEntiy> List()
    {
        string sql = "select * from StudentInfo";
        DataTable dt = new DataTable();
        DBHelper.PrepareSql(sql);
        dt = DBHelper.ExecQuery();
        List<StudentInfoEntiy> list = new List<StudentInfoEntiy>();
        foreach (DataRow item in dt.Rows)
        {
            StudentInfoEntiy entity = new StudentInfoEntiy();
            entity.StuID = item["StuID"].ToString();
            entity.StuName = item["StuName"].ToString();
            entity.StuAge = int.Parse(item["StuAge"].ToString());
            entity.StuSex = item["StuSex"].ToString();
            entity.StuHobby = item["StuHobby"].ToString();
            entity.ProfessionID = int.Parse(item["ProfessionID"].ToString());
            list.Add(entity);
        }
        return list;
    }
    #endregion

    #region 詳情
    public StudentInfoEntiy Detail(string id)
    {
        string sql = "select * from StudentInfo where StuID=@StuID";
        DataTable dt = new DataTable();
        DBHelper.PrepareSql(sql);
        DBHelper.SetParameter("StuID", id);
        dt = DBHelper.ExecQuery();
        if (dt.Rows.Count == 0)
            return null;
        StudentInfoEntiy entity = new StudentInfoEntiy();
        entity.StuID = dt.Rows[0]["StuID"].ToString();
        entity.StuName = dt.Rows[0]["StuName"].ToString();
        entity.StuAge = int.Parse(dt.Rows[0]["StuAge"].ToString());
        entity.StuSex = dt.Rows[0]["StuSex"].ToString();
        entity.StuHobby = dt.Rows[0]["StuHobby"].ToString();
        entity.ProfessionID = int.Parse(dt.Rows[0]["ProfessionID"].ToString());
        return entity;
    }
    #endregion
}

五、業(yè)務(wù)邏輯層編寫

(1)由于業(yè)務(wù)邏輯層需要使用實(shí)體類,所以需要添加實(shí)體類的引用。

即在MyBLL項(xiàng)目上右鍵-->添加-->引用-->項(xiàng)目,在項(xiàng)目中勾選MyEntity項(xiàng)目。

(2)由于業(yè)務(wù)邏輯層需要調(diào)用數(shù)據(jù)訪問層,所以需要添加數(shù)據(jù)訪問層的引用。

即在MyBLL項(xiàng)目上右鍵-->添加-->引用-->項(xiàng)目,在項(xiàng)目中勾選MyDAL項(xiàng)目。

(3)在MyBLL項(xiàng)目中添加兩個(gè)類,類代碼如下:

ProfessionInfoBLL:

public class ProfessionInfoBLL
{
    ProfessionInfoDAL dal = new ProfessionInfoDAL();
    #region 新增
    public int Add(ProfessionInfoEntity entity)
    {
        return dal.Add(entity);
    }
    #endregion

    #region 刪除
    public int Delete(int id)
    {
        return dal.Delete(id);
    }
    #endregion

    #region 修改
    public int Update(ProfessionInfoEntity entity)
    {
        return dal.Update(entity);
    }
    #endregion

    #region 列表
    public List<ProfessionInfoEntity> List()
    {
        return dal.List();
    }
    #endregion

    #region 詳情
    public ProfessionInfoEntity Detail(int id)
    {
        return dal.Detail(id);
    }
    #endregion
}

StudentInfoBLL:

public class StudentInfoBLL
{
    StudentInfoDAL dal = new StudentInfoDAL();
    #region 新增
    public int Add(StudentInfoEntiy entity)
    {
        return dal.Add(entity);
    }
    #endregion

    #region 刪除
    public int Delete(string id)
    {
        return dal.Delete(id);
    }
    #endregion

    #region 修改
    public int Update(StudentInfoEntiy entity)
    {
        return dal.Update(entity);
    }
    #endregion

    #region 列表
    public List<StudentInfoEntiy> List()
    {
        return dal.List();
    }
    #endregion

    #region 詳情
    public StudentInfoEntiy Detail(string id)
    {
        return dal.Detail(id);
    }
    #endregion
}

六、界面UI層代碼編寫

(1)由于界面UI層需要使用實(shí)體類,所以需要添加實(shí)體類的引用。

即在MyUI項(xiàng)目上右鍵-->添加-->引用-->項(xiàng)目,在項(xiàng)目中勾選MyEntity項(xiàng)目。

(2)由于界面UI層需要調(diào)用業(yè)務(wù)邏輯層,所以需要添加業(yè)務(wù)邏輯層的引用。

即在MyUI項(xiàng)目上右鍵-->添加-->引用-->項(xiàng)目,在項(xiàng)目中勾選MyBLL項(xiàng)目。

查詢窗體界面及代碼:

(1)由于查詢學(xué)生需要多條件組合查詢,所以給數(shù)據(jù)訪問層和業(yè)務(wù)邏輯層添加條件搜索的方法。

給數(shù)據(jù)訪問層MyDAL中StudentInfoDAL類添加方法:

#region 條件查詢
public List<StudentInfoEntiy> Search(StudentInfoEntiy searchObj)
{
    string sql = "select * from StudentInfo inner join ProfessionInfo on StudentInfo.ProfessionID = ProfessionInfo.ProfessionID where 1 = 1";
    if (searchObj.ProfessionID != 0)
        sql += " and StudentInfo.ProfessionID = " + searchObj.ProfessionID;
    if (!searchObj.StuName.Equals(""))
        sql += " and StuName like '%" + searchObj.StuName + "%'";
    DataTable dt = new DataTable();
    DBHelper.PrepareSql(sql);
    dt = DBHelper.ExecQuery();
    List<StudentInfoEntiy> list = new List<StudentInfoEntiy>();
    foreach (DataRow item in dt.Rows)
    {
        StudentInfoEntiy entity = new StudentInfoEntiy();
        entity.StuID = item["StuID"].ToString();
        entity.StuName = item["StuName"].ToString();
        entity.StuAge = int.Parse(item["StuAge"].ToString());
        entity.StuSex = item["StuSex"].ToString();
        entity.StuHobby = item["StuHobby"].ToString();
        entity.ProfessionID = int.Parse(item["ProfessionID"].ToString());
        entity.ProfessionName = item["ProfessionName"].ToString();
        list.Add(entity);
    }
    return list;
}
#endregion

給業(yè)務(wù)邏輯層MyBLL中StudentInfoBLL類添加方法:

#region 條件查詢
public List<StudentInfoEntiy> Search(StudentInfoEntiy searchObj)
{
	return dal.Search(searchObj);
}
#endregion

(2)在此界面中多個(gè)功能需要調(diào)用業(yè)務(wù)邏輯層,定義兩個(gè)業(yè)務(wù)邏輯層對(duì)象:

ProfessionInfoBLL proBll = new ProfessionInfoBLL();
StudentInfoBLL stuBll = new StudentInfoBLL();

(3)查詢窗體綁定專業(yè)信息、綁定學(xué)生信息以及搜索功能代碼:

#region 綁定下拉框
private void BindPro()
{
    List<ProfessionInfoEntity> list = new List<ProfessionInfoEntity>();
    list = proBll.List();
    list.Insert(0,new ProfessionInfoEntity { ProfessionID=0,ProfessionName="--請(qǐng)選擇--"});
    this.cmbPro.DataSource = list;
    this.cmbPro.DisplayMember = "ProfessionName";
    this.cmbPro.ValueMember = "ProfessionID";
}
#endregion

#region 綁定學(xué)生數(shù)據(jù)
private void BindData()
{
    StudentInfoEntiy searchObj = new StudentInfoEntiy();
    searchObj.ProfessionID = int.Parse(this.cmbPro.SelectedValue.ToString());
    searchObj.StuName = this.txtName.Text;
    this.dataGridView1.AutoGenerateColumns = false;
    this.dataGridView1.DataSource = stuBll.Search(searchObj);
}
#endregion

#region 窗體加載
private void FrmSelect_Load(object sender, EventArgs e)
{
    BindPro();
    BindData();
}
#endregion

#region 搜索按鈕
private void btSearch_Click(object sender, EventArgs e)
{
    BindData();
}
#endregion

(4)刪除菜單代碼:

private void 刪除ToolStripMenuItem_Click(object sender, EventArgs e)
{
    //添加是否確定刪除的對(duì)話框
    DialogResult result = MessageBox.Show("確定要?jiǎng)h除數(shù)據(jù)嗎,刪除之后無(wú)法恢復(fù)!", "提示框",
        MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
    if (result == DialogResult.Cancel)
        return;
    string stuid = this.dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
    if(stuBll.Delete(stuid) == 1)
        MessageBox.Show("刪除成功!");
    else
        MessageBox.Show("刪除失敗!");
    BindData();
}

新增窗體界面及代碼:

ProfessionInfoBLL proBll = new ProfessionInfoBLL();
StudentInfoBLL stuBll = new StudentInfoBLL();
#region 綁定下拉框
private void BindPro()
{
    List<ProfessionInfoEntity> list = new List<ProfessionInfoEntity>();
    list = proBll.List();
    list.Insert(0, new ProfessionInfoEntity { ProfessionID = 0, ProfessionName = "--請(qǐng)選擇--" });
    this.cmbPro.DataSource = list;
    this.cmbPro.DisplayMember = "ProfessionName";
    this.cmbPro.ValueMember = "ProfessionID";
}
#endregion
private void FrmAdd_Load(object sender, EventArgs e)
{
    BindPro();
}

private void btAdd_Click(object sender, EventArgs e)
{
    //性別處理
    string sex = "";
    if (this.rbBoy.Checked == true) sex = this.rbBoy.Text;
    if (this.rbGirl.Checked == true) sex = this.rbGirl.Text;
    //愛好處理
    string hobby = "";
    foreach (CheckBox ck in this.panel2.Controls)
    {
        if (ck.Checked == true)
        {
            if (!hobby.Equals(""))
                hobby += ",";
            hobby += ck.Text;
        }
    }
    StudentInfoEntiy entity = new StudentInfoEntiy();
    entity.StuID = this.txtId.Text;
    entity.StuName = this.txtName.Text;
    entity.StuAge = int.Parse(this.txtAge.Text);
    entity.StuSex = sex;
    entity.StuHobby = hobby;
    entity.ProfessionID = int.Parse(this.cmbPro.SelectedValue.ToString());
    if (stuBll.Add(entity) == 1)
        MessageBox.Show("新增成功!");
    else
        MessageBox.Show("新增失敗!");
    this.Close();
}

編輯修改窗體界面及代碼:

public string StuID { get; set; } //學(xué)生編號(hào)
ProfessionInfoBLL proBll = new ProfessionInfoBLL();
StudentInfoBLL stuBll = new StudentInfoBLL();
#region 綁定下拉框
private void BindPro()
{
    List<ProfessionInfoEntity> list = new List<ProfessionInfoEntity>();
    list = proBll.List();
    list.Insert(0, new ProfessionInfoEntity { ProfessionID = 0, ProfessionName = "--請(qǐng)選擇--" });
    this.cmbPro.DataSource = list;
    this.cmbPro.DisplayMember = "ProfessionName";
    this.cmbPro.ValueMember = "ProfessionID";
}
#endregion

#region 綁定詳情
private void BindDetail()
{
    StudentInfoEntiy entity = new StudentInfoEntiy();
    entity = stuBll.Detail(this.StuID);
    this.txtId.Text = entity.StuID;
    this.txtName.Text = entity.StuName;
    this.txtAge.Text = entity.StuAge.ToString();
    this.cmbPro.SelectedValue = entity.ProfessionID;
    //性別處理
    if (entity.StuSex.Equals("男"))
        this.rbBoy.Checked = true;
    else
        this.rbGirl.Checked = true;
    //愛好處理
    string[] arrHobby = entity.StuHobby.Split(',');
    foreach (string hobby in arrHobby)
    {
        foreach (CheckBox ck in this.panel2.Controls)
        {
            if (ck.Text.Equals(hobby))
                ck.Checked = true;
        }
    }
}
#endregion

private void FrmEdit_Load(object sender, EventArgs e)
{
    BindPro();
    BindDetail();
}

private void btUpdate_Click(object sender, EventArgs e)
{
    //性別處理
    string sex = "";
    if (this.rbBoy.Checked == true) sex = this.rbBoy.Text;
    if (this.rbGirl.Checked == true) sex = this.rbGirl.Text;
    //愛好處理
    string hobby = "";
    foreach (CheckBox ck in this.panel2.Controls)
    {
        if (ck.Checked == true)
        {
            if (!hobby.Equals(""))
                hobby += ",";
            hobby += ck.Text;
        }
    }
    StudentInfoEntiy entity = new StudentInfoEntiy();
    entity.StuID = this.txtId.Text;
    entity.StuName = this.txtName.Text;
    entity.StuAge = int.Parse(this.txtAge.Text);
    entity.StuSex = sex;
    entity.StuHobby = hobby;
    entity.ProfessionID = int.Parse(this.cmbPro.SelectedValue.ToString());
    if (stuBll.Update(entity) == 1)
        MessageBox.Show("修改成功!");
    else
        MessageBox.Show("修改失敗!");
    this.Close();
}

查詢窗體中"新增"和"編輯"按鈕代碼:

private void btAdd_Click(object sender, EventArgs e)
{
    FrmAdd frm = new FrmAdd();
    frm.Show();
}

private void btEdit_Click(object sender, EventArgs e)
{
    string stuid = this.dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
    FrmEdit frm = new FrmEdit();
    frm.StuID = stuid;
    frm.Show();
}

到此這篇關(guān)于C#使用三層架構(gòu)開發(fā)Winform的文章就介紹到這了。希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • C# 使用WPF 用MediaElement控件實(shí)現(xiàn)視頻循環(huán)播放

    C# 使用WPF 用MediaElement控件實(shí)現(xiàn)視頻循環(huán)播放

    在WPF里用MediaElement控件,實(shí)現(xiàn)一個(gè)循環(huán)播放單一視頻的程序,同時(shí)可以控制視頻的播放、暫停、停止。這篇文章給大家介紹了C# 使用WPF 用MediaElement控件實(shí)現(xiàn)視頻循環(huán)播放,需要的朋友參考下吧
    2018-04-04
  • C#常用多線程(線程同步,事件觸發(fā),信號(hào)量,互斥鎖,共享內(nèi)存,消息隊(duì)列)

    C#常用多線程(線程同步,事件觸發(fā),信號(hào)量,互斥鎖,共享內(nèi)存,消息隊(duì)列)

    這篇文章主要介紹了C#常用多線程(線程同步,事件觸發(fā),信號(hào)量,互斥鎖,共享內(nèi)存,消息隊(duì)列),本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2023-09-09
  • C#中dynamic的使用方法及應(yīng)用場(chǎng)景

    C#中dynamic的使用方法及應(yīng)用場(chǎng)景

    在 C# 編程中,dynamic 類型是一個(gè)非常特殊的類型,它在編譯時(shí)并不會(huì)進(jìn)行類型檢查,而是在運(yùn)行時(shí)才進(jìn)行類型解析,本文將詳細(xì)講解 dynamic 的使用方法、優(yōu)缺點(diǎn)以及一些實(shí)際應(yīng)用場(chǎng)景,需要的朋友可以參考下
    2024-08-08
  • C# 手動(dòng)/自動(dòng)保存圖片的實(shí)例代碼

    C# 手動(dòng)/自動(dòng)保存圖片的實(shí)例代碼

    C# 手動(dòng)/自動(dòng)保存圖片的實(shí)例代碼,需要的朋友可以參考一下
    2013-03-03
  • C#讀取計(jì)算機(jī)CPU及HDD信息的方法

    C#讀取計(jì)算機(jī)CPU及HDD信息的方法

    這篇文章主要介紹了C#讀取計(jì)算機(jī)CPU及HDD信息的方法,涉及C#讀取計(jì)算機(jī)CPU及硬盤信息的相關(guān)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下
    2015-07-07
  • 利用C#編寫Linux守護(hù)進(jìn)程實(shí)例代碼

    利用C#編寫Linux守護(hù)進(jìn)程實(shí)例代碼

    如今的編程是一場(chǎng)程序員和上帝的競(jìng)賽,程序員要開發(fā)出更大更好、傻瓜都會(huì)用到軟件,下面這篇文章主要給大家介紹了關(guān)于利用C#編寫Linux守護(hù)進(jìn)程的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),需要的朋友可以參考下。
    2018-01-01
  • Unity制作自定義字體的兩種方法

    Unity制作自定義字體的兩種方法

    這篇文章主要為大家詳細(xì)介紹了Unity制作自定義字體的兩種方法,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2020-12-12
  • 在.NET?WebService中跨域CORS問題的解決方案

    在.NET?WebService中跨域CORS問題的解決方案

    在現(xiàn)代的Web應(yīng)用程序開發(fā)中,跨域資源共享(Cross-Origin?Resource?Sharing,?CORS)問題是開發(fā)者經(jīng)常遇到的一個(gè)挑戰(zhàn),在這篇博客中,我們將深入探討如何在?.NET?WebService?中解決CORS問題,幫助開發(fā)者順利實(shí)現(xiàn)跨域請(qǐng)求,需要的朋友可以參考下
    2024-05-05
  • C# Guid長(zhǎng)度雪花簡(jiǎn)單生成器的示例代碼

    C# Guid長(zhǎng)度雪花簡(jiǎn)單生成器的示例代碼

    這篇文章主要介紹了C# Guid長(zhǎng)度雪花簡(jiǎn)單生成器的示例代碼,幫助大家更好的理解和使用c#,感興趣的朋友可以了解下
    2020-12-12
  • C#如何給PPT中圖表添加趨勢(shì)線詳解

    C#如何給PPT中圖表添加趨勢(shì)線詳解

    趨勢(shì)線是一條最為符合統(tǒng)計(jì)規(guī)律的回歸線,方便我們提前了解數(shù)據(jù)如何變化的趨勢(shì),下面這篇文章主要給大家介紹了關(guān)于C#如何給PPT中圖表添加趨勢(shì)線的相關(guān)資料,需要的朋友可以參考下
    2021-09-09

最新評(píng)論

农安县| 沭阳县| 肇东市| 鹤岗市| 宝丰县| 濮阳市| 满洲里市| 明水县| 溧水县| 藁城市| 孝昌县| 木里| 饶河县| 黄浦区| 鄱阳县| 芜湖市| 班玛县| 廊坊市| 灵台县| 海伦市| 宁蒗| 寿阳县| 陆川县| 江城| 永宁县| 屯门区| 临夏市| 九龙县| 仁寿县| 鄂伦春自治旗| 苏州市| 永吉县| 咸宁市| 三江| 大厂| 龙州县| 日照市| 乌鲁木齐县| 铜山县| 邵武市| 顺义区|