public ImagesLibraryClass(CropperForm cropperForm) { m_cropperForm = cropperForm; InitializeFileDialog(); InitializeImagesLibrary(); }
public DominoPDFClass(CropperForm cropperForm) { m_cropperForm = cropperForm; // Create a pdf reader PdfReader pdfReader = new PdfReader(Application.StartupPath + "//Data//PDF//Domino_PDF//Domino_Pattern.pdf"); // Get the pattern pdf file dimensions m_pageSize = new iTextSharp.text.Rectangle(0, 0); m_pageSize = pdfReader.GetPageSize(1); // Set the document var to null m_document = null; m_filename = ""; InitializeProgressBarForm(); }
public SlotsPanelClass(CropperForm cropperForm) { float slotWidth; m_slotInd = 0; m_cropperForm = cropperForm; // Initialize the slots panel m_slotsPanel = new Panel(); m_slotsPanel.BackColor = Color.FromArgb(255,78,78,78); m_slotsPanel.Width = m_cropperForm.ClientSize.Width - m_cropperForm.m_imagesLibrary.Width; // Set the slots gap m_gap = (int)(m_slotsPanel.Width * 0.005f); // Set the slot width slotWidth = (m_slotsPanel.Width - ((SLOT_COUNT + 2) * m_gap)) / (float)(SLOT_COUNT + 1); m_slotsPanel.Height = (int)(slotWidth / (float)m_cropperForm.SlotRatio) + (2 * m_gap); m_slotsPanel.Location = new Point( m_cropperForm.m_imagesLibrary.Width, m_cropperForm.ClientSize.Height - m_slotsPanel.Height); m_slotsPanel.Paint += new PaintEventHandler(slotsPanelPaint); // Initialize the slots m_slots = new Slot[SLOT_COUNT]; for (int i = 0; i < m_slots.Length; i++) { m_slots[i] = new Slot(); m_slots[i].pb = new PictureBox(); m_slots[i].pb.Size = new Size((int)slotWidth,m_slotsPanel.Height - (2 * m_gap)); m_slots[i].pb.Location = new Point((int)(((i + 1) * m_gap) + (i * slotWidth)),m_gap); m_slots[i].pb.Cursor = Cursors.Hand; m_slots[i].pb.BackgroundImage = new Bitmap(Application.StartupPath + "//Data//Images//Slot.png"); m_slots[i].pb.BackgroundImageLayout = ImageLayout.Stretch; m_slots[i].pb.Click += new EventHandler(slotClick); m_slots[i].pb.Paint += new PaintEventHandler(slotPaint); // Set the defualt crop tool color m_slots[i].Color = Color.FromArgb(100,255,0,0); // Set the slot to not approved m_slots[i].Approved = false; // Add the slot picture box m_slotsPanel.Controls.Add(m_slots[i].pb); } m_destRect = new System.Drawing.Rectangle(0,0,m_slots[0].Width,m_slots[0].Height); m_font = new Font("Arial",m_slots[0].Height * 0.08f); // Initialize the 'create pdf' button Button createPDF = new Button(); createPDF.Size = m_slots[0].Size; createPDF.Location = new Point(m_slots.Last().Location.X + createPDF.Width + m_gap,m_gap); createPDF.BackColor = Color.FromArgb(255,220,208,192); createPDF.Text = m_cropperForm.m_langDictionary["Create PDF"]; createPDF.Font = m_font; createPDF.FlatStyle = FlatStyle.Flat; createPDF.FlatAppearance.BorderSize = 0; createPDF.Cursor = Cursors.Hand; createPDF.Click += new EventHandler(createPDF_Click); m_slotsPanel.Controls.Add(createPDF); m_cropperForm.Controls.Add(m_slotsPanel); // Initialize the pdf generator m_PDFDocument = new DominoPDFClass(m_cropperForm); }
public CropPanelClass(CropperForm cropperForm) { m_cropperForm = cropperForm; m_slotRatio = m_cropperForm.SlotRatio; // Initialize the crop panel m_cropPanel = new Panel(); m_cropPanel.Width = m_cropperForm.ClientSize.Width - m_cropperForm.m_imagesLibrary.Width; m_cropPanel.Height = m_cropperForm.ClientSize.Height - m_cropperForm.m_menuStrip.Height - m_cropperForm.m_slotsPanel.Height; m_cropPanel.Location = new Point(m_cropperForm.m_imagesLibrary.Width, m_cropperForm.m_menuStrip.Height); m_cropPanel.BackgroundImageLayout = ImageLayout.Center; m_cropPanel.BackgroundImageChanged += new EventHandler(m_cropPanel_BackgroundImageChanged); m_cropPanel.Paint += new PaintEventHandler(m_cropPanel_Paint); m_cropperForm.Controls.Add(m_cropPanel); // Create the arrow bitmap m_arrowBmp = new Bitmap( Image.FromFile(Application.StartupPath + "//Data//Images//Arrow.png"), m_cropperForm.m_slotsPanel.SlotWidth, m_cropperForm.m_slotsPanel.SlotWidth); // Initialize the arrow position m_arrowPos = new Point(0, 0); // Create the arrow picture box m_arrowPb = new PictureBox(); m_arrowPb.Size = new Size( m_arrowBmp.Width, (int)(m_arrowBmp.Width * 1.2f)); m_arrowPb.Location = new Point( ((m_cropperForm.m_slotsPanel.SlotCount + 1) * m_cropperForm.m_slotsPanel.SlotGap) + (m_cropperForm.m_slotsPanel.SlotCount * m_cropperForm.m_slotsPanel.SlotWidth), m_cropPanel.Height - m_arrowPb.Height); m_arrowPb.Image = m_arrowBmp; m_arrowPb.Tag = true; // Means the arrow goes down at first m_arrowPb.BackColor = Color.Transparent; m_arrowPb.Visible = false; m_cropPanel.Controls.Add(m_arrowPb); // Create the delete button m_deleteBut = new Button(); m_deleteBut.BackgroundImageLayout = ImageLayout.Stretch; m_deleteBut.BackColor = Color.Black; m_deleteBut.BackgroundImage = new Bitmap(Application.StartupPath + "//Data//Images//X.png"); m_deleteBut.Size = new Size((int)(m_cropPanel.Width * 0.03f), (int)(m_cropPanel.Width * 0.03f)); m_deleteBut.Cursor = Cursors.Hand; m_deleteBut.Visible = false; m_deleteBut.Click += new EventHandler(m_deleteBut_Click); m_cropPanel.Controls.Add(m_deleteBut); // Create the color palette button m_CCWButt = new Button();; m_CCWButt.Name = "CCW"; m_CCWButt.BackgroundImageLayout = ImageLayout.Stretch; m_CCWButt.BackColor = Color.Black; m_CCWButt.BackgroundImage = new Bitmap(Application.StartupPath + "//Data//Images//CW.png"); m_CCWButt.BackgroundImage.RotateFlip(RotateFlipType.RotateNoneFlipX); m_CCWButt.Size = new Size((int)(m_cropPanel.Width * 0.03f), (int)(m_cropPanel.Width * 0.03f)); m_CCWButt.Location = new Point(m_deleteBut.Width, 0); m_CCWButt.Cursor = Cursors.Hand; m_CCWButt.Visible = false; m_CCWButt.Click += new EventHandler(rotateButt_Click); m_cropPanel.Controls.Add(m_CCWButt); // Create the color palette button m_CWButt = new Button();; m_CWButt.Name = "CW"; m_CWButt.BackgroundImageLayout = ImageLayout.Stretch; m_CWButt.BackColor = Color.Black; m_CWButt.BackgroundImage = new Bitmap(Application.StartupPath + "//Data//Images//CW.png"); m_CWButt.Size = new Size((int)(m_cropPanel.Width * 0.03f), (int)(m_cropPanel.Width * 0.03f)); m_CWButt.Location = new Point(2 * m_deleteBut.Width, 0); m_CWButt.Cursor = Cursors.Hand; m_CWButt.Visible = false; m_CWButt.Click += new EventHandler(rotateButt_Click); m_cropPanel.Controls.Add(m_CWButt); // Create the color dialog button m_colorBut = new Button(); m_colorBut.BackColor = Color.Red; m_colorBut.Size = new Size((int)(m_cropPanel.Width * 0.03f), (int)(m_cropPanel.Width * 0.03f)); m_colorBut.Location = new Point(3 * m_deleteBut.Width, 0); m_colorBut.Cursor = Cursors.Hand; m_colorBut.Visible = false; m_colorBut.Click += new EventHandler(m_colorBut_Click); m_cropPanel.Controls.Add(m_colorBut); // Create the color aprove crop button m_approveCrop = new Button(); m_approveCrop.BackgroundImageLayout = ImageLayout.Stretch; m_approveCrop.BackColor = Color.Black; m_approveCrop.BackgroundImage = new Bitmap(Application.StartupPath + "//Data//Images//V.png"); m_approveCrop.Size = new Size((int)(m_cropPanel.Width * 0.03f), (int)(m_cropPanel.Width * 0.03f)); m_approveCrop.Location = new Point(4 * m_deleteBut.Width, 0); m_approveCrop.Cursor = Cursors.Hand; m_approveCrop.Visible = false; m_approveCrop.Click += new EventHandler(m_approveCrop_Click); m_cropPanel.Controls.Add(m_approveCrop); // Crop rectangle variables m_cropAction = CropAction.NONE; m_newLocation = new Point(); m_prevMouse = new Point(); m_scaleRadius = 6; m_scaleDir = Direction.CENTER; // Crop rectangle m_cropRect = new Rectangle(); // Main picture box m_cropPb = new PictureBox(); m_cropPb.Visible = false; m_cropPb.MouseMove += new MouseEventHandler(m_cropPb_MouseMove); m_cropPb.MouseDown += new MouseEventHandler(m_cropPb_MouseDown); m_cropPb.MouseUp += new MouseEventHandler(m_cropPb_MouseUp); m_cropPb.Paint += new PaintEventHandler(m_cropPb_Paint); m_cropPanel.Controls.Add(m_cropPb); // Initialize the logo bitmap Image logoImage = Image.FromFile(Application.StartupPath + "//Data//Images//Subli-art logo.png"); float logoWidth = m_cropPanel.Width * 0.3f; float logoHeight = logoWidth / (logoImage.Width / (float)logoImage.Height); m_logoSize = new Size((int)logoWidth, (int)logoHeight); m_logo = new Bitmap(logoImage, m_logoSize); // Initialize the arrow timer m_arrowTimer = new Timer(); m_arrowTimer.Interval = 1; m_arrowTimer.Tick += new EventHandler(m_arrowTimer_Tick); }