public static void SwapCards(Card top, Card bottom) { Page topPage = top.Page; Page bottomPage = bottom.Page; if (topPage != null) { topPage.Card = bottom; } if (bottomPage != null) { bottomPage.Card = top; } top.Page = bottomPage; bottom.Page = topPage; object p = bottom.Parent; bottom.Parent = top.Parent; top.Parent = (Control)p; if (top.Page == null && top.ImageLocation == null) { top.Parent.Parent = null; top.Parent = null; top = null; } if (bottom.Page == null && bottom.ImageLocation == null) { bottom.Parent.Parent = null; bottom.Parent = null; bottom = null; } }
public Card AddBlankCard(FlowLayoutPanel fp) { fp.SuspendLayout(); FlowLayoutPanel pictureContainer = new FlowLayoutPanel(); pictureContainer.Width = 77; pictureContainer.Height = 90; pictureContainer.AutoSize = false; pictureContainer.AutoScroll = false; pictureContainer.BorderStyle = BorderStyle.FixedSingle; Card picture = new Card(); picture.ImageLocation = null; //add card to cardlist cards.Add(picture); picture.Width = 68; picture.Height = 81; picture.AutoSize = false; picture.BorderStyle = BorderStyle.FixedSingle; picture.SizeMode = PictureBoxSizeMode.StretchImage; pictureContainer.Controls.Add(picture); //init drang and drop events picture.Visible = true; picture.BorderStyle = BorderStyle.FixedSingle; picture.DragEnter += picture_DragEnter; picture.DragDrop += picture_DragDrop; picture.MouseDown += picture_MouseDown; picture.AllowDrop = true; fp.Controls.Add(pictureContainer); fp.ResumeLayout(true); return picture; }
public void AddBlankCardToBottom() { int check = 0; if (fLPItemNotFound.Controls.Count == 0) { check++; } else { foreach (Control control in fLPItemNotFound.Controls) { foreach (var item in control.Controls) { if (item.GetType() == typeof(Card)) { if ((item as Card).Page == null) { check++; } } } } } if (check == 1) { fLPItemNotFound.SuspendLayout(); FlowLayoutPanel pictureContainer = new FlowLayoutPanel(); pictureContainer.Width = 77; pictureContainer.Height = 90; pictureContainer.AutoSize = false; pictureContainer.AutoScroll = false; pictureContainer.BorderStyle = BorderStyle.FixedSingle; Card picture = new Card(); picture.ImageLocation = null; //add card to cardlist cards.Add(picture); picture.Width = 68; picture.Height = 81; picture.AutoSize = false; picture.BorderStyle = BorderStyle.FixedSingle; picture.SizeMode = PictureBoxSizeMode.StretchImage; pictureContainer.Controls.Add(picture); //init drang and drop events picture.Visible = true; picture.BorderStyle = BorderStyle.FixedSingle; picture.DragEnter += picture_DragEnter; picture.DragDrop += picture_DragDrop; picture.MouseDown += picture_MouseDown; picture.AllowDrop = true; fLPItemNotFound.Controls.Add(pictureContainer); fLPItemNotFound.ResumeLayout(true); } }
void picture_MouseDown(object sender, MouseEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Right) { ImageZoom iz = new ImageZoom((sender as PictureBox).Image); iz.ShowDialog(); return; } currSelectedImg = sender as Card; currentCard = sender as Card; (sender as Card).DoDragDrop((sender as Card), DragDropEffects.Copy); }
private void cmdScanDoc_Click(object sender, EventArgs e) { try { //Sort pdf files by date CurrentDoc = new DirectoryInfo(PDFFolder) .GetFiles("*.pdf") .OrderByDescending(f => f.CreationTime) .ToArray(); if (Directory.GetFiles(PDFFolder).Length == 0) { MessageBox.Show("You do not have any PDF's to import"); return; } CurrentFullPDF = CurrentDoc[0].FullName; } catch (Exception ef ) { MessageBox.Show("cannot find pdf files check if you have any left"); return; } List<Dictionary<int, string>> tiffLocations = new List<Dictionary<int, string>>(); if (PDFFolder != "") { tiffLocations = PDFFunctions.createTiffFiles(@CurrentDoc[0].DirectoryName + "\\" + CurrentDoc[0].Name); foreach (var card in tiffLocations[0]) { FlowLayoutPanel pictureContainer = new FlowLayoutPanel(); pictureContainer.Width = 77; pictureContainer.Height = 90; pictureContainer.AutoSize = false; pictureContainer.AutoScroll = false; pictureContainer.BorderStyle = BorderStyle.FixedSingle; fLPItemNotFound.Controls.Add(pictureContainer); Card picture = new Card(); picture.ImageLocation = @card.Value; //Set low res path foreach (var lowRes in tiffLocations[1]) { string highResToLowResPath = picture.ImageLocation.Replace("highRes", "lowRes"); if (lowRes.Value == highResToLowResPath) { picture.ImageLocationLR = lowRes.Value; } } picture.PageText = PDFFunctions.imageToText(@card.Value); //add card to cardlist cards.Add(picture); picture.Width = 68; picture.Height = 81; picture.AutoSize = false; picture.Image = Bitmap.FromFile(picture.ImageLocation); picture.BorderStyle = BorderStyle.FixedSingle; picture.SizeMode = PictureBoxSizeMode.StretchImage; pictureContainer.Controls.Add(picture); //init drang and drop events picture.Visible = true; picture.BorderStyle = BorderStyle.FixedSingle; picture.DragEnter += picture_DragEnter; picture.DragDrop += picture_DragDrop; picture.MouseDown += picture_MouseDown; picture.AllowDrop = true; } currSelectedImg = new Card(); //Swap cards from fLPItemNotFound to proper cards cardSort(); //remoce blanks from borrom RemoveAllFromBottomAndAddBlank(); //try to apply a name to the filter based on the txt in the app try { string name = GridHelper.GetClientName(applications); ((ColumnView)gridControl1.Views[0]).FindFilterText = name; if (name != "") { txtFastNumber.Text = ((ColumnView)gridControl1.Views[0]).GetFocusedRowCellValue("Client.FAST") != null ? ((ColumnView)gridControl1.Views[0]).GetFocusedRowCellValue("Client.FAST").ToString() : ""; txtFirstName.Text = ((ColumnView)gridControl1.Views[0]).GetFocusedRowCellValue("Client.FirstName") != null ? ((ColumnView)gridControl1.Views[0]).GetFocusedRowCellValue("Client.FirstName").ToString() : ""; txtLastName.Text = ((ColumnView)gridControl1.Views[0]).GetFocusedRowCellValue("Client.LastName") != null ? ((ColumnView)gridControl1.Views[0]).GetFocusedRowCellValue("Client.LastName").ToString() : ""; txtStreetAddress.Text = ((ColumnView)gridControl1.Views[0]).GetFocusedRowCellValue("Address.StreetAddress1") != null ? ((ColumnView)gridControl1.Views[0]).GetFocusedRowCellValue("Address.StreetAddress1").ToString() : ""; txtFullAddress.Text = ((ColumnView)gridControl1.Views[0]).GetFocusedRowCellValue("Address.FullAddress") != null ? ((ColumnView)gridControl1.Views[0]).GetFocusedRowCellValue("Address.FullAddress").ToString() : ""; txtCity.Text = ((ColumnView)gridControl1.Views[0]).GetFocusedRowCellValue("Address.City.Name") != null ? ((ColumnView)gridControl1.Views[0]).GetFocusedRowCellValue("Address.City.Name").ToString() : ""; txtLDC.Text = ((ColumnView)gridControl1.Views[0]).GetFocusedRowCellValue("LDC.Name") != null ? ((ColumnView)gridControl1.Views[0]).GetFocusedRowCellValue("LDC.Name").ToString() : ""; txtAppType.Text = ((ColumnView)gridControl1.Views[0]).GetFocusedRowCellValue("ApplicationType") != null ? ((ColumnView)gridControl1.Views[0]).GetFocusedRowCellValue("ApplicationType").ToString() : ""; } } catch (Exception ex) { } } else { System.Windows.Forms.MessageBox.Show("Please select excel folder path."); } }
void cmdAddApplication_Click(object sender, EventArgs e) { try { NewAppWizard wizard = new NewAppWizard(); wizard.ShowDialog(); PDFScanAndSort.Models.Application app = wizard.Application; wizard.Dispose(); GroupControl gc = new GroupControl(); gc.Text = app.Name; gc.Dock = DockStyle.Top; gc.Width = 446; gc.Height = 165; xtraScrollableControl1.Controls.Add(gc); xtraScrollableControl1.Controls.SetChildIndex(gc, 0); FlowLayoutPanel panelLong = new FlowLayoutPanel(); panelLong.Width = 442; panelLong.Height = 142; panelLong.AutoSize = false; panelLong.AutoScroll = true; panelLong.WrapContents = false; panelLong.Dock = DockStyle.Top; panelLong.HorizontalScroll.Value = 0; gc.Controls.Add(panelLong); //create application class app.Name = app.Name; applications.Add(app); for (int i = 0; i < app.NumberOfPages; i++) { FlowLayoutPanel pictureContainer = new FlowLayoutPanel(); pictureContainer.Width = 85; pictureContainer.Height = 111; pictureContainer.AutoSize = false; pictureContainer.AutoScroll = false; pictureContainer.BorderStyle = BorderStyle.FixedSingle; panelLong.Controls.Add(pictureContainer); Card picture = new Card(); picture.Width = 76; picture.Height = 75; picture.AutoSize = false; //picture.Image = Bitmap.FromFile(item); picture.BorderStyle = BorderStyle.FixedSingle; picture.SizeMode = PictureBoxSizeMode.StretchImage; pictureContainer.Controls.Add(picture); picture.Visible = true; picture.BorderStyle = BorderStyle.FixedSingle; picture.DragEnter += picture_DragEnter; picture.DragDrop += picture_DragDrop; picture.MouseDown += picture_MouseDown; picture.AllowDrop = true; Page page = new Page(); page.Card = picture; picture.Page = page; picture.Page.PageNumber = i; cards.Add(picture); // card.PageNumber = i; page.Application = app; // page.PictureBox = picture; app.Pages.Add(page); } //add the add and subtract buttons FlowLayoutPanel btnContainer = new FlowLayoutPanel(); btnContainer.Width = 42; btnContainer.Height = 111; btnContainer.AutoSize = false; btnContainer.AutoScroll = false; btnContainer.BorderStyle = BorderStyle.FixedSingle; btnContainer.WrapContents = true; SimpleButton newbtn = new SimpleButton(); newbtn.Text = "+"; newbtn.Width = 33; newbtn.Height = 48; newbtn.Click += newbtn_Click; SimpleButton removebtn = new SimpleButton(); removebtn.Text = "-"; removebtn.Width = 33; removebtn.Height = 48; removebtn.Click += removebtn_Click; btnContainer.Controls.Add(newbtn); btnContainer.Controls.Add(removebtn); panelLong.Controls.Add(btnContainer); } catch (Exception) { throw; } }
private void RefreshApplicationGUI() { //add new application button SimpleButton cmdAddApplication = new SimpleButton(); cmdAddApplication.Text = "Add New Application"; cmdAddApplication.Dock = DockStyle.Bottom; cmdAddApplication.Click += cmdAddApplication_Click; xtraScrollableControl1.Controls.Add(cmdAddApplication); //create apps in the UI var groupedAppList = records .GroupBy(u => u.Application) .Select(grp => grp.ToList()) .ToList(); foreach (var item in groupedAppList) { GroupControl gc = new GroupControl(); gc.Text = item[0].Application; gc.Dock = DockStyle.Top; gc.Width = 446; gc.Height = 165; xtraScrollableControl1.Controls.Add(gc); FlowLayoutPanel panelLong = new FlowLayoutPanel(); panelLong.Width = 442; panelLong.Height = 142; panelLong.AutoSize = false; panelLong.AutoScroll = true; panelLong.WrapContents = false; panelLong.Dock = DockStyle.Top; panelLong.HorizontalScroll.Value = 0; gc.Controls.Add(panelLong); //create application class PDFScanAndSort.Models.Application app = new PDFScanAndSort.Models.Application(); app.Name = item[0].Application; applications.Add(app); int i = 1; foreach (var rr in item) { FlowLayoutPanel pictureContainer = new FlowLayoutPanel(); pictureContainer.Width = 85; pictureContainer.Height = 111; pictureContainer.AutoSize = false; pictureContainer.AutoScroll = false; pictureContainer.BorderStyle = BorderStyle.FixedSingle; panelLong.Controls.Add(pictureContainer); Card picture = new Card(); picture.Width = 76; picture.Height = 75; picture.AutoSize = false; //picture.Image = Bitmap.FromFile(item); picture.BorderStyle = BorderStyle.FixedSingle; picture.SizeMode = PictureBoxSizeMode.StretchImage; pictureContainer.Controls.Add(picture); picture.Visible = true; picture.BorderStyle = BorderStyle.FixedSingle; picture.DragEnter += picture_DragEnter; picture.DragDrop += picture_DragDrop; picture.MouseDown += picture_MouseDown; picture.AllowDrop = true; Page page = new Page(); page.Card = picture; page.SearchStrings = rr.SearchTermStringList; picture.Page = page; picture.Page.PageNumber = i; cards.Add(picture); // card.PageNumber = i; page.Application = app; // page.PictureBox = picture; app.Pages.Add(page); i++; } //add the add and subtract buttons FlowLayoutPanel btnContainer = new FlowLayoutPanel(); btnContainer.Width = 42; btnContainer.Height = 111; btnContainer.AutoSize = false; btnContainer.AutoScroll = false; btnContainer.BorderStyle = BorderStyle.FixedSingle; btnContainer.WrapContents = true; SimpleButton newbtn = new SimpleButton(); newbtn.Text = "+"; newbtn.Width = 33; newbtn.Height = 48; newbtn.Click += newbtn_Click; SimpleButton removebtn = new SimpleButton(); removebtn.Text= "-"; removebtn.Width = 33; removebtn.Height = 48; removebtn.Click += removebtn_Click; btnContainer.Controls.Add(newbtn); btnContainer.Controls.Add(removebtn); panelLong.Controls.Add(btnContainer); } }