Winform美化MessageBox

来源:http://www.cnblogs.com/bryantzx/archive/2017/11/10/7813920.html
-Advertisement-
Play Games

現在在做的項目美工要求比較高,所以根據網上搜索的資料,自定義了一整套的彈出框,供大家參考,之網上其他大神有調用系統ICO的,容易導致異常,我在此使用本地資源ICO,效率高不異常。using System; using System.Drawing; using System.Drawing.Draw... ...


現在在做的項目美工要求比較高,所以根據網上搜索的資料,自定義了一整套的彈出框,供大家參考,之網上其他大神有調用系統ICO的,容易導致異常,我在此使用本地資源ICO,效率高不異常。


using System; using System.Drawing; using System.Drawing.Drawing2D; using System.Windows.Forms; using System.Runtime.InteropServices; using YLYJ_Cashier.Common; namespace YLYJ_Cashier { public partial class MyMsgBox : SkinMain { [DllImport("user32.dll", CharSet = CharSet.Auto)] private static extern bool MessageBeep(uint type); [DllImport("User32.dll", EntryPoint = "SetWindowLong", SetLastError = true)] public static extern bool SetWindowLong(IntPtr hWnd, int nIndex, int nFlags); [DllImport("User32.dll", EntryPoint = "GetWindowLong", SetLastError = true)] public static extern int GetWindowLong(IntPtr hWnd, int nFlags); [DllImport("User32.dll", EntryPoint = "SetWindowPos", SetLastError = true)] public static extern int SetWindowPos(IntPtr hWnd, IntPtr hWndWinInsertAfter, int x, int y, int cx, int cy, int nFlags); const int WS_EX_TOOLWINDOW = 0x80; const int GWL_EXSTYLE = -20; const int HWND_TOPMOST = -1; const int SWP_NOSIZE = 0x0001; const int SWP_NOMOVE = 0x0002; static private MyMsgBox newMessageBox; static private Label frmTitle; static private Label frmMessage; static private PictureBox pIcon; static private FlowLayoutPanel flpButtons; static private Icon frmIcon; static private Button btnOK; static private Button btnAbort; static private Button btnRetry; static private Button btnIgnore; static private Button btnCancel; static private Button btnYes; static private Button btnNo; static private DialogResult CYReturnButton; public enum MyIcon { Information, Question, Warning } public enum MyButtons { AbortRetryIgnore, OK, OKCancel, RetryCancel, YesNo, YesNoCancel } static private void BuildMessageBox(string title) { try { newMessageBox = new MyMsgBox(); newMessageBox.Text = title; newMessageBox.Size = new System.Drawing.Size(350, 150); newMessageBox.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; newMessageBox.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; newMessageBox.Paint += new PaintEventHandler(newMessageBox_Paint); newMessageBox.BackColor = System.Drawing.Color.White; TableLayoutPanel tlp = new TableLayoutPanel(); tlp.RowCount = 3; tlp.ColumnCount = 0; tlp.Dock = System.Windows.Forms.DockStyle.Fill; tlp.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 22)); tlp.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); tlp.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50)); tlp.BackColor = System.Drawing.Color.Transparent; tlp.Padding = new Padding(2, 5, 2, 2); frmTitle = new Label(); frmTitle.Dock = System.Windows.Forms.DockStyle.Fill; frmTitle.BackColor = System.Drawing.Color.Transparent; frmTitle.ForeColor = System.Drawing.Color.White; frmTitle.Font = new Font("微軟雅黑", 10, FontStyle.Bold); frmMessage = new Label(); frmMessage.Dock = System.Windows.Forms.DockStyle.Fill; frmMessage.BackColor = System.Drawing.Color.White; frmMessage.ForeColor=ColorTranslator.FromHtml("#333333"); frmMessage.Font = new Font("微軟雅黑", 12, FontStyle.Regular); frmMessage.Padding = new Padding(0, 10, 0, 0); frmMessage.Text = "hiii"; pIcon = new PictureBox(); flpButtons = new FlowLayoutPanel(); flpButtons.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; flpButtons.Padding = new Padding(0, 5, 5, 0); flpButtons.Dock = System.Windows.Forms.DockStyle.Fill; flpButtons.BackColor = System.Drawing.Color.White; TableLayoutPanel tlpMessagePanel = new TableLayoutPanel(); tlpMessagePanel.BackColor = System.Drawing.Color.White; tlpMessagePanel.ForeColor = ColorTranslator.FromHtml("#333333"); tlpMessagePanel.Dock = System.Windows.Forms.DockStyle.Fill; tlpMessagePanel.ColumnCount = 2; tlpMessagePanel.RowCount = 0; tlpMessagePanel.Padding = new Padding(4, 5, 4, 4); tlpMessagePanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 50)); tlpMessagePanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); tlpMessagePanel.Controls.Add(pIcon); tlpMessagePanel.Controls.Add(frmMessage); tlp.Controls.Add(frmTitle); tlp.Controls.Add(tlpMessagePanel); tlp.Controls.Add(flpButtons); newMessageBox.Controls.Add(tlp); } catch (Exception ee) { Log.WriteLog("消息框彈出時發生異常:" + ee.Message.ToString()); } } /// <summary> /// 預設消息提示,圖標為感嘆號 /// </summary> static public DialogResult Show(string Message) { BuildMessageBox("提示"); frmTitle.Text = "提示"; frmMessage.Text = Message; ShowOKButton(); IconStatements(MyIcon.Information); Image imageIcon = new Bitmap(frmIcon.ToBitmap(), 38, 38); pIcon.Image = imageIcon; newMessageBox.ShowDialog(); return CYReturnButton; } /// <summary> /// Message: Text to display in the message box. /// </summary> static public DialogResult Show(string Message, MyIcon MIcon) { BuildMessageBox("提示"); frmTitle.Text = "提示"; frmMessage.Text = Message; ShowOKButton(); IconStatements(MIcon); Image imageIcon = new Bitmap(frmIcon.ToBitmap(), 38, 38); pIcon.Image = imageIcon; newMessageBox.ShowDialog(); return CYReturnButton; } /// <summary> /// Title: Text to display in the title bar of the messagebox. /// </summary> static public DialogResult Show(string Message, string Title) { BuildMessageBox(Title); frmTitle.Text = Title; frmMessage.Text = Message; ShowOKButton(); newMessageBox.ShowDialog(); return CYReturnButton; } /// <summary> /// MButtons: Display MyButtons on the message box. /// </summary> static public DialogResult Show(string Message, string Title, MyButtons MButtons) { BuildMessageBox(Title); // BuildMessageBox method, responsible for creating the MessageBox frmTitle.Text = Title; // Set the title of the MessageBox frmMessage.Text = Message; //Set the text of the MessageBox ButtonStatements(MButtons); // ButtonStatements method is responsible for showing the appropreiate buttons newMessageBox.ShowDialog(); // Show the MessageBox as a Dialog. return CYReturnButton; // Return the button click as an Enumerator } /// <summary> /// MIcon: Display MyIcon on the message box. /// </summary> static public DialogResult Show(string Message, string Title, MyButtons MButtons, MyIcon MIcon) { BuildMessageBox(Title); frmTitle.Text = Title; frmMessage.Text = Message; ButtonStatements(MButtons); IconStatements(MIcon); Image imageIcon = new Bitmap(frmIcon.ToBitmap(), 38, 38); pIcon.Image = imageIcon; newMessageBox.ShowDialog(); return CYReturnButton; } static void btn_MouseEnter(object sender, EventArgs e) { var btn = (Button)sender; btn.BackgroundImage = Properties.Resources.buttonHover; } static void btn_MouseLeave(object sender, EventArgs e) { var btn = (Button)sender; btn.BackgroundImage = Properties.Resources.buttonBack; } static void btnOK_Click(object sender, EventArgs e) { CYReturnButton = DialogResult.OK; newMessageBox.Dispose(); } static void btnAbort_Click(object sender, EventArgs e) { CYReturnButton = DialogResult.Abort; newMessageBox.Dispose(); } static void btnRetry_Click(object sender, EventArgs e) { CYReturnButton = DialogResult.Retry; newMessageBox.Dispose(); } static void btnIgnore_Click(object sender, EventArgs e) { CYReturnButton = DialogResult.Ignore; newMessageBox.Dispose(); } static void btnCancel_Click(object sender, EventArgs e) { CYReturnButton = DialogResult.Cancel; newMessageBox.Dispose(); } static void btnYes_Click(object sender, EventArgs e) { CYReturnButton = DialogResult.Yes; newMessageBox.Dispose(); } static void btnNo_Click(object sender, EventArgs e) { CYReturnButton = DialogResult.No; newMessageBox.Dispose(); } static private void ShowOKButton() { btnOK = new Button(); btnOK.Text = "確認"; btnOK.Size = new System.Drawing.Size(80, 32); btnOK.BackColor = System.Drawing.Color.Transparent; ; btnOK.BackgroundImage = Properties.Resources.buttonBack; btnOK.Font = new Font("微軟雅黑", 9, FontStyle.Regular); btnOK.BackgroundImageLayout = ImageLayout.Stretch; btnOK.ForeColor = System.Drawing.Color.White; btnOK.TextAlign = ContentAlignment.TopCenter; btnOK.FlatAppearance.BorderSize = 0; btnOK.FlatStyle = FlatStyle.Flat; btnOK.Click += new EventHandler(btnOK_Click); btnOK.MouseEnter += new EventHandler(btn_MouseEnter); btnOK.MouseLeave += new EventHandler(btn_MouseLeave); btnOK.Cursor=Cursors.Hand; flpButtons.Controls.Add(btnOK); } static private void ShowAbortButton() { btnAbort = new Button(); btnAbort.Text = "停止"; btnAbort.Size = new System.Drawing.Size(80, 32); btnAbort.BackColor = System.Drawing.Color.Transparent; btnAbort.BackgroundImage = Properties.Resources.buttonBack; btnAbort.Font = new Font("微軟雅黑", 9, FontStyle.Regular); btnAbort.BackgroundImageLayout = ImageLayout.Stretch; btnAbort.ForeColor = System.Drawing.Color.White; btnAbort.TextAlign = ContentAlignment.TopCenter; btnAbort.FlatAppearance.BorderSize = 0; btnAbort.FlatStyle = FlatStyle.Flat; btnAbort.Click += new EventHandler(btnAbort_Click); btnAbort.MouseEnter += new EventHandler(btn_MouseEnter); btnAbort.MouseLeave += new EventHandler(btn_MouseLeave); btnAbort.Cursor = Cursors.Hand; flpButtons.Controls.Add(btnAbort); } static private void ShowRetryButton() { btnRetry = new Button(); btnRetry.Text = "重試"; btnRetry.Size = new System.Drawing.Size(80, 32); btnRetry.BackColor = System.Drawing.Color.Transparent; btnRetry.BackgroundImage = Properties.Resources.buttonBack; btnRetry.Font = new Font("微軟雅黑", 9, FontStyle.Regular); btnRetry.BackgroundImageLayout = ImageLayout.Stretch; btnRetry.ForeColor = System.Drawing.Color.White; btnRetry.TextAlign = ContentAlignment.TopCenter; btnRetry.FlatAppearance.BorderSize = 0; btnRetry.FlatStyle = FlatStyle.Flat; btnRetry.Click += new EventHandler(btnRetry_Click); btnRetry.MouseEnter += new EventHandler(btn_MouseEnter); btnRetry.MouseLeave += new EventHandler(btn_MouseLeave); btnRetry.Cursor = Cursors.Hand; flpButtons.Controls.Add(btnRetry); } static private void ShowIgnoreButton() { btnIgnore = new Button(); btnIgnore.Text = "忽略"; btnIgnore.Size = new System.Drawing.Size(80, 32); btnIgnore.BackColor = System.Drawing.Color.Transparent; btnIgnore.BackgroundImage = Properties.Resources.buttonBack; btnIgnore.Font = new Font("微軟雅黑", 9, FontStyle.Regular); btnIgnore.BackgroundImageLayout = ImageLayout.Stretch; btnIgnore.ForeColor = System.Drawing.Color.White; btnIgnore.TextAlign = ContentAlignment.TopCenter; btnIgnore.FlatAppearance.BorderSize = 0; btnIgnore.FlatStyle = FlatStyle.Flat; btnIgnore.Click += new EventHandler(btnIgnore_Click); btnIgnore.MouseEnter += new EventHandler(btn_MouseEnter); btnIgnore.MouseLeave += new EventHandler(btn_MouseLeave); btnIgnore.Cursor = Cursors.Hand; flpButtons.Controls.Add(btnIgnore); } static private void ShowCancelButton() { btnCancel = new Button(); btnCancel.Text = "取消"; btnCancel.Size = new System.Drawing.Size(80, 32); btnCancel.BackColor = System.Drawing.Color.Transparent; btnCancel.BackgroundImage = Properties.Resources.buttonBack; btnCancel.Font = new Font("微軟雅黑",9, FontStyle.Regular); btnCancel.BackgroundImageLayout = ImageLayout.Stretch; btnCancel.ForeColor = System.Drawing.Color.White; btnCancel.TextAlign = ContentAlignment.TopCenter; btnCancel.FlatAppearance.BorderSize = 0; btnCancel.FlatStyle = FlatStyle.Flat; btnCancel.Click += new EventHandler(btnCancel_Click); btnCancel.MouseEnter += new EventHandler(btn_MouseEnter); btnCancel.MouseLeave += new EventHandler(btn_MouseLeave); btnCancel.Cursor = Cursors.Hand; flpButtons.Controls.Add(btnCancel); } static private void ShowYesButton() { btnYes = new Button(); btnYes.Text = "是"; btnYes.Size = new System.Drawing.Size(80, 32); btnYes.BackColor = System.Drawing.Color.Transparent; btnYes.BackgroundImage = Properties.Resources.buttonBack; btnYes.Font = new Font("微軟雅黑", 9, FontStyle.Regular); btnYes.BackgroundImageLayout = ImageLayout.Stretch; btnYes.ForeColor = System.Drawing.Color.White; btnYes.TextAlign = ContentAlignment.TopCenter; btnYes.FlatAppearance.BorderSize = 0; btnYes.FlatStyle = FlatStyle.Flat; btnYes.Click += new EventHandler(btnYes_Click); btnYes.MouseEnter += new EventHandler(btn_MouseEnter); btnYes.MouseLeave += new EventHandler(btn_MouseLeave); btnYes.Cursor = Cursors.Hand; btnYes.TabIndex = 1; flpButtons.Controls.Add(btnYes); } static private void ShowNoButton() { btnNo = new Button(); btnNo.Text = "否"; btnNo.Size = new System.Drawing.Size(80, 32); btnNo.BackColor = System.Drawing.Color.Transparent; btnNo.BackgroundImage = Properties.Resources.buttonBack; btnNo.Font = new Font("微軟雅黑", 9, FontStyle.Regular); btnNo.BackgroundImageLayout = ImageLayout.Stretch; btnNo.ForeColor = System.Drawing.Color.White; btnNo.TextAlign = ContentAlignment.TopCenter; btnNo.FlatAppearance.BorderSize = 0; btnNo.FlatStyle = FlatStyle.Flat; btnNo.Click += new EventHandler(btnNo_Click); btnNo.MouseEnter += new EventHandler(btn_MouseEnter); btnNo.MouseLeave += new EventHandler(btn_MouseLeave); btnNo.Cursor = Cursors.Hand; flpButtons.Controls.Add(btnNo); } static private void ButtonStatements(MyButtons MButtons) { try { if (MButtons == MyButtons.AbortRetryIgnore) { ShowIgnoreButton(); ShowRetryButton(); ShowAbortButton(); } if (MButtons == MyButtons.OK) { ShowOKButton(); } if (MButtons == MyButtons.OKCancel) { ShowCancelButton(); ShowOKButton(); } if (MButtons == MyButtons.RetryCancel) { ShowCancelButton(); ShowRetryButton(); } if (MButtons == MyButtons.YesNo) { ShowNoButton(); ShowYesButton(); } if (MButtons == MyButtons.YesNoCancel) { ShowCancelButton(); ShowNoButton(); ShowYesButton(); } } catch (Exception ee) { Log.WriteLog("消息框彈出時發生異常:" + ee.Message.ToString()); } } static private void IconStatements(MyIcon MIcon) { try { if (MIcon == MyIcon.Information) { MessageBeep(0); frmIcon = Properties.Resources.information; } if (MIcon == MyIcon.Question) { MessageBeep(0); frmIcon = Properties.Resources.question; } if (MIcon == MyIcon.Warning) { MessageBeep(30); frmIcon = Properties.Resources.warning; } } catch (Exception ee) { Log.WriteLog("消息框彈出時發生異常:" + ee.Message.ToString()); } } static void newMessageBox_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; Rectangle frmTitleL = new Rectangle(0, 0, (newMessageBox.Width / 2), 30); Rectangle frmTitleR = new Rectangle((newMessageBox.Width / 2), 0, (newMessageBox.Width / 2), 30); Rectangle frmMessageBox = new Rectangle(0, 0, (newMessageBox.Width - 1), (newMessageBox.Height - 1)); LinearGradientBrush frmLGBL = new LinearGradientBrush(frmTitleL, Color.FromArgb(85, 100, 217), Color.FromArgb(209, 230, 243), LinearGradientMode.Horizontal); LinearGradientBrush frmLGBR = new LinearGradientBrush(frmTitleR, Color.FromArgb(209, 230, 243), Color.FromArgb(85, 100, 217), LinearGradientMode.Horizontal); Pen frmPen = new Pen(Color.FromArgb(63, 119, 143), 1); g.FillRectangle(frmLGBL, frmTitleL); g.FillRectangle(frmLGBR, frmTitleR); g.DrawRectangle(frmPen, frmMessageBox); } private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MyMsgBox)); this.SuspendLayout(); // // MyMsgBox // this.BackColor = System.Drawing.Color.White; this.ClientSize = new System.Drawing.Size(284, 262); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.KeyPreview = true; this.Name = "MyMsgBox"; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.ShowInTaskbar = false; this.TopMost = true; this.Load += new System.EventHandler(this.MyMsgBox_Load); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.MyMsgBox_KeyDown); this.ResumeLayout(false); } private void MyMsgBox_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape) //ESC鍵按下 { this.Close(); } } /// <summary> /// 控制彈出框永遠在最上方 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MyMsgBox_Load(object sender, EventArgs e) { SetWindowLong(this.Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE) | WS_EX_TOOLWINDOW); SetWindowPos(this.Handle, (IntPtr)HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); this.TopMost = true; } } }

  


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 作為開發者,想不想知道自己寫了多少行代碼嗎,打開終端,進入項目文件夾,然後進入想統計的某個文件夾,也可以直接在當前項目文件夾,然後終端輸入下麵的代碼就可以了 上面統計了.m、.mm、.cpp、.h、.rss尾碼的所有文件,我是這麼認為的^_^ ...
  • 常用到的屬性字元串 直接賦給label就可以了 ...
  • 前端: js: function AjaxKouBeiShopEdit() { var options = { dataType: "json", success: function (data) { alert(data); }, error: function (XMLHttpRequest, ...
  • BlockingCollection集合是一個擁有阻塞功能的集合,它就是完成了經典生產者消費者的演算法功能。所以BlockingCollection 很適合構造流水線模式的併發方案 BlockingCollection集合是一個擁有阻塞功能的集合,它就是完成了經典生產者消費者的演算法功能。一般情況下,我 ...
  • 原文出處 [Trailmax Tech Max Vasilyev: ASP.Net MVC development in Aberdeen, Scotland ](http://tech.trailmax.info/2014/08/aspnet identity cookie format/) "中 ...
  • 一、自定義Base16編碼原理 Base16編碼跟Base64編碼原理上有點不同,當然前面轉換是一樣的,都是是將輸入的字元串根據預設編碼轉換成一個位元組序列,而這個位元組序列裡面其實就是存的ASCII碼,其次,將每個ASCII碼轉換成8位二進位,每個八位二進位拆分成4位一組的二進位,然後將每4位一組的二 ...
  • 一個新的項目需要用到系統置頂的功能,本來是件很簡單的事情,但是越做發現並不那麼簡單,所以記錄下來: 系統環境:win7旗艦版本64位; IDE :VS2013; WPF+C#開發。 一、開始用Topmost屬性設置為true。 運行木有問題,很簡單喲。呵呵,隨後運行打開osk.exe;卵,被按下去了 ...
  • .Net 傳統非同步編程概述 .NET Framework 提供以下兩種執行 I/O 綁定和計算綁定非同步操作的標準模式: 非同步編程模型 (APM),在該模型中非同步操作由一對 Begin/End 方法(如 FileStream.BeginRead 和 Stream.EndRead)表示。 基於事件的非同步 ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...