public void SetLink(string new_file_name, int pTag, string pDstFile, Point pImage_xy, int pImage_width, int pImage_height, string pInput_type) { //원본 데이터에 ADD할 임시 LINK LINK temp_links = new LINK(); //LINK->link_data에 대입할 임시 link_info 리스트 List<link_info> list_temp_link_info = new List<link_info>(); //임시 link_info 리스트에 추가할 내용 link_info temp_link_info = new link_info(); temp_links.file_name = new_file_name; temp_link_info.bttn = new Button(); temp_link_info.btn_id = pTag; temp_link_info.dst_file = pDstFile; temp_link_info.image_xy = pImage_xy; temp_link_info.image_width = pImage_width; temp_link_info.image_height = pImage_height; temp_link_info.input_type = pInput_type; //이미 파일 이름이 links에 존재하면 해당 인덱스에 data만 추가 for (int i = 0; i < links.Count; i++) { if (links[i].file_name.Equals(new_file_name)) { links[i].link_data.Add(temp_link_info); return; } } //존재하지 않으면 파일 이름 포함하여 데이터 전체를 새로운 링크로 추가 //리스트형태의 임시 변수에 temp_link_info를 추가하고 이 변수를 temp_links의 link_data에 대입한다. list_temp_link_info.Add(temp_link_info); temp_links.link_data = list_temp_link_info; links.Add(temp_links); return; }
public int AddLink(string image_name, int addIndex, int pTag, string pDstFile, Point pImage_xy, int pImage_width, int pImage_height, string pInput_type) { link_info plink_info = new link_info(); plink_info.btn_id = pTag; plink_info.bttn = new Button(); plink_info.dst_file = pDstFile; plink_info.image_xy = pImage_xy; plink_info.image_width = pImage_width; plink_info.image_height = pImage_height; plink_info.input_type = pInput_type; //해당 이미지에 처음 링크를 설정하는 것이라면 먼저 new LINK를 새로 추가한다. try { links[addIndex].link_data.Add(plink_info); } catch (ArgumentOutOfRangeException e) { //원본 데이터에 ADD할 임시 LINK LINK temp_links = new LINK(); temp_links.file_name = image_name; //LINK->link_data에 대입할 임시 link_info 리스트 List<link_info> list_temp_link_info = new List<link_info>(); //임시 link_info 리스트에 추가할 내용 link_info temp_link_info = new link_info(); temp_link_info.bttn = new Button(); temp_link_info.btn_id = pTag; temp_link_info.dst_file = pDstFile; temp_link_info.image_xy = pImage_xy; temp_link_info.image_width = pImage_width; temp_link_info.image_height = pImage_height; temp_link_info.input_type = pInput_type; list_temp_link_info.Add(temp_link_info); temp_links.link_data = list_temp_link_info; links.Add(temp_links); } return links[addIndex].link_data.Count - 1; }
private void Form1_Load(object sender, EventArgs e) { //Init for drawing this.myShape = 3; this.myPointStart = new Point(0, 0); this.myPointEnd = new Point(0, 0); this.myPen = new Pen(Color.Lime, 2); this.myPenTemp = new Pen(Color.Lime, 2); this.sizeX = 0; this.sizeY = 0; this.myPress = false; //clear this.link_temp = default(link_info); btn_id_to_add = 0; cm = new ContextMenu(); cm.MenuItems.Add("Delete", new System.EventHandler(this.MenuItemDeleteClick)); //경로 받아오기 - 링크 정보를 추가 수정할 사진 한 장에 대한 경로 string img_path = mfilePath; //@"C:\Users\lewis\Documents\Visual Studio 2015\Projects\workspace\workspace\pic\main.png"; //경로 메인 이미지에 입력 mainImage = Image.FromFile(img_path); image_name = Path.GetFileName(img_path); img = System.Drawing.Image.FromFile(mfilePath); org_width = img.Width; org_height = img.Height; btnOnScreen.Clear(); label_detail_info_title.Font = new Font(pfc.Families[0], 18, FontStyle.Regular); label_info.Font = new Font(pfc.Families[0], 16, FontStyle.Regular); panel_detail_info.Height = (int)(this.Height * 0.8); label_swipe.Font = new Font(pfc.Families[0], 18, FontStyle.Regular); label_zoom.Font = new Font(pfc.Families[0], 18, FontStyle.Regular); //Edit_Image 처음 호출 했을 때 panel1의 사이즈 정하기 if (img != null && (img.Height >= img.Width)) { panel_for_pic.Height = (int)(this.Height * 0.9); panel_for_pic.Width = (int)(GetWidthOverHeight(pData.GetDeviceType()) * (this.Height * 0.9)); //여기에 디바이스정보 넣기 panel_for_pic.Location = new Point(((this.Width / 2) - (panel_for_pic.Width / 2)), 0); resize_ratio = (float)panel_for_pic.Width / (float)img.Width; } else if(img != null && (img.Height < img.Width)) { MessageBox.Show("Landscape는 추후 추가 예정"); } //fpanel_editImage_link.Height = (int)(this.Height * 0.5); //메인이미지를 pictureBox1의 배경으로 설정 listBox1.Height = listBox1.PreferredHeight; pictureBox_main.BackgroundImage = mainImage; groupBox1_Load(); SetLinks(); }