图片框点击不';不起作用
本文关键字:不起作用 | 更新日期: 2023-09-27 18:28:02
这是我遇到问题的一个表单的完整代码
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 MySql.Data.MySqlClient;
namespace office
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void pictureBox1_Click(object sender, EventArgs e)
{
if (Variables.lightsoff == false)
{
pictureBox1.Image = office.Properties.Resources.switch_off_icon;
Variables.lightsoff = true;
}
else
{
pictureBox1.Image = office.Properties.Resources.switch_on_icon;
Variables.lightsoff = false;
}
}
private void pictureBox4_Click(object sender, EventArgs e)
{
if (Variables.screenoff == true)
{
Variables.screenoff = false;
}
else
{
Variables.screenoff = true;
}
}
private void pictureBox3_Click(object sender, EventArgs e)
{
string path;
OpenFileDialog file = new OpenFileDialog();
if (file.ShowDialog() == DialogResult.OK)
{
path = file.FileName;
MessageBox.Show("File has been printed!");
}
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (checkBox1.Checked == true)
{
trackBar1.Visible = true;
label9.Visible = true;
}
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
private void pictureBox2_Click(object sender, EventArgs e)
{
}
private void pictureBox5_Click(object sender, EventArgs e)
{
Bookstore Bookstore = new Bookstore();
Bookstore.ShowDialog();
}
private void pictureBox6_Click(object sender, EventArgs e)
{
Buffet Buffet = new Buffet();
Buffet.ShowDialog();
}
private void button1_Click(object sender, EventArgs e)
{
EventsCalendar Events = new EventsCalendar();
Events.ShowDialog();
}
private void button3_Click(object sender, EventArgs e)
{
}
private void Form2_Load(object sender, EventArgs e)
{
string constring = "datasource=localhost;port=3306;username=root;password=salala;" ;
string Query = "select * from apps.events ";
MySqlConnection conDatabase = new MySqlConnection(constring);
MySqlDataAdapter da = new MySqlDataAdapter(Query, conDatabase);
conDatabase.Open();
DataSet ds = new DataSet();
da.Fill(ds, "select");
DataTable dt = new DataTable();
dt = ds.Tables["select"];
foreach (DataRow dr in dt.Rows)
{
listBox1.Items.Add(dr["event_name"].ToString() + " | " + dr["event_description"].ToString() + " | " + dr["event_date"].ToString() + " | " + dr["event_time"].ToString() + " | " + dr["event_duration"].ToString() + " | " + dr["notification_type"].ToString() + " | " + dr["event_type"].ToString());
}
}
}
}
我不知道为什么,但唯一能调试的是复选框。图片框都不起作用。数据库运行良好。有什么建议吗?提前感谢
这最终是form2.designer的问题,但我仍然不知道是什么导致了这个问题