Public Class frmMain

    Private Property Form As Control
    'زر إغلاق البرنامج
    Private Sub btnExit_Click(sender As Object, e As EventArgs)
        End
    End Sub

#Region "Frm Settings"
#Region "HidAR"
    Private Sub lblProgramName_DoubleClick(sender As Object, e As EventArgs) Handles lblProgramName.DoubleClick
        txthid.Visible = True
        txthid.Location = New Point(985, 479)
        txthid.Size = New Drawing.Size(100, 100)
        txthid.Select()
    End Sub

#End Region

    Private Sub btnMinimuz_Click(sender As Object, e As EventArgs)
        WindowState = FormWindowState.Minimized
    End Sub



    Private MouseDown As Boolean = False
    Private LastLoc As Point
    Private Sub pnlMain_MouseDown(sender As Object, e As MouseEventArgs) Handles pnlMain.MouseDown
        MouseDown = True
        pnlMain.Cursor = Cursors.NoMove2D
        LastLoc = e.Location
    End Sub

    Private Sub pnlMain_MouseUp(sender As Object, e As MouseEventArgs) Handles pnlMain.MouseUp
        MouseDown = False
        pnlMain.Cursor = Cursors.Default
    End Sub

    Private Sub pnlMain_MouseMove(sender As Object, e As MouseEventArgs) Handles pnlMain.MouseMove
        If (MouseDown) Then
            Dim NewX As Integer = (Me.Location.X - LastLoc.X) + e.X
            Dim NewY As Integer = (Me.Location.Y - LastLoc.Y) + e.Y
            Me.Location = New Point(NewX, NewY)
        End If
    End Sub

