基本信息
源码名称:自定义电脑装机配置
源码大小:6.95M
文件格式:.rar
开发语言:C#
更新时间:2022-04-14
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 10 元 
   源码介绍

输入各库存部品

然后就进行配置



using Models;
using Sunny.UI;
using System; 
using System.Windows.Forms;
using Tools;

namespace Computer
{
    public partial class Form1 : UIForm
    {
        public static string Db = Environment.CurrentDirectory   @"/Data/" Properties.Settings.Default.BaseDB; 
        public static string Table = nameof(BaseItem);
        public Form1()
        {
            InitializeComponent(); 
            Load  = Form1_Load;
            this.tmsCpu.Click  = TmsCpu_Click1;
            this.tmsGraphicsCard.Click  = TmsGraphicsCard_Click;
            this.tmsHeatDissipation.Click  = TmsHeatDissipation_Click;
            this.tmsMainBoard.Click  = TmsMainBoard_Click;
            this.tmsRam.Click  = TmsRam_Click;
            this.tsmBox.Click  = TsmBox_Click;
            this.tsmOther.Click  = TsmOther_Click;
            this.tsmHandDisk.Click  = TsmHandDisk_Click;
            this.tsmDisplay.Click  = TsmDisplay_Click;
            this.tsmPower.Click  = TsmPower_Click;
            this.tsmMain.Click  = TsmMain_Click;
        }

        private void TsmMain_Click(object sender, EventArgs e)
        {
            FrmMain a = new FrmMain();
            a.MdiParent = this;
            a.WindowState = System.Windows.Forms.FormWindowState.Maximized;
            a.Show();
        }

        private void TsmPower_Click(object sender, EventArgs e)
        {
            Form2 a = new Form2(CType.电源);
            Show(a);
        }
        private void Show(Form2 a)
        {
            a.MdiParent = this;
            a.WindowState = System.Windows.Forms.FormWindowState.Maximized;
            a.Show();
        }
        private void TsmDisplay_Click(object sender, EventArgs e)
        {
            Form2 a = new Form2(CType.显示器);
            Show(a);
        }


        private void TsmHandDisk_Click(object sender, EventArgs e)
        {
            Form2 a = new Form2(CType.硬盘);
            Show(a);
        }

        private void TsmOther_Click(object sender, EventArgs e)
        {
            Form2 a = new Form2(CType.其他);
            Show(a);
        }

        private void TsmBox_Click(object sender, EventArgs e)
        {
            Form2 a = new Form2(CType.机箱);
            Show(a);
        }

        private void TmsRam_Click(object sender, EventArgs e)
        {
            Form2 a = new Form2(CType.内存);
            Show(a);
        }

        private void TmsMainBoard_Click(object sender, EventArgs e)
        {
            Form2 a = new Form2(CType.主板);
            Show(a);
        }

        private void TmsHeatDissipation_Click(object sender, EventArgs e)
        {
            Form2 a = new Form2(CType.散热);
            Show(a);
        }

        private void TmsGraphicsCard_Click(object sender, EventArgs e)
        {
            Form2 a = new Form2(CType.显卡);
            Show(a);
        }

        private void TmsCpu_Click1(object sender, EventArgs e)
        {
            try
            {
                Form2 a = new Form2(CType.CPU);
                Show(a);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            try
            { 
                this.menuStrip1.Items[0].MouseHover  = new EventHandler(Form1_MouseHover);
                //检查数据库是否存在
                SqlLiteHelper.CreateDBFile(Db);
                if (!SqlLiteHelper.CheckTable(Db, Table))
                {
                    string sql = new CPU().CreateTableSql();
                    SqlLiteHelper.CreateTable(Db, sql);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void Form1_MouseHover(object sender, EventArgs e)
        {
            if (sender is ToolStripDropDownItem)
            {
                ToolStripDropDownItem item = sender as ToolStripDropDownItem;
                if (item.HasDropDownItems && !item.DropDown.Visible)
                {
                    item.ShowDropDown();
                }
            }
        } 
    }
}