private void repImg_Popup(object sender, EventArgs e)
        {
            if (!(sender is DevExpress.XtraEditors.ImageEdit))
                return;

            DevExpress.XtraEditors.ImageEdit repImg = sender as DevExpress.XtraEditors.ImageEdit;
            DevExpress.XtraGrid.Views.Grid.GridView gv = (repImg.Parent as DevExpress.XtraGrid.GridControl).MainView as DevExpress.XtraGrid.Views.Grid.GridView;

            DataRow _tpDr = gv.GetDataRow(gv.FocusedRowHandle);

            if (_tpDr["Icon"].Equals(System.DBNull.Value))
            {
                byte[] _tpBytes = ServerRefManager.PicFileRead(_tpDr["StylePic"].ToString(), _tpDr["Pic_Version"].ToString());
                gv.FocusedColumn = gv.Columns["Icon"];
                gv.ShowEditor();
                if (gv.ActiveEditor is DevExpress.XtraEditors.ImageEdit)
                {
                    if (repImg.Properties.ShowPopupShadow == false)
                    {
                        repImg.ShowPopup();
                    }
                }
                if (_tpBytes == null)
                {
                    _tpDr["Icon"] = new byte[1];
                }
                else
                {
                    _tpDr["Icon"] = _tpBytes;
                }
                gv.RefreshRow(gv.FocusedRowHandle);
                repImg.ShowPopup();
            }
        }
Exemplo n.º 2
0
        void riImageEdit_ButtonClick(object sender, ButtonPressedEventArgs e)
        {
            DevExpress.XtraEditors.ImageEdit edit = sender as DevExpress.XtraEditors.ImageEdit;
            DynamicParameterItem             pi   = null; // _row;

            try
            {
                if (pi != null)
                {
                    object newobj = null;
                    OnEventButtonClick(pi.Id, pi.Row.Index, pi.Value, ref newobj);
                    if (newobj != null && !(newobj is DBNull))
                    {
                        #region Нүдэнд Зураг олгоход CellValueChanged эвэнт дуудагддаггүй юм байна. Тиймээс хэрэв эвэнтээр шинэ зураг орж ирвэл, олгох
                        edit.EditValue = newobj;
                        pi.Value       = newobj;
                        pi.Editing     = true;
                        #endregion
                    }
                }
            }
            catch
            { }

            #region Зургийн форм дуудах

            Image newvalue = null;
            Image value    = null;
            if (edit.EditValue != null && !(edit.EditValue is DBNull))
            {
                value = (Image)edit.EditValue;
            }

            DialogResult dlg = ShowImageForm(value, ref newvalue);
            if (dlg == DialogResult.OK)
            {
                edit.EditValue = newvalue;
                if (pi != null)
                {
                    pi.Editing = true;
                    pi.Value   = newvalue;
                }
            }

            #endregion
        }