有人能帮我解决一个问题吗?我创建了一个 C# 表单,使用 VSE2012 express for desktop 和 VSE2013 express for Desktop,表单大小保持默认,并添加了一个完全默认的按钮。该按钮编码用于打开和关闭数据库连接。
当单击按钮时,表单及其内容都会缩小约 25%,我尝试了所有默认设置,但都没有成功。我甚至用文本文件替换了访问数据库文件,仍然会出现这种情况。在 Windows 7 和 8.1 上都尝试过。
Form1.cs(所有代码)
当单击按钮时,表单及其内容都会缩小约 25%,我尝试了所有默认设置,但都没有成功。我甚至用文本文件替换了访问数据库文件,仍然会出现这种情况。在 Windows 7 和 8.1 上都尝试过。
Form1.cs(所有代码)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.OleDb;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
OleDbConnection myConn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;"
+ @"Data Source="
+ @"..\..\..\x.accdb");
private void button1_Click(object sender, EventArgs e)
{
try
{
myConn.Open();
myConn.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}
未编辑的Form1.Designer.cs
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(106, 138);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(282, 253);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
#endregion
OleDbConnection
是问题的原因。如果没有它,它能正常工作吗?您安装了任何IntelliPoint / Logitech鼠标助手吗? - CodeCaster