public ImagesLibraryClass(CropperForm cropperForm) { m_cropperForm = cropperForm; InitializeFileDialog(); InitializeImagesLibrary(); }
public LudoPDFClass(CropperForm cropperForm) { m_cropperForm = cropperForm; // Set the filename m_filename = ""; InitializeProgressBarForm(); }
public SlotsPanelClass(CropperForm cropperForm,float slotRatio,PanelType type) { float slotWidth; m_slotInd = 0; m_cropperForm = cropperForm; m_type = type; // 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); // If its the last panel, it makes // room for the left button if (m_type == PanelType.Last) { // Set the slot width slotWidth = (m_slotsPanel.Width - ((SLOT_COUNT + 3) * m_gap)) / (float)(SLOT_COUNT + 2); } else { // Set the slot width slotWidth = (m_slotsPanel.Width - ((SLOT_COUNT + 2) * m_gap)) / (float)(SLOT_COUNT + 1); } m_slotsPanel.Height = (int)(slotWidth / 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)); if (m_type == PanelType.Last) { m_slots[i].pb.Location = new Point( (int)((m_gap + slotWidth) + ((i + 1) * m_gap) + (i * slotWidth)), m_gap); } else { 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.06f); InitializeButtons(); // Add the crop panel m_cropperForm.Controls.Add(m_slotsPanel); // Initialize the pdf generator m_PDFDocument = new LudoPDFClass(m_cropperForm); }
public CropPanelClass(CropperForm cropperForm, float slotRatio, PanelType type) { m_type = type; m_cropperForm = cropperForm; m_slotRatio = slotRatio; // 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.CurrSlotsPanel.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); // ARROW BITMAP m_arrowBmp = new Bitmap( Image.FromFile(Application.StartupPath + "//Data//Images//Arrow.png"), m_cropperForm.CurrSlotsPanel.SlotWidth, m_cropperForm.CurrSlotsPanel.SlotWidth); // ARROW POSITION m_arrowPos = new Point(0, 0); // ARROW PICTURE BOX m_arrowPb = new PictureBox(); m_arrowPb.Name = m_cropperForm.m_langDictionary["Arrow Text Create"]; m_arrowPb.Size = new Size( m_arrowBmp.Width, (int)(m_arrowBmp.Width * 1.2f)); if (m_type != PanelType.Last) { m_arrowPb.Location = new Point( ((m_cropperForm.CurrSlotsPanel.SlotCount + 1) * m_cropperForm.CurrSlotsPanel.SlotGap) + (m_cropperForm.CurrSlotsPanel.SlotCount * m_cropperForm.CurrSlotsPanel.SlotWidth), m_cropPanel.Height - m_arrowPb.Height); } else { m_arrowPb.Location = new Point( ((m_cropperForm.CurrSlotsPanel.SlotCount + 2) * m_cropperForm.CurrSlotsPanel.SlotGap) + ((m_cropperForm.CurrSlotsPanel.SlotCount + 1) * m_cropperForm.CurrSlotsPanel.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); // 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); // CCW 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); // CW 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); // COLOR 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); // APPROVE CROP 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); // 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); // ARROW TIMER m_arrowTimer = new Timer(); m_arrowTimer.Interval = 1; m_arrowTimer.Tick += new EventHandler(m_arrowTimer_Tick); }