久久久精品网站,成人伊人网,色吧av色av,亚洲AV永久无码精品秋霞电影影院

vb.net 數(shù)據(jù)庫

前沿拓展:

vb.net 數(shù)據(jù)庫

你再添加一個導(dǎo)航條.bindingnavigator. 第二將它綁定你的textbox,修改后按導(dǎo)航條的保存就能保存.按導(dǎo)航條的上下就能讀取前后數(shù)據(jù).


跟隨教材《AUTOCAD VBA&VB.NET開發(fā)基礎(chǔ)與實(shí)例教程(C#版) 第2版》進(jìn)行編程學(xué)習(xí)第1.2章節(jié),對.NET程序的初始化、載入其他的.NET程序、異常處理,能夠按照教材內(nèi)容完成編寫程序,;但其中發(fā)現(xiàn)一些問題,就是有一些異常很莫名其妙,重新寫一個一模一樣的就沒有異常了,不知道什么原因,這種很耗費(fèi)時間。打算針對各種異常先不管了,有問題就照著教材重新抄一遍,能夠生成成功就行。

后面第1.3章節(jié),學(xué)習(xí)用向?qū)?chuàng)建AutoCAD程序,需要下載鏈接,于是去百度了下,找到了黎明科技分項(xiàng)的下載鏈接,里面有各個版本,不過需要注冊下阿里云盤的賬號:https://www.aliyundrive.com/s/LGZKsZqJyaR,提取碼07mv,可以正常下載。當(dāng)然大家也可以自己搜索,網(wǎng)上的資源應(yīng)該挺多的。

下面分項(xiàng)下1.2章節(jié)涉及的一些源程序

1.1章節(jié)的Hello程序

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using Autodesk.AutoCAD.ApplicationServices;

using Autodesk.AutoCAD.EditorInput;

using Autodesk.AutoCAD.Runtime;

namespace Chap01

{

public class Chap01

{

[CommandMethod("Hello")]

public void Hello()

{

//獲取當(dāng)前活動文檔的 Editor 對象,也就是命令行

Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;

//調(diào)用 Editor 對象的 Writemessage 函數(shù)在命令行上顯示文本

ed.WriteMessage("\n歡迎進(jìn)入.NET開發(fā)AutoCAD世界!");

}

}

}

1.2章節(jié)的InitClass程序

using System;

using System.Collections.Generic;

using System.Linq;

using System.Reflection;

using System.Text;

using System.Threading.Tasks;

using Autodesk.AutoCAD.ApplicationServices;

using Autodesk.AutoCAD.EditorInput;

using Autodesk.AutoCAD.Runtime;

[assembly: ExtensionApplication(typeof(InitAandOpt.InitClass))]

[assembly: CommandClass(typeof(InitAandOpt.Optimize))]

namespace InitAandOpt

{

public class InitClass: IExtensionApplication

{

//初始化

public void Initialize()

{

Editor ed=Application.DocumentManager.MdiActiveDocument.Editor;

//在AutoCAD命令行上顯示一些內(nèi)容,他們會在程序載入時被顯示

ed.WriteMessage("程序開始初始化");

}

//終止化

public void Terminate()

{

//在Visua Studio 2022 的輸出窗口上顯示程序結(jié)束的信息

System.Diagnostics.Debug.WriteLine("程序結(jié)束,你可以在內(nèi)做一些程序的清理工作,如關(guān)閉AutoCAD文檔");

}

[CommandMethod("InitCommand")]

public void InitCommande()

{

Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;

ed.WriteMessage("Test");

}

}

}

1.2章節(jié)的Optimize程序

using Autodesk.AutoCAD.ApplicationServices;

using Autodesk.AutoCAD.DatabaseServices;

using Autodesk.AutoCAD.EditorInput;

using Autodesk.AutoCAD.Runtime;

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace InitAandOpt

{

internal class Optimize

{

[CommandMethod("OptCommand")]

public void OptCommand()

{

//獲取當(dāng)前活動文檔的 Editor 對象,也就是命令行

Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;

string fileName = "C:\\Hello.dll";//Hello.dll程序集文件名

try

{

ExtensionLoader.Load(fileName);//載入Hell.dll程序集

//在命令行上顯示信息,提示用戶Hello.dll程序集已經(jīng)被載入

ed.WriteMessage("\n" + fileName + "被載入,請輸入Hello進(jìn)行測試!");

}

catch (System.Exception ex)//捕捉程序異常

{

ed.WriteMessage(ex.Message);//顯示異常信息

}

finally

{

ed.WriteMessage("\nfinally語句:程序執(zhí)行完畢!");

}

}

[CommandMethod("ChangeColor")]

public void ChangeColor()

{

//獲取當(dāng)前圖形數(shù)據(jù)庫

Database db = HostApplicationServices.WorkingDatabase;

//獲取命令行對象

Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;

try

{

//提示用戶選擇對象

ObjectId id = ed.GetEntity("\n請選擇要改變顏色的對象").ObjectId;

//開啟事務(wù)處理,以改變對象顏色

using (Transaction trans = db.TransactionManager.StartTransaction())

{

//以寫的方式打開對象

Entity ent = (Entity)trans.GetObject(id, OpenMode.ForWrite);

ent.ColorIndex = 8;//為測試異常,設(shè)置對象為不合法的顏色

trans.Commit();//提交事務(wù)處理,顏色更改完成

}

}

catch (Autodesk.AutoCAD.Runtime.Exception ex)//捕捉異常

{

switch (ex.ErrorStatus)//對不同的異常分別進(jìn)行處理

{

case ErrorStatus.InvalidIndex://輸入錯誤的顏色值

ed.WriteMessage("\n輸入的顏色值有誤");

break;

case ErrorStatus.InvalidObjectId://未選擇對象

ed.WriteMessage("\n未選擇對象");

break;

default://其他異常

ed.WriteMessage(ex.ErrorStatus.ToString());

break;

}

}

}

}

}

拓展知識:

原創(chuàng)文章,作者:九賢生活小編,如若轉(zhuǎn)載,請注明出處:http://xiesong.cn/22937.html

噜噜视频| 激情五月天婷婷在线| 天堂久久久爱| 欧美黄色一区| 中文激情一区二区| 日本gav免费| 秋霞成人网| 激情欧美亚洲| 超碰福利网站| 久久蜜AV一区| 国产成人精品在线系列| 亚洲国产精品VA在线观看麻豆| 刮伦中文字幕| 久一本久| 国产成人精品一区二区三区免费| xxx.婷婷| 手机免费乱人伦| 玖玖无码中文字幕| AV黄色在线观看| 国内精品久久久久久无码不卡| 国产VA,天美传谋| 日本a极影院在线观看| 国产91久久精品| 日韩精品电影一区二区| 97se亚洲综合在线| 亚洲激情图片一区二区| 激情五月自拍| 热热久久伊人| 久久99精品久久水蜜桃| 国产一区二区三区妓女| 亚洲激情小说图| 国产区一xxx...| 日韩九九草视频| 6080亚洲人久久精品| 精品国产欧美激情| 熟女乱2 伦| 日韩高清无码无码无| 在线观看午夜福利| 日韩精品一区二区午夜成人版 | 欧美A网hOt| 日韩免费人妻AV无码专区蜜桃|