📄 mainform.h
字号:
MyDlg->ShowDialog();
}
private: System::Void 个人员工档案ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
QueryPersonnelForm^ MyDlg = gcnew QueryPersonnelForm();
MyDlg->MyCompany = this->MyCompany;
MyDlg->ShowDialog();
}
private: System::Void 部门员工档案ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
QueryDepartmentForm^ MyDlg = gcnew QueryDepartmentForm();
MyDlg->MyCompany = this->MyCompany;
MyDlg->ShowDialog();
}
private: System::Void 全部考勤记录ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
QueryAllCheckForm^ MyDlg = gcnew QueryAllCheckForm();
MyDlg->MyCompany = this->MyCompany;
MyDlg->ShowDialog();
}
private: System::Void 全部工资信息ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
QueryPayForm^ MyDlg = gcnew QueryPayForm();
MyDlg->MyCompany = this->MyCompany;
MyDlg->ShowDialog();
}
private: System::Void 操作权限设置ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
OperatorForm^ MyDlg = gcnew OperatorForm();
MyDlg->ShowDialog();
}
private: System::Void 修改用户密码ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
ChangeUserPasswordForm^ MyDlg = gcnew ChangeUserPasswordForm();
MyDlg->用户名称TextBox->Text = this->MyOperator;
MyDlg->ShowDialog();
}
private: System::Void 公司信息设置ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
CompanyForm^ MyDlg = gcnew CompanyForm();
MyDlg->ShowDialog();
StringBuilder^ MyTempPath=gcnew StringBuilder(this->MyBgPhotoShow);
this->GetCompanyInformation();
//生成系统背景图像
if (!System::IO::File::Exists(MyBgPhotoShow))
{
Image^ MyImage = gcnew Bitmap(MyBgPhoto, true);
int PosX = 10;
int PosY = MyImage->Height / 2 + 150;
int MyFont = 150;
bool bMyFound = false;
int MyWidth = MyImage->Width;
int MyHeight = MyImage->Height;
int MySize = MyWidth * MyHeight;
Bitmap^ MyPattern = gcnew Bitmap(MyWidth, MyHeight);
Bitmap^ MyBitmap = gcnew Bitmap(MyImage);
Graphics^ g = Graphics::FromImage(MyPattern);
Graphics^ MyGraphics = Graphics::FromImage(MyImage);
g->Clear(Color::White);
while (bMyFound == false)
{
System::Drawing::Font^ NewFont = gcnew System::Drawing::Font("宋体", MyFont, System::Drawing::FontStyle::Bold);
SizeF^ MyString = gcnew SizeF(MyWidth, MyHeight);
MyString = g->MeasureString(MySlogan, NewFont);
if (MyString->Width < MyPattern->Width)
{
if (MyString->Height < MyPattern->Height)
{
bMyFound = true;
g->DrawString(MySlogan, NewFont, gcnew SolidBrush(Color::Black), PosX, PosY);
}
}
else
MyFont = MyFont - 1;
}
for (int x = 1; x < MyPattern->Width; x++)
{
for (int y = 1; y < MyPattern->Height; y++)
{
int a, re, gr, bl, x1, y1, z1;
if (MyPattern->GetPixel(x, y).ToArgb() == Color::Black.ToArgb())
{
a = MyBitmap->GetPixel(x, y).A;
re = MyBitmap->GetPixel(x, y).R;
gr = MyBitmap->GetPixel(x, y).G;
bl = MyBitmap->GetPixel(x, y).B;
x1 = re;
y1 = gr;
z1 = bl;
if (bl + 25 < 255)
bl = bl + 25;
if (gr + 25 < 255)
gr = gr + 25;
if (re + 25 < 255)
re = re + 25;
if (x1 - 25 > 0)
x1 = x1 - 25;
if (y1 - 25 > 0)
y1 = y1 - 25;
if (z1 - 25 > 0)
z1 = z1 - 25;
MyGraphics->DrawEllipse(gcnew Pen(gcnew SolidBrush(Color::Black)), x, y + 1, 3, 3);
MyGraphics->DrawEllipse(gcnew Pen(gcnew SolidBrush(Color::FromArgb(a, x1, y1, z1))), x, y, 1, 1);
}
}
}
MyGraphics->DrawString("公司地址:" + MyAddress, gcnew System::Drawing::Font("宋体", 12, FontStyle::Regular), gcnew SolidBrush(Color::Yellow), 10, 60);
MyGraphics->DrawString("服务电话:" + MyTel, gcnew System::Drawing::Font("宋体", 12, FontStyle::Regular), gcnew SolidBrush(Color::Yellow), 10, 80);
MyGraphics->DrawString("公司网站:" + MyWeb, gcnew System::Drawing::Font("宋体", 12, FontStyle::Regular), gcnew SolidBrush(Color::Yellow), 10, 100);
MyImage->Save(MyBgPhotoShow, System::Drawing::Imaging::ImageFormat::Jpeg);
}
this->BackgroundImage = gcnew Bitmap(this->MyBgPhotoShow, true);
this->Text = MySlogan;
}
private: System::Void 公司部门设置ToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
DepartmentForm^ MyDlg = gcnew DepartmentForm();
MyDlg->ShowDialog();
}
private: System::Void 系统帮助信息HToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
VersionForm^ MyDlg = gcnew VersionForm();
MyDlg->label1->Text = this->MySlogan;
MyDlg->ShowDialog();
}
private: System::Void 退出A系统EToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
if (MessageBox::Show("您确定现在退出本系统吗?", "信息提示", MessageBoxButtons::YesNo,MessageBoxIcon::Question ) == System::Windows::Forms::DialogResult::Yes)
{
this->Close();
}
}
private: System::Void MainForm_Load(System::Object^ sender, System::EventArgs^ e) {
//添加ThreadException事件关联程序
MyExceptionHandler ^ MyHandler = gcnew MyExceptionHandler;
System::Windows::Forms::Application::ThreadException += gcnew System::Threading::ThreadExceptionEventHandler(MyHandler, &MyExceptionHandler::OnThreadException );
//从公司信息数据表中读取基本信息
this->GetCompanyInformation();
//显示登录对话框
LoginForm^ MyDlg = gcnew LoginForm();
MyDlg->Text = "欢迎使用"+MySlogan;
MyDlg->ShowDialog(this);
this->MyOperator = MyDlg->用户名称TextBox->Text;
//根据用户的操作权限配置系统菜单
SetUserOperateMenu();
//最大化显示系统主窗体
if (MyOperator->Length > 0)
{
this->WindowState = FormWindowState::Maximized;
}
//设置系统背景图像信息
this->BackgroundImage = gcnew Bitmap(this->MyBgPhotoShow, true);
//设置系统标题栏显示文字
this->Text = MySlogan ;
}
//系统异常处理代码
private: System::Void MyThreadException(System::Object^ sender, System::Threading::ThreadExceptionEventArgs^ e)
{
String^ MyInfo = "错误名称:" + e->Exception->Source + ",错误信息:" + e->Exception->Message;
MessageBox::Show(MyInfo, "信息提示", MessageBoxButtons::OK, MessageBoxIcon::Information);
}
//实现在系统关闭前给予用户提示
protected:virtual void WndProc( Message% SystemMessage) override
{
switch (SystemMessage.Msg)
{
case 0x0112:
if (((int)SystemMessage.WParam) ==61536)
{
this->退出A系统EToolStripMenuItem_Click(nullptr,nullptr);
}
else
{
Form::WndProc(SystemMessage);
}
break;
default:
Form::WndProc(SystemMessage);
break;
}
}
//从公司信息数据表中读取基本信息
public: void GetCompanyInformation()
{
String^ MySQLConnectionString =MyPersonnelConnectionString;
String^ MySQL = "Select * From 公司信息 Where 显示优先级=1";
SqlConnection^ MyConnection = gcnew SqlConnection(MySQLConnectionString);
MyConnection->Open();
System::Data::DataTable^ MyTable = gcnew System::Data::DataTable();
SqlDataAdapter^ MyAdapter = gcnew SqlDataAdapter(MySQL, MyConnection);
MyAdapter->Fill(MyTable);
MyBgPhoto = System::Windows::Forms::Application::StartupPath + "\\Data\\" + (String^)MyTable->Rows[0]["管理系统背景照片"];
MyAddress = (String^)MyTable->Rows[0]["公司地址"];
MyTel = (String^)MyTable->Rows[0]["服务电话"];
MyCode = (String^)MyTable->Rows[0]["邮政编码"];
MyWeb = (String^)MyTable->Rows[0]["公司网站"];
MySlogan = (String^)MyTable->Rows[0]["管理系统显示名称"];
MyCompany = (String^)MyTable->Rows[0]["公司名称"];
if (MyConnection->State == ConnectionState::Open)
{
MyConnection->Close();
}
MyBgPhotoShow = System::Windows::Forms::Application::StartupPath + "\\Data\\Show" + (String^)MyTable->Rows[0]["管理系统背景照片"];
}
//根据用户的操作权限配置系统菜单
public: void SetUserOperateMenu()
{
String^ MySQLConnectionString = MyPersonnelConnectionString;
String^ MySQL = "Select *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -