Пример #1
0
 private void toolStripButton1_Click(object sender, EventArgs e)
 {
     if (selectedPicBox == null)
     {
         Methods.ShowStandardMsgBox(FormMessageType.Error, "خطا", "فایلی انتخاب نشده است");
         return;
     }
     if (Methods.ShowStandardMsgBox(FormMessageType.Question, "حذف سند", "آیا مایل هستید این فایل را پاک نمایید؟") == DialogResult.No)
         return;
     drawingPanelWithEdit.BackBitmap.Dispose();
     drawingPanelWithEdit.BackBitmap = null;
     selectedPicBox.Dispose();
     dm.DeletePatientFile(new FileInfo(selectedPicBox.pictureDoc+""));
     selectedPicBox = null;
 }
Пример #2
0
        private void setSmallImages(PatientDocument pd)
        {
            DocumentPictureBox pb = new DocumentPictureBox(pd);

            Image smallImages;
            if (imgExtention.Contains(pd.FileInfo.Extension.Trim('.').ToLower()))
            {
                smallImages = Image.FromFile(pd.FileInfo.FullName);
                pb.IsImage = true;
            }
            else
            {
                pb.IsImage = false;
                smallImages = Icon.ExtractAssociatedIcon(pd.FileInfo.FullName).ToBitmap();
            }
            int ParentWidth = (!panelImages.VerticalScroll.Enabled) ? panelImages.Width-20 : panelImages.Width;
            pb.Width = ParentWidth;
            pb.Height = 50;
            pb.Location = new Point(0, panelImages.Controls[panelImages.Controls.Count - 1].Location.Y + panelImages.Controls[panelImages.Controls.Count - 1].Height+15);
            pb.InitialImage = smallImages;
            pb.Image = smallImages.GetThumbnailImage(50, 50, null, IntPtr.Zero);
            pb.SizeMode = PictureBoxSizeMode.CenterImage;
            pb.MouseClick += new MouseEventHandler(thumbnail_Click);
            pb.DoubleClick += new EventHandler(pb_DoubleClick);
            pb.BorderStyle = BorderStyle.FixedSingle;

            panelImages.Controls.Add(pb);
            panelImages.Controls.Add(new Label() { TextAlign = ContentAlignment.MiddleCenter, Text = pd.FileInfo.Name, ForeColor = Color.Black, Width = ParentWidth, Height = 20/*,BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle*/, Location = new Point(0, panelImages.Controls[panelImages.Controls.Count - 1].Location.Y + panelImages.Controls[panelImages.Controls.Count - 1].Height) });
        }
Пример #3
0
        private void thumbnail_Click(object sender, EventArgs e)
        {
            selectedPicBox = null;
            foreach (Control c in panelImages.Controls)
                if (c is DocumentPictureBox)
                    c.BackColor = Color.White;
            if (sender is DocumentPictureBox)
            {
                DocumentPictureBox pb = (DocumentPictureBox)sender;
                pb.BackColor = Color.LightBlue;
                selectedPicBox = pb;
                drawingPanelWithEdit.PatientDoc = pb.pictureDoc;
                txtImgComment.Text = pb.pictureDoc.Description;
                setImage((Bitmap)pb.InitialImage);
                setEnableButtonsBut(pb.IsImage, new Control());

            }
        }
Пример #4
0
        private void clearSmallImages()
        {
            try
            {
                panelImages.Controls.Clear();
                panelImages.Controls.Add(toolStrip);
                drawingPanelWithEdit.BackBitmap = null;
                selectedPicBox = null;

            }
            catch
            {
            }
        }