泰頂項(xiàng)目管理軟件(全功能開源版) v2025.04
253.3MB / 04-05
DBCHM beta數(shù)據(jù)庫文檔生成工具 v1.9.0.1
29.3MB / 08-16
eCRM(E客CRM)客戶關(guān)系管理系統(tǒng) v1.0.16
9.3MB / 04-13
C# 繪制隨機(jī)驗(yàn)證碼開發(fā)實(shí)例
0.11MB / 07-15
Util6MIS(優(yōu)六企服系統(tǒng)_附CMS插件及模板) v5.0 源碼版
28.2MB / 03-23
C#實(shí)現(xiàn)插件式開發(fā)源碼
0.09MB / 09-26
C#實(shí)現(xiàn)報(bào)警收集系統(tǒng)源碼
0.91MB / 07-31
C# 文字轉(zhuǎn)語音源碼
0.14MB / 07-28
基于C#語言開發(fā)文件上傳、后綴名稱判別功能
20KB / 07-26
C#圖片去背景示例源碼
113KB / 07-24
-
C#激光打碼開發(fā)實(shí)例 C#源碼 / 0.03MB
-
modbus tcp編程實(shí)例開發(fā) C#源碼 / 0.09MB
-
C#窗體控件自適應(yīng)屏幕大小開發(fā)實(shí)例 C#源碼 / 0.05MB
-
親自寫的內(nèi)存修改的工具源碼 C#源碼 / 0.21MB
-
-
C#實(shí)現(xiàn)鼠標(biāo)拖拽Rectangle橡皮擦功能開發(fā)實(shí)例 C#源碼 / 0.07MB
-
C# VS的一些控件使用開發(fā)實(shí)例 C#源碼 / 0.61MB
-
c# 網(wǎng)絡(luò)通信實(shí)現(xiàn)自動下載文件并進(jìn)行解壓縮開發(fā)實(shí)例 C#源碼 / 3.11MB
-
C#將時間戳與日期格式相互轉(zhuǎn)換的小工具 C#源碼 / 0.05MB
-
C#冒泡排序算法開發(fā)實(shí)例 C#源碼 / 0.13MB
詳情介紹
激光碼(Laser Coding)通常指的是使用激光技術(shù)對物體進(jìn)行編碼或標(biāo)記,比如在工業(yè)制造中對產(chǎn)品進(jìn)行序列號標(biāo)記。在C#中實(shí)現(xiàn)一個激光碼的模擬或演示,我們可以使用圖形庫來模擬激光束的效果,并通過控制臺或圖形界面展示。
核心代碼
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices; using LmcLib; namespace Ezcad_Funtion_Show { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); dlg.Filter = "Ezd files (*.ezd)|*.ezd"; if (dlg.ShowDialog() == DialogResult.OK) { textBox1.Text = dlg.FileName; } } public void ShowPreviewBmp() { int w = pictureBox1.Size.Width; int h = pictureBox1.Size.Height; if (w > h) { w = h; } else { h = w; } pictureBox1.Image = MarkEzdDll.GetCurPreviewImage(w, h); } private void Form1_Load(object sender, EventArgs e) { try { String dir = Application.StartupPath; int nErr = MarkEzdDll.Initialize(dir, false); MessageBox.Show("Initial=" nErr.ToString()); } catch (Exception ex) { MessageBox.Show(ex.Message); this.Close(); } } private void button2_Click(object sender, EventArgs e) { if (!backgroundWorker1.IsBusy) { backgroundWorker1.RunWorkerAsync(); } } private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { int nErr = MarkEzdDll.Mark(false); //MessageBox.Show("Mark=" nErr.ToString()); } private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { //MessageBox.Show("Finish"); //button8_Click(sender, e); ShowPreviewBmp(); } private void Form1_FormClosed(object sender, FormClosedEventArgs e) { MarkEzdDll.Close(); } private void button4_Click(object sender, EventArgs e) { MarkEzdDll.SetDevCfg(); } private void button3_Click(object sender, EventArgs e) { MarkEzdDll.ChangeTextByName(textBox2.Text, textBox3.Text); } private void button6_Click(object sender, EventArgs e) { MarkEzdDll.ClearLibAllEntity(); ShowPreviewBmp(); } private void button5_Click(object sender, EventArgs e) { /// <summary> /// 向數(shù)據(jù)庫添加一條曲線對象 /// 注意PtBuf必須為2維數(shù)組,且第一維為2,如 double[5,2],double[n,2], /// ptNum為PtBuf數(shù)組的第2維,如PtBuf為double[5,2]數(shù)組,則ptNum=5 /// </summary> /// double[,] PtBuf = { { 0,0 }, { 10,0 }, { 10,10 }, { 0,10}, { 0,0 } };//10x10的矩形 MarkEzdDll.AddCurveToLib(PtBuf, 5, "Curve", 0, 0); ShowPreviewBmp(); } private void button7_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); dlg.Filter = "Ezd files (*.ezd)|*.ezd"; if (dlg.ShowDialog() == DialogResult.OK) { textBox4.Text = dlg.FileName; } } bool test = false; private void button8_Click(object sender, EventArgs e) { if (test) { if (MarkEzdDll.LoadEzdFile(textBox1.Text) != 0) { MessageBox.Show("打開Ezd文件" textBox1.Text "失敗!"); } else { test = false; } } else { if (MarkEzdDll.LoadEzdFile(textBox4.Text) != 0) { MessageBox.Show("打開Ezd文件" textBox4.Text "失敗!"); } else { test = true; } } ShowPreviewBmp(); } } public class MarkEzdDll { /// <summary> /// 初始化函數(shù)庫 /// PathName 是MarkEzd.dll所在的目錄 /// </summary> [DllImport("MarkEzd", EntryPoint = "lmc1_Initial2", CharSet= CharSet.Unicode,CallingConvention = CallingConvention.StdCall)] public static extern int Initialize(string PathName,bool bTestMode); [DllImport("MarkEzd", EntryPoint = "lmc1_SetDevCfg", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)] public static extern int SetDevCfg(); [DllImport("MarkEzd", EntryPoint = "lmc1_Close",CharSet= CharSet.Unicode, CallingConvention = CallingConvention.StdCall)] public static extern int Close(); [DllImport("MarkEzd", EntryPoint = "lmc1_LoadEzdFile", CharSet= CharSet.Unicode,CallingConvention = CallingConvention.StdCall)] public static extern int LoadEzdFile(string FileName); [DllImport("MarkEzd", EntryPoint = "lmc1_Mark",CharSet= CharSet.Unicode, CallingConvention = CallingConvention.StdCall)] public static extern int Mark(bool Fly); [DllImport("MarkEzd", EntryPoint = "lmc1_ChangeTextByName", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)] public static extern int ChangeTextByName(string EntName, string NewText); [DllImport("gdi32.dll")] internal static extern bool DeleteObject(IntPtr hObject); [DllImport("MarkEzd", EntryPoint = "lmc1_GetPrevBitmap2", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)] internal static extern IntPtr GetCurPrevBitmap(int bmpwidth, int bmpheight); public static Image GetCurPreviewImage(int bmpwidth, int bmpheight) { IntPtr pBmp = GetCurPrevBitmap(bmpwidth, bmpheight); Image img = Image.FromHbitmap(pBmp); MarkEzdDll.DeleteObject(pBmp); return img; } [DllImport("MarkEzd", EntryPoint = "lmc1_AddCurveToLib", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)] public static extern int AddCurveToLib([MarshalAs(UnmanagedType.LPArray)] double[,] PtBuf, int ptNum, string strEntName, int nPenNo, int bHatch); [DllImport("MarkEzd", EntryPoint = "lmc1_ClearEntLib", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)] public static extern int ClearLibAllEntity(); } }
下載地址
人氣源碼
相關(guān)文章
-
泰頂項(xiàng)目管理軟件(全功能開源版) v2025.04
泰頂項(xiàng)目管理軟件[綜合平臺],始于2010年,具有強(qiáng)大的項(xiàng)目計(jì)劃和流程管控功能,上千用戶使用,模塊俱全,架構(gòu)靈活,成熟可靠,適用于多個行業(yè)的專業(yè)的項(xiàng)目管理軟件平臺...
-
DBCHM beta數(shù)據(jù)庫文檔生成工具 v1.9.0.1
DBCHM 是一款簡單、實(shí)用的數(shù)據(jù)庫文檔生成工具,該工具從最初支持chm文檔格式開始,通過開源,集思廣益,不斷改進(jìn),本文給大家介紹DBCHM beta數(shù)據(jù)庫文檔生成工具 v1.9.0.1 ...
-
eCRM(E客CRM)客戶關(guān)系管理系統(tǒng) v1.0.16
eCRM(E客CRM)是基于eFrameWork低代碼開發(fā)平臺搭建的客戶關(guān)系管理系統(tǒng)。其主要功能包括:系統(tǒng)管理、產(chǎn)品管理、產(chǎn)品分類、客戶管理、訂單管理、客戶回訪、通知公告、銷售計(jì)劃...
-
C# 繪制隨機(jī)驗(yàn)證碼開發(fā)實(shí)例
在C#中繪制驗(yàn)證碼通常涉及到生成一組隨機(jī)字符,然后將這些字符繪制到一個圖像上,下面給大家分享C# 繪制隨機(jī)驗(yàn)證碼的實(shí)例,感興趣的朋友下載體驗(yàn)吧...
-
Util6MIS(優(yōu)六企服系統(tǒng)_附CMS插件及模板) v5.0 源碼版
Util6MIS(優(yōu)六企服系統(tǒng))已集成多項(xiàng)插件系統(tǒng),其Util6 CMS、DMS、OAS、WXS 是在信息化管理系統(tǒng)框架(Util6MIS)基礎(chǔ)上開發(fā)的插件系統(tǒng),歡迎需要的朋友下載使用...
-
C#實(shí)現(xiàn)插件式開發(fā)源碼
今天給大家分享基于c#開發(fā)的插件式源碼,喜歡的朋友快來下載體驗(yàn)吧...
-
C#實(shí)現(xiàn)報(bào)警收集系統(tǒng)源碼
今天給大家分享的是一款基于C#實(shí)現(xiàn)報(bào)警收集系統(tǒng)源碼,非常不錯,喜歡的朋友快來下載體驗(yàn)吧...
-
C# 文字轉(zhuǎn)語音源碼
今天給大家分享的實(shí)例代碼是C# 文字轉(zhuǎn)語音源碼,喜歡的朋友快來下載體驗(yàn)吧...
-
基于C#語言開發(fā)文件上傳、后綴名稱判別功能
今天給大家分享基于c#語言開發(fā)的文件上傳、后綴名稱判別功能,喜歡的朋友快來下載使用吧...
-
C#圖片去背景示例源碼
今天給大家分享基于c#實(shí)現(xiàn)圖片去背景示例源碼,喜歡的朋友快來下載體驗(yàn)吧...
下載聲明
☉ 解壓密碼:www.dbjr.com.cn 就是本站主域名,希望大家看清楚,[ 分享碼的獲取方法 ]可以參考這篇文章
☉ 推薦使用 [ 迅雷 ] 下載,使用 [ WinRAR v5 ] 以上版本解壓本站軟件。
☉ 如果這個軟件總是不能下載的請?jiān)谠u論中留言,我們會盡快修復(fù),謝謝!
☉ 下載本站資源,如果服務(wù)器暫不能下載請過一段時間重試!或者多試試幾個下載地址
☉ 如果遇到什么問題,請?jiān)u論留言,我們定會解決問題,謝謝大家支持!
☉ 本站提供的一些商業(yè)軟件是供學(xué)習(xí)研究之用,如用于商業(yè)用途,請購買正版。
☉ 本站提供的C#激光打碼開發(fā)實(shí)例資源來源互聯(lián)網(wǎng),版權(quán)歸該下載資源的合法擁有者所有。