#End Region

    'زر معلومات البرنامج
    Private Sub btnInfo_Click(sender As Object, e As EventArgs)
        MessageBox.Show("Tool name : Store Management." +
                 Environment.NewLine + Environment.NewLine + "إدارة المخازن : أسم الأداة." +
        Environment.NewLine + Environment.NewLine + "Creator name : ( G7 ) . " +
        Environment.NewLine + Environment.NewLine + "أسم المصمم : ( G7 ) ." +
        Environment.NewLine + Environment.NewLine + "Ver 1.0.0" +
        Environment.NewLine + Environment.NewLine + "إصدار رقم : 1.0.0" +
        Environment.NewLine + Environment.NewLine + "The tool created by students of The Higher Institute for E-Commerce System, Sohag." +
        Environment.NewLine + Environment.NewLine + ".تم التصميم بواسطة طلاب المعهد العالى لنظم التجارة الإلكترونية بسوهاج" +
        Environment.NewLine + Environment.NewLine + "Copyright © 2021 All rights and intellectual property rights reserved to Group (7)." +
        Environment.NewLine + Environment.NewLine + ".(7) الاصدار الأول 2021 © جميع الحقوق والملكية الفكرية محفوظة للمجموعة رقم", "Store Management")

    End Sub


    'زر معلومات حول البرنامج
    Private Sub aboutToolStripMenuItem_Click(sender As Object, e As EventArgs)
        MessageBox.Show("Tool name : Store Management." +
                 Environment.NewLine + Environment.NewLine + "إدارة المخازن : أسم الأداة." +
        Environment.NewLine + Environment.NewLine + "Creator name : ( G7 ) . " +
        Environment.NewLine + Environment.NewLine + "أسم المصمم : ( G7 ) ." +
        Environment.NewLine + Environment.NewLine + "Ver 1.0.0" +
        Environment.NewLine + Environment.NewLine + "إصدار رقم : 1.0.0" +
        Environment.NewLine + Environment.NewLine + "The tool created by students of The Higher Institute for E-Commerce System, Sohag." +
        Environment.NewLine + Environment.NewLine + ".تم التصميم بواسطة طلاب المعهد العالى لنظم التجارة الإلكترونية بسوهاج" +
        Environment.NewLine + Environment.NewLine + "Copyright © 2021 All rights and intellectual property rights reserved to Group (7)." +
        Environment.NewLine + Environment.NewLine + ".(7) الاصدار الأول 2021 © جميع الحقوق والملكية الفكرية محفوظة للمجموعة رقم", "Store Management")

    End Sub

    'زر إغلاق البرنامج من ال Tool Bar
    Private Sub closeToolToolStripMenuItem_Click(sender As Object, e As EventArgs)
        Dim Close As New FrmCloseYesNo()
        Close.ShowDialog()
    End Sub


    'متغير حقيقي لمنع إغلاق البرنامج بطريقة خاطئة
    Dim NoCloseProject As Boolean = True
    'حدث اثناء إغلاق البرنامج
    Private Sub frmMain_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
        'الحدث يساوي المتغير
        e.Cancel = NoCloseProject
        'إذا كان الحدث حقيقي قم بإظهار الرسالة
        If (e.Cancel = True) Then
            MessageBox.Show("من الافضل أغلاق البرنامج من زر الأغلاق لتجنب حدوث مشاكل", "معلومات الأمان", MessageBoxButtons.OK, MessageBoxIcon.Warning)
        End If
    End Sub

    'زر ال توول ستريب في المخازن التصنيفات لإظهار فورم التصنيفات
    Private Sub الاصنافToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles btnCategories.Click
        switechpanel(FrmCategories)
    End Sub

    ' زر الاصناف في المخازن لفتح فورم الاصناف
    Private Sub الاصنافToolStripMenuItem1_Click(sender As Object, e As EventArgs)
        Dim ItemsStart As New frmItems
        ItemsStart.ShowDialog()
    End Sub

    Private Sub btnCategories_Click(sender As Object, e As EventArgs)
        switechpanel(FrmCategories)
    End Sub
    Private Sub btnItems_Click(sender As Object, e As EventArgs) Handles btnItems.Click
         switechpanel(frmItems)
    End Sub

    Sub switechpanel(ByVal panel As Form)
        Panel1.Controls.Clear()
        panel.TopLevel = False
        Panel1.Controls.Add(panel)
        panel.Show()

    End Sub

    Private Sub PurchasesInvoice_Click(sender As Object, e As EventArgs) Handles btnPurchasesInvoice.Click
        switechpanel(frmPurchases)

    End Sub

    Private Sub SalesInvoice_Click(sender As Object, e As EventArgs) Handles btnSalesInvoice.Click
        switechpanel(frmSales)
    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        switechpanel(frmClient)
    End Sub

    Private Sub btnhome_Click(sender As Object, e As EventArgs) Handles btnhome.Click
        Dim btnhome As New frmMain
        btnhome.Show()
        Me.Hide()
       
    End Sub

    Private Sub PictureBox3_Click(sender As Object, e As EventArgs) Handles PictureBox3.Click
        FRM_NED.ShowDialog()
    End Sub

    Private Sub PictureBox4_Click(sender As Object, e As EventArgs) Handles PictureBox4.Click
        WindowState = FormWindowState.Minimized
    End Sub

    Private Sub PictureBox5_Click(sender As Object, e As EventArgs) Handles PictureBox5.Click
        MessageBox.Show("اسم البرنامج : G4_phone." +
                   Environment.NewLine + Environment.NewLine + "برنامج ادارة مخازن لشركة موبيلات : وصف الأداة." +
          Environment.NewLine + Environment.NewLine + "Creator name : ( G4.g2 ) . " +
          Environment.NewLine + Environment.NewLine + "أسم المصمم : (G4.g2) ." +
          Environment.NewLine + Environment.NewLine + "The tool created by students of The Higher Institute for E-Commerce System, Sohag." +
          Environment.NewLine + Environment.NewLine + ".تم التصميم بواسطة طلاب المعهد العالى لنظم التجارة الإلكترونية بسوهاج" +
          Environment.NewLine + Environment.NewLine + "Copyright © 2021 All rights and intellectual property rights reserved to Group (G4.g2)." +
          Environment.NewLine + Environment.NewLine + "إصدار رقم : 1.0.0" +
          Environment.NewLine + Environment.NewLine + ".( G4.g2) الاصدار الأول 2020 © جميع الحقوق والملكية الفكرية محفوظة للمجموعة رقم", " G4_phone ")

    End Sub
End Class