随笔分类 - WinForms
摘要:To achieve this requirement, you need to create a "connectionstring" to connect them. Here is a simple demo that read data to "DataGridView". Properti
阅读全文
摘要:[DllImport("uxtheme.dll", EntryPoint = "#95")] public static extern uint GetImmersiveColorFromColorSetEx(uint dwImmersiveColorSet, uint dwImmersiveCol
阅读全文
摘要:设置无边框 Form: 通过重写 WndProc 实现无边框窗体的拖动:
阅读全文
摘要:private void button1_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.Title = "C# Corner Ope
阅读全文
摘要:有两种调用方式,在使用之前都将控件“ElementHost”添加到 Form 中: 方式一: 直接声明wpf中控件(使用 Windows.Controls) 方式二: 首先新建一个 ”User Control“, 之后,如下编辑“UserControl1.xaml”中的内容: 最后,修改”Form1
阅读全文
摘要:First, you need to add "NHunspell" from "NuGet" and import it. The specific operation is as follows: Right click the Reference and select "Manage NuGe
阅读全文
摘要:下面的例子实现定时删除文件: 使用前需要从 NuGet 获取 FluentScheduler 并引用它。
阅读全文
摘要:static void SetWebBrowserFeatures(int ieVersion) { // don't change the registry if running in-proc inside Visual Studio if (LicenseManager.UsageMode !
阅读全文
摘要:VS 提供了一种简单的方式来为应用设置多种语言——resx文件。下面演示具体的操作步骤。 1.首先新建 Winform 项目,向其添加控件,并命名 2.将 Form1 的 Localizable 属性设为 true, 设置该属性后,.net 将根据不同的语言,为应用程序生成不同的资源文件(resx文
阅读全文
摘要:public partial class Form1 : Form { [System.Runtime.InteropServices.DllImport("user32.dll")] private static extern bool RegisterHotKey( IntPtr hWnd, /
阅读全文
摘要:解决方案:(其中 TopMost = true 便可使窗口保持最前端)
阅读全文
摘要:To achieve the requirement, you can refer to the following steps: 1.Click "Project" and choose "Setting Properties…", then choose "Settings". 2.Add ne
阅读全文
摘要:int index = richTextBox1.GetFirstCharIndexOfCurrentLine(); int line = richTextBox1.GetLineFromCharIndex(index);
阅读全文
摘要:public class Form1 { //计数变量,说明输出了第N个Button private int count = 1; private void Form1_Load(System.Object sender, System.EventArgs e) { //窗体自身支持接受拖拽来的控件
阅读全文
摘要:Form1(MDIParent) public partial class Form1 : Form { public interface ITools { ToolStrip CipherToolStrip { get; } } public Form1() { InitializeCompone
阅读全文
摘要:将 Form 的 AutoScaleMode 属性设置为 Dpi: 在 Program.cs 中添加以下代码:
阅读全文
摘要:public partial class Form1 : Form { public Form1() { InitializeComponent(); menuStrip1.Renderer = new MenuItemRenderer(); } private void item1ToolStri
阅读全文