private void setControlEggSti() { eggs = ic.ivfDB.eggsDB.selectByPk1(txtId.Text); if (txtId.Text.Equals("")) { } else { ic.setC1Combo(cboDoctor, eggs.doctor_id); txtVisitLMP.Value = eggs.lmp_date; } chkAbnormal.Checked = eggs.status_abnormal.Equals("1") ? true : false; chkTyping.Checked = eggs.status_typing.Equals("1") ? true : false; chkOther.Checked = eggs.status_typing_other.Equals("1") ? true : false; chkInfection.Checked = eggs.status_infectious.Equals("1") ? true : false; chkAmh.Checked = eggs.status_add_lab.Equals("1") ? true : false; txtAbnormal1.Value = eggs.abnormal1; txtAbnormal2.Value = eggs.abnormal2; ic.setC1ComboByName(cboOther, eggs.typing_other); ic.setC1ComboByName(cboBhcg, eggs.bhcg_test); ic.setC1ComboByName(cboAmh, eggs.add_lab); txtG.Value = eggs.g; txtP.Value = eggs.p; txtA.Value = eggs.a; setGrfEggStiDay(); }
private void BtnNew_Click(object sender, EventArgs e) { //throw new NotImplementedException(); txtId.Value = ""; txtThai.Value = ""; txtEng.Value = ""; txtQty.Value = ""; txtRemark.Value = ""; ic.setC1Combo(cboDrugName, ""); }
private void setControl() { Boolean chkNew = false; labPresc = ic.ivfDB.lPrescDB.selectByPk(id); if (labPresc.presc_id.Equals("")) { labPresc = ic.ivfDB.lPrescDB.selectByOpuFetID(opufetid); if (labPresc.presc_id.Equals("")) { labPresc = ic.ivfDB.lPrescDB.selectByHN(hn); if (labPresc.presc_id.Equals("")) { chkNew = true; } } } txtID.Value = labPresc.presc_id; if (!chkNew) { opufetid = labPresc.opu_fet_id; hn = labPresc.visit_hn; } txtDate.Value = labPresc.presc_date; //cboPkg.SelectedItem labPresc.pkg_id = cboPkg.SelectedItem == null ? "" : ((ComboBoxItem)cboPkg.SelectedItem).Value; ic.setC1Combo(cboPkg, labPresc.pkg_id); chkEmbryoFreezing.Checked = labPresc.status_embryo_freezing.Equals("1") ? true : false; txtEmbryoFreezing.Value = labPresc.embryo_freezing; txtEmbryoStraws.Value = labPresc.embryo_straws; txtEmbryoStrawsExtra.Value = labPresc.embryo_straws_extra; chkNGS.Checked = labPresc.status_ngs.Equals("1") ? true :false; txtNGSEmbryo.Value = labPresc.embryo_ngs; txtNGSExtra.Value = labPresc.embryo_ngs_extra; chkPGS.Checked = labPresc.status_pgs.Equals("1") ? true : false; txtPGSEmbryo.Value = labPresc.embryo_pgs; txtPGSExtra.Value = labPresc.embryo_pgs_extra; chkDay6.Checked = labPresc.status_day6.Equals("1") ? true : false; chkAssistedHatching.Checked = labPresc.status_assisted_hatching.Equals("1") ? true : false; chkHA.Checked = labPresc.status_ha.Equals("1") ? true : false; chkSpermSelection.Checked = labPresc.status_sperm_selection.Equals("1") ? true : false; txtSpermSelection.Value = labPresc.sperm_selection; chkSpermPrecaution.Checked = labPresc.status_sperm_precaution.Equals("1") ? true : false; txtSpermPrecaution.Value = labPresc.sperm_precaution; chkEmbryoGlue.Checked = labPresc.status_embryo_glue.Equals("1") ? true : false; chkEmbryoRemaining.Checked = labPresc.status_embryo_remaining.Equals("1") ? true : false; txtEmbryoRemaining.Value = labPresc.embryo_remaining; chkDiscardAll.Checked = labPresc.status_discard_all.Equals("1") ? true : false; ic.setC1Combo(cboStfId, labPresc.staff_id); ic.setC1Combo(cboChkId, labPresc.checkby_id); }
private void setControl(String posiId) { dgss = ic.ivfDB.dgssDB.selectByPk(posiId); ic.setC1Combo(cboDocGroupName, dgss.doc_group_id); txtID.Value = dgss.doc_group_sub_id; txtDocGroupSubName.Value = dgss.doc_group_sub_name; }
private void setControl(String posiId) { sitm = ic.ivfDB.oSItmDB.selectByPk1(posiId); ic.setC1Combo(cboDocGroupName, sitm.BillGroupID); txtID.Value = sitm.SID; txtDocGroupSubName.Value = sitm.SName; txtPrice.Value = sitm.Price; }
private void initConfig() { fEdit = new Font(ic.iniC.grdViewFontName, ic.grdViewFontSize, FontStyle.Regular); fEditB = new Font(ic.iniC.grdViewFontName, ic.grdViewFontSize, FontStyle.Bold); //// Initialize the RasterCodecs object //_rasterCodecs = new RasterCodecs(); //_imageViewer = new Leadtools.Controls.ImageViewer(); //this._imageViewer.BackColor = System.Drawing.SystemColors.AppWorkspace; //this._imageViewer.BorderStyle = System.Windows.Forms.BorderStyle.None; //this._imageViewer.Cursor = System.Windows.Forms.Cursors.Cross; //this._imageViewer.Dock = System.Windows.Forms.DockStyle.Fill; //this._imageViewer.ViewHorizontalAlignment = Leadtools.Controls.ControlAlignment.Center; //this._imageViewer.Location = new System.Drawing.Point(0, 195); //this._imageViewer.Name = "_rasterImageViewer"; //this._imageViewer.Size = new System.Drawing.Size(894, 333); //this._imageViewer.TabIndex = 3; //this._imageViewer.UseDpi = true; //this._imageViewer.ViewVerticalAlignment = Leadtools.Controls.ControlAlignment.Center; ////this._imageViewer.TransformChanged += new System.EventHandler(this._imageViewer_TransformChanged); ////this._imageViewer.MouseMove += new System.Windows.Forms.MouseEventHandler(this._imageViewer_MouseMove); ////this._imageViewer.MouseClick += new System.Windows.Forms.MouseEventHandler(this._imageViewer_MouseClick); ////this._imageViewer.PostRender += new System.EventHandler<Leadtools.Controls.ImageViewerRenderEventArgs>(this._imageViewer_PostRender); //pnImg.Controls.Add(_imageViewer); //_imageViewer.Hide(); //// Use the new RasterizeDocumentOptions to default loading document files at 300 DPI //_rasterCodecs.Options.RasterizeDocument.Load.XResolution = 300; //_rasterCodecs.Options.RasterizeDocument.Load.YResolution = 300; //_rasterCodecs.Options.Pdf.Load.EnableInterpolate = true; //_rasterCodecs.Options.Load.AutoFixImageResolution = true; theme1.Theme = ic.iniC.themeApplication; btnRotate.Click += BtnRotate_Click; ic.ivfDB.dgsDB.setCboBsp(cboDgs, ""); btnSave.Click += BtnSave_Click; btnAnalyze.Click += BtnAnalyze_Click; this.FormClosing += FrmScanNewView_FormClosing; //theme1.SetTheme(sb1, "BeigeOne"); //sb1.Text = "aaaaaaaaaa"; txtHn.Value = hn; txtVN.Value = vn; txtNameFeMale.Value = name; txtVisitDate.Value = visitDate; ic.setC1Combo(cboDgs, dgs); if (File.Exists(@filename)) { Image img = Image.FromFile(filename); stream = new MemoryStream(); img.Save(stream, ImageFormat.Jpeg); img.Dispose(); img = Image.FromStream(stream); img1 = img; pic1.Image = img; } }
private void setControl(String posiId) { labI = ic.ivfDB.oLabiDB.selectByPk1(posiId); ic.setC1Combo(cboLabGroup, labI.LGID); txtID.Value = labI.LID; txtLabName.Value = labI.LName; txtPrice.Value = labI.Price; chkShowQty.Checked = labI.status_show_qty.Equals("1") ? true : false; chkOutLab.Checked = labI.status_outlab.Equals("1") ? true : false; chkOrderGroup.Checked = labI.status_order_group.Equals("1") ? true : false; txtNormalValue.Value = labI.normal_vaule; ic.setC1Combo(cboUnit, labI.lab_unit_id); ic.setC1Combo(cboMethod, labI.method_id); txtQty.Value = labI.QTY; chkDataTypeText.Checked = labI.status_datatype_result.Equals("1") ? true : false; chkDataTypeInt.Checked = labI.status_datatype_result.Equals("2") ? true : false; chkDataTypeDec.Checked = labI.status_datatype_result.Equals("3") ? true : false; chkDataTypeCbo.Checked = labI.status_datatype_result.Equals("4") ? true : false; txtDataTypeDec.Value = labI.datatype_decimal; cboDataTypeCbo.Items.Clear(); if (labI.status_datatype_result.Equals("4")) { ic.ivfDB.lbDtDB.setCboLabDataTypeComboBox(cboDataTypeCbo, "", txtID.Text); } chkInterpretText.Checked = labI.status_interpret.Equals("0") ? true : false; chkInterpretCbo.Checked = labI.status_interpret.Equals("1") ? true : false; if (chkInterpretCbo.Checked) { setControlEnableInterpret(true); setGrfInterpret(); } else { setControlEnableInterpret(false); } txtlisMaxValue.Value = labI.lis_max_value; txtlisMinValue.Value = labI.lis_min_value; chkReqNurseScr.Checked = labI.status_send_request.Equals("0") ? true : false; chkReqLabFormA.Checked = labI.status_send_request.Equals("1") ? true : false; txtSort1.Value = labI.sort1; }
private void setControl(String vsid) { //vsOld = ic.ivfDB.ovsDB.selectByPk1(vsid); // -0020 //pttOld = ic.ivfDB.pttOldDB.selectByPk1(vsOld.PID); // -0020 //vs = ic.ivfDB.vsDB.selectByVn(vsid); // -0020 vs = ic.ivfDB.vsDB.selectByPk1(vsid); // +0020 ptt = ic.ivfDB.pttDB.selectByPk1(vs.t_patient_id); //txtHn.Value = ptt.patient_hn;// -0020 txtHn.Value = ic.showHN(ptt.patient_hn, ptt.patient_year);// +0020 txtVn.Value = vs.visit_vn; txtPttNameE.Value = ptt.Name; txtPttName.Value = ic.ivfDB.fpfDB.getList1(ptt.f_patient_prefix_id) + " " + ptt.patient_firstname + " " + ptt.patient_lastname; txtVnShow.Value = ic.showVN(vs.visit_vn); txtDob.Value = ic.datetoShow(ptt.patient_birthday) + " [" + ptt.AgeStringShort() + "]"; txtAllergy.Value = ptt.allergy_description; txtIdOld.Value = ptt.t_patient_id_old; txtVnOld.Value = vs.visit_vn; txtVsId.Value = vs.t_visit_id; txtPttId.Value = ptt.t_patient_id; txtSex.Value = ptt.f_sex_id.Equals("1") ? "ชาย" : "หญิง"; txtBg.Value = ptt.f_patient_blood_group_id.Equals("2140000005") ? "O" : ptt.f_patient_blood_group_id.Equals("2140000002") ? "A" : ptt.f_patient_blood_group_id.Equals("2140000003") ? "B" : ptt.f_patient_blood_group_id.Equals("2140000004") ? "AB" : "ไม่ระบุ"; txtVisitHeight.Value = vs.height; txtVisitBW.Value = vs.bw; txtVisitBP.Value = vs.bp; txtVisitPulse.Value = vs.pulse; chkChronic.Checked = ptt.status_congenial.Equals("1") ? true : false; ic.setC1Combo(cboDoctor, vs.doctor_id); Patient ptt1 = new Patient(); ptt1 = ic.ivfDB.pttDB.selectByHn(vs.patient_hn_male); txtNameMale.Value = ptt1.Name; stt.Show("<p><b>สวัสดี</b></p>คุณ " + ptt.congenital_diseases_description + "<br> กรุณา ป้อนรหัสผ่าน", chkChronic); txtCongenital.Value = ptt.congenital_diseases_description; if (!ptt.t_patient_id.Equals("")) { PatientImage pttI = new PatientImage(); pttI = ic.ivfDB.pttImgDB.selectByPttIDStatus4(ptt.t_patient_id); filenamepic = pttI.image_path; Thread threadA = new Thread(new ParameterizedThreadStart(ExecuteA)); threadA.Start(); } //if (!vsOld.VSID.Equals("166")) // -0020 // ต้องการ พิมพ์ sticker ย้อยหลัง //if (!vs.vsid.Equals("166")) // ต้องการ พิมพ์ sticker ย้อยหลัง //{ // ต้องการ พิมพ์ sticker ย้อยหลัง // btnPrnSticker.Enabled = false; // ต้องการ พิมพ์ sticker ย้อยหลัง //} // ต้องการ พิมพ์ sticker ย้อยหลัง //txtBg.Value = pttOld.b //txtAllergy.Value = }
private void setControlHn(String deposidid) { Deposit deposit = ic.ivfDB.depositDB.selectByPk(deposidid); Patient ptt = ic.ivfDB.pttDB.selectByPk1(deposit.t_patient_id); //vs = ic.ivfDB.vsDB.selectByPk1(visitid); txtWithDrawVisitId.Value = vs.t_visit_id; txtWithDrawVn.Value = vs.visit_vn; txtWithDrawHn.Value = ic.showHN(ptt.patient_hn, ptt.patient_year); txtWithDrawVisitId.Value = vs.t_visit_id; txtWithDrawPttId.Value = vs.t_patient_id; txtWithDrawName.Value = ptt.patient_name; txtWithDrawCode.Value = deposit.deposit_code; txtWithDrawDeposit.Value = deposit.deposit_amount; txtWithDrawAmt.Value = deposit.amount; txtWithDrawAmount.Value = "0"; txtWithDrawRemark.Value = deposit.remark; txtId.Value = deposit.deposit_id; ic.setC1Combo(cboPackageHn, deposit.pck_id); txtWithDrawDate.Value = System.DateTime.Now.ToString("yyyy-MM-dd"); }
private void setControl(String stfId) { stf = ic.ivfDB.stfDB.selectByPk1(stfId); txtID.Value = stf.staff_id; txtStfCode.Value = stf.staff_code; txtStfFNameT.Value = stf.staff_fname_t; txtStfFNameE.Value = stf.staff_fname_e; txtEmail.Value = stf.email; txtStfLNameT.Value = stf.staff_lname_t; txtStfLNameE.Value = stf.staff_lname_e; txtMobile.Value = stf.mobile; txtPid.Value = stf.pid; txtTele.Value = stf.tele; txtRemark.Value = stf.remark; txtUserName.Value = stf.username; txtLogo.Value = stf.logo; cboPrefix.Text = stf.prefix_name_t; //cboDept.Text = stf.dept_name_t; //cboPosi.Text = stf.posi_name_t; ic.setC1Combo(cboPosi, stf.posi_id); ic.setC1Combo(cboDept, stf.dept_id); chkAdmin.Checked = stf.status_admin.Equals("2") ? true : false; chkUser.Checked = !stf.status_admin.Equals("2") ? true : false; chkReception.Checked = stf.status_module_reception.Equals("1") ? true : false; chkNurse.Checked = stf.status_module_nurse.Equals("1") ? true : false; chkDoctor.Checked = stf.status_module_doctor.Equals("1") ? true : false; chkExpnAppv.Checked = stf.status_expense_appv.Equals("1") ? true : false; chkExpnD.Checked = stf.status_expense_draw.Equals("1") ? true : false; chkExpnP.Checked = stf.status_expense_pay.Equals("1") ? true : false; chkPharmacy.Checked = stf.status_module_pharmacy.Equals("1") ? true : false; chkLab.Checked = stf.status_module_lab.Equals("1") ? true : false; btnPassword.Show(); chkCashier.Checked = stf.status_module_cashier.Equals("1") ? true : false; chkMedicalRecord.Checked = stf.status_module_medicalrecord.Equals("1") ? true : false; chkStfDoctor.Checked = stf.status_doctor.Equals("1") ? true : false; txtDoctorId.Value = stf.doctor_id; txtDoctorOldId.Value = stf.doctor_id_old; }
private void setControl(String posiId) { ord = ic.ivfDB.ordDB.selectByPk1(posiId); txtID.Value = ord.opera_id; txtGiagGrpCode.Value = ord.opera_code; txtGiagGrpName.Value = ord.opera_name; //cboFetDay.Value = ord.diag_group_id; ic.setC1Combo(cboFetDay, ord.opera_group_id); //txtPosiNameT.Value = agn.posi_name_t; //txtRemark.Value = agn.remark; //if (posi.status_doctor.Equals("1")) //{ //chkSendtoOr.Checked = ord.status_or_diag_req.Equals("1") ? true : false; //chkOrUs.Checked = ord.status_or_us.Equals("1") ? true : false; }
private void setControl() { lFormDay1 = ic.ivfDB.lformDay1DB.selectByPk1(lformDay1Id); vs = ic.ivfDB.vsDB.selectByPk1(vsid); ptt = ic.ivfDB.pttDB.selectByPk1(pttid); if (lFormDay1.form_day1_id.Equals("")) { lFormDay1 = ic.ivfDB.lformDay1DB.selectByVsId(vs.t_visit_id); } if (!lFormDay1.form_day1_id.Equals("")) // found { LabRequest req = new LabRequest(); //opu = ic.ivfDB.opuDB.selectByReqID(req.req_id); setControl1(); } else// Not found { ovs = ic.ivfDB.ovsDB.selectByPk1(vsidOld); txtHnFeMale.Value = ptt.patient_hn; txtNameFeMale.Value = ptt.Name; txtDobFeMale.Value = ptt.AgeString(); txtHnMale.Value = ptt.patient_hn_couple; txtNameMale.Value = ptt.patient_couple_firstname; txtPttId.Value = ptt.t_patient_id; txtVsId.Value = vs.t_visit_id; txtAgent.Value = ic.ivfDB.oAgnDB.getAgentNameById(ptt.agent); ic.setC1Combo(cboDoctor, vs.doctor_id); txtFormDay1Date.Value = DateTime.Now.Year.ToString() + "-" + DateTime.Now.ToString("MM-dd"); if (ic.iniC.statusAppDonor.Equals("1")) { if (ptt.f_sex_id.Equals("1"))//male { Patient ptt1 = new Patient(); ptt1 = ic.ivfDB.pttDB.selectByHn(ptt.patient_hn_1); txtHnMale.Value = ptt.patient_hn; txtNameMale.Value = ptt.Name; txtHnFeMale.Value = ptt.patient_hn_1; txtNameFeMale.Value = ptt1.Name; txtDobFeMale.Value = ptt1.patient_birthday; txtDobMale.Value = ptt.patient_birthday; } else if (ptt.f_sex_id.Equals("2")) //female { if (!ptt.patient_hn_1.Equals("") && !ptt.patient_hn_2.Equals("")) // record donor { txtHnFeMale.Value = ptt.patient_hn_1; txtHnMale.Value = ptt.patient_hn_2; txtHnDonor.Value = ptt.patient_hn; txtNameDonor.Value = ptt.Name; Patient ptt1 = new Patient(); ptt1 = ic.ivfDB.pttDB.selectByHn(ptt.patient_hn_1); txtNameFeMale.Value = ptt1.Name; Patient ptt2 = new Patient(); ptt2 = ic.ivfDB.pttDB.selectByHn(ptt.patient_hn_2); txtNameMale.Value = ptt2.Name; txtDobFeMale.Value = ptt1.patient_birthday; txtDobMale.Value = ptt2.patient_birthday; } else if (ptt.patient_hn_1.Equals("") && !ptt.patient_hn_2.Equals("")) // record female { Patient ptt1 = new Patient(); ptt1 = ic.ivfDB.pttDB.selectByHn(ptt.patient_hn_2); txtHnMale.Value = ptt.patient_hn_2; txtNameMale.Value = ptt1.Name; txtHnFeMale.Value = ptt.patient_hn; txtNameFeMale.Value = ptt.Name; txtDobMale.Value = ptt1.patient_birthday; txtDobFeMale.Value = ptt.patient_birthday; } } } else { if (ptt.f_sex_id.Equals("1"))//male { Patient ptt1 = new Patient(); ptt1 = ic.ivfDB.pttDB.selectByHn(ptt.patient_hn_1); txtHnMale.Value = ptt.patient_hn; txtNameMale.Value = ptt.Name; txtHnFeMale.Value = ptt.patient_hn_1; txtNameFeMale.Value = ptt1.Name; txtDobMale.Value = ptt.patient_birthday; txtDobFeMale.Value = ptt1.patient_birthday; } else if (ptt.f_sex_id.Equals("2"))//female { Patient ptt2 = new Patient(); ptt2 = ic.ivfDB.pttDB.selectByHn(ptt.patient_hn_2); txtHnMale.Value = ptt.patient_hn_2; txtNameMale.Value = ptt2.Name; txtHnFeMale.Value = ptt.patient_hn; txtNameFeMale.Value = ptt.Name; txtDobMale.Value = ptt2.patient_birthday; txtDobFeMale.Value = ptt.patient_birthday; } } } }
private void setControlPtt(Patient ptt) { txtHn.Value = ptt.patient_hn; txtPttId.Value = ptt.t_patient_id; txtPttName.Value = ptt.patient_firstname; txtPttLName.Value = ptt.patient_lastname; txtPttNameE.Value = ptt.patient_firstname_e; txtPttLNameE.Value = ptt.patient_lastname_e; txtRemark.Value = ptt.remark; txtLineID.Value = ptt.line_id; txtEmail.Value = ptt.email; txtMobile1.Value = ptt.mobile1; txtMobile2.Value = ptt.mobile2; txtPid.Value = ptt.pid; txtPaasport.Value = ptt.passport; txtRemark.Value = ptt.remark; txtDob.Value = ptt.patient_birthday; ic.setC1Combo(cboPrefix, ptt.f_patient_prefix_id); ic.setC1Combo(cboSex, ptt.f_sex_id); ic.setC1Combo(cboMarital, ptt.f_patient_marriage_status_id); ic.setC1Combo(cboBloodG, ptt.f_patient_blood_group_id); ic.setC1Combo(CboNation, ptt.f_patient_nation_id); ic.setC1Combo(CboEduca, ptt.f_patient_education_type_id); ic.setC1Combo(cboRace, ptt.f_patient_race_id); ic.setC1Combo(cboRg, ptt.f_patient_religion_id); ic.setC1Combo(cboPttType, ptt.patient_type); ic.setC1Combo(cboAgent, ptt.agent); txtAgent.Value = ptt.agent; txtAgent1.Value = ptt.agent; //ic.setC1Combo(cboBsp, ptt.patient_type);cboAgent //ic.setC1Combo(cboCouPrefix, ptt.f_patient_religion_id); //ic.setC1Combo(cboRg, ptt.f_patient_religion_id); //ic.setC1Combo(cboRg, ptt.f_patient_religion_id); chkChronic.Checked = ptt.status_chronic.Equals("1") ? true : false; chkDenyAllergy.Checked = ptt.status_deny_allergy.Equals("1") ? true : false; chkDenyAllergy1.Checked = chkDenyAllergy.Checked; chkOPU.Checked = ptt.status_opu.Equals("1") ? true : false; chkOPU1.Checked = chkOPU.Checked; chkOR.Checked = ptt.status_or.Equals("1") ? true : false; chkOR1.Checked = chkOR.Checked; chkCongenital.Checked = ptt.status_congenial.Equals("1") ? true : false; chkCongenital1.Checked = chkCongenital.Checked; txtCongenital.Value = ptt.congenital_diseases_description; txtCongenital1.Value = ptt.congenital_diseases_description; txtORDescription1.Value = ptt.or_description; stt.SetToolTip(chkOR, ptt.or_description); stt.SetToolTip(chkDenyAllergy, ptt.allergy_description); stt.SetToolTip(chkCongenital, ptt.congenital_diseases_description); txtNickName.Value = ptt.patient_nickname; txtNickName1.Value = txtNickName.Text; txtMobile11.Value = txtMobile1.Text; txtHeight.Value = ptt.patient_height; txtHeight1.Value = txtHeight.Text; vs = ic.ivfDB.vsDB.selectByPk1(vsid); txtID.Value = vs.t_visit_id; ic.setC1Combo(cboBsp, vs.b_service_point_id); txtComment.Value = vs.visit_notice; txtBP.Value = vs.bp; txtBW.Value = vs.bw; txtBP1.Value = txtBP.Text; txtBW1.Value = txtBW1.Text; txtPulse.Value = vs.pulse; txtPulse1.Value = txtPulse.Text; txtAllergy.Value = ptt.allergy_description; txtHnMale.Value = vs.patient_hn_male; txtHnFemale.Value = vs.patient_hn_1; PatientImage ptti = new PatientImage(); ptti = ic.ivfDB.pttImgDB.selectByPttIDStatus1(txtPttId.Text); new Thread(() => { Thread.CurrentThread.IsBackground = true; Image loadedImage = null, resizedImage; String aaa = ptti.image_path; FtpWebRequest ftpRequest = null; FtpWebResponse ftpResponse = null; Stream ftpStream = null; int bufferSize = 2048; MemoryStream stream = new MemoryStream(); string host = null; string user = null; string pass = null; //iniC.hostFTP, iniC.userFTP, iniC.passFTP host = ic.iniC.hostFTP; user = ic.iniC.userFTP; pass = ic.iniC.passFTP; try { ftpRequest = (FtpWebRequest)FtpWebRequest.Create(host + "/" + aaa); ftpRequest.Credentials = new NetworkCredential(user, pass); ftpRequest.UseBinary = true; ftpRequest.UsePassive = ic.ftpUsePassive; ftpRequest.KeepAlive = true; ftpRequest.Method = WebRequestMethods.Ftp.DownloadFile; ftpResponse = (FtpWebResponse)ftpRequest.GetResponse(); ftpStream = ftpResponse.GetResponseStream(); byte[] byteBuffer = new byte[bufferSize]; int bytesRead = ftpStream.Read(byteBuffer, 0, bufferSize); try { while (bytesRead > 0) { stream.Write(byteBuffer, 0, bytesRead); bytesRead = ftpStream.Read(byteBuffer, 0, bufferSize); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } loadedImage = new Bitmap(stream); ftpStream.Close(); ftpResponse.Close(); ftpRequest = null; if (loadedImage != null) { String filename1 = "check_list_1.jpg"; int originalWidth = loadedImage.Width; int newWidth = 180; resizedImage = loadedImage.GetThumbnailImage(newWidth, (newWidth * loadedImage.Height) / originalWidth, null, IntPtr.Zero); //Column col = grfImg.Cols[colImg]; //col.DataType = typeof(Image); picImg.Image = loadedImage; if (File.Exists(filename1)) { File.Delete(filename1); System.Threading.Thread.Sleep(200); } loadedImage.Save(filename1); txtFileName.Value = filename1; //loadedImage.sa //flagImg = true; } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } //grfImg.Cols[colImg].ImageAndText = true; }).Start(); }