示例#1
0
        private void imageView1_OnItemClick(object sender, DevExpress.XtraEditors.TileItemEventArgs e)
        {
            try
            {
                if (e.Item == null)
                {
                    return;
                }

                TileImageInfo imageInfo = e.Item.Tag as TileImageInfo;

                if (imageInfo == null)
                {
                    return;
                }

                if (imageInfo.MediaType != "图像")
                {
                    MessageBox.Show("音视频不能进行处理。", "提示");
                    return;
                }

                _selectImageID = imageInfo.MediaId;

                imageProcessControl1.LoadBackImage(ImageEx.LoadFile(imageInfo.File) as Bitmap);
            }
            catch (Exception ex)
            {
                MsgBox.ShowException(ex, this);
            }
        }
示例#2
0
        public void UpdateTileImage(TileItem tileItem, string imgFile)
        {
            if (tileItem == null)
            {
                tileItem = SelItem;
            }

            if (tileItem == null)
            {
                return;
            }

            tileItem.Image = ImageEx.LoadFile(imgFile);
        }
示例#3
0
        public void ShowImage(string imgFile, int delayTime, IWin32Window owner)
        {
            _imgFile   = imgFile;
            _delayTime = delayTime;

            _alreadyTime   = 0;
            _allowExit     = false;
            this.Opacity   = 100;
            timer1.Enabled = true;

            if (this.Visible == false)
            {
                this.Show(owner);
            }

            pictureBox1.Image = ImageEx.LoadFile(_imgFile);
        }
示例#4
0
        private void butLoadPhoto_Click(object sender, EventArgs e)
        {
            try
            {
                openFileDialog1.ShowDialog(this);

                if (File.Exists(openFileDialog1.FileName) == false)
                {
                    return;
                }

                picUserPhoto.Image = ImageEx.LoadFile(openFileDialog1.FileName);
            }
            catch (Exception ex)
            {
                MsgBox.ShowException(ex, this);
            }
        }
示例#5
0
        private void frmImageProcess_Load(object sender, EventArgs e)
        {
            try
            {
                BindStudyMedia();

                if (_images != null && string.IsNullOrEmpty(_selectImageID) == false)
                {
                    int imgIndex = _images.FindIndex(T => T.MediaId == _selectImageID);

                    if (imgIndex < 0)
                    {
                        return;
                    }

                    imgIndex = imgIndex + 1;

                    int curPageNo = imgIndex / _imgViewCount;

                    if (imgIndex % _imgViewCount != 0)
                    {
                        curPageNo = curPageNo + 1;
                    }

                    splitPage1.ChangePage(curPageNo);

                    TileItem ti = imageView1.FindByImageId(_selectImageID);

                    imageView1.Selected(ti);

                    imageProcessControl1.LoadBackImage(ImageEx.LoadFile(_images[imgIndex - 1].File) as Bitmap);
                }
            }
            catch (Exception ex)
            {
                MsgBox.ShowException(ex, this);
            }
        }
示例#6
0
        public TileItem AddImage(TileImageInfo imgInfo)
        {
            TileItem AddImageToTile(System.Drawing.Image img)
            {
                TileItem ti = new TileItem();

                ti.Image          = img;
                ti.ImageScaleMode = TileItemImageScaleMode.Stretch;
                ti.ItemSize       = TileItemSize.Large;
                ti.Text           = "";
                ti.Tag            = imgInfo;

                TileItemElement tie = new TileItemElement();

                tie.Image          = imageList1.Images[0];
                tie.ImageSize      = new Size(32, 32);
                tie.ImageAlignment = TileItemContentAlignment.TopRight;
                tie.Text           = "";

                ti.Elements.Add(tie);

                if (imgInfo.IsKeyImage)
                {
                    TileItemElement tieKey = new TileItemElement();

                    tieKey.Image          = imageList2.Images[1];
                    tieKey.Image.Tag      = "lock";
                    tieKey.ImageSize      = new Size(16, 16);
                    tieKey.ImageAlignment = TileItemContentAlignment.TopLeft;
                    tieKey.Text           = "";

                    ti.Elements.Add(tieKey);
                }

                TileItemElement tieOrder = new TileItemElement();

                tieOrder.TextAlignment = TileItemContentAlignment.BottomLeft;
                tieOrder.Text          = imgInfo.Order;


                ti.Elements.Add(tieOrder);

                if (tileControl1.Groups.Count <= 0)
                {
                    TileGroup tg = new TileGroup();
                    tg.Text = "";

                    tileControl1.Groups.Add(tg);
                }


                if (tileControl1.Groups[0].Items.Count >= _imgViewCount)
                {
                    tileControl1.Groups[0].Items.RemoveAt(0);
                }

                tileControl1.Groups[0].Items.Insert(0, ti);
                //tileControl1.Groups[0].Items.Add(ti);

                return(ti);
            }

            if (this.InvokeRequired)//如果是在非创建控件的线程访问,即InvokeRequired=true
            {
                DelegateAddImage addImgProcess = new DelegateAddImage(AddImage);
                return(this.Invoke(addImgProcess, new object[] { imgInfo }) as TileItem);
            }
            else
            {
                System.Drawing.Image img = null;
                //视频音频类型媒体加载判断处理
                if (imgInfo.MediaType == "视频")
                {
                    img = imageList3.Images[0];
                }
                else if (imgInfo.MediaType == "音频")
                {
                    img = imageList3.Images[1];
                }
                else
                {
                    img = ImageEx.LoadFile(imgInfo.File);
                }

                return(AddImageToTile(img));
            }
        }