Esempio n. 1
0
        public static void RegisterRichTextIndentEdit()
        {
            //EditorClassInfo info = EditorRegistrationInfo.Default.Editors[InternalEditorTypeName];
            //if (info != null)
            //    EditorRegistrationInfo.Default.Editors.Remove(info);

            // TODO: replace image
            Bitmap img = ResourceImageHelper.CreateBitmapFromResources("DevExpress.XtraRichEdit.Bitmaps256.RichTextEdit.bmp", Assembly.GetExecutingAssembly());

            img.MakeTransparent(Color.Magenta);
            EditorClassInfo editorInfo = new EditorClassInfo(typeof(RichTextIndentEdit).Name, typeof(RichTextIndentEdit), typeof(RepositoryItemRichTextIndentEdit), typeof(DevExpress.XtraEditors.ViewInfo.BaseSpinEditViewInfo), new DevExpress.XtraEditors.Drawing.ButtonEditPainter(), true, img);

            editorInfo.AllowInplaceEditing = ShowInContainerDesigner.OnlyInBars;
            EditorRegistrationInfo.Default.Editors.Add(editorInfo);
        }
Esempio n. 2
0
        public static void RegisterCustomButtonEdit()
        {
            Image img = null;

            try
            {
                img = ResourceImageHelper.CreateBitmapFromResources("TestCustomRepositoryItem.Resources.image_icon.png", Assembly.GetExecutingAssembly());
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
            }

            EditorRegistrationInfo.Default.Editors.Add(new EditorClassInfo(EditName,
                                                                           typeof(CustomButtonEdit), typeof(RepositoryItemCustomButtonEdit),
                                                                           typeof(DevExpress.XtraEditors.ViewInfo.ButtonEditViewInfo), new ButtonEditPainter(), true, img, typeof(ButtonEditAccessible)));
        }
Esempio n. 3
0
        private void frmConsoleAbout_Load(object sender, EventArgs e)
        {
            if (ComponentAttribute == null && ComponentType != null)
            {
                ComponentAttribute = AssemblyHelper.GetCustomAttributes <XCIComponentAttribute>(ComponentType);
            }
            if (ComponentAttribute != null)
            {
                labName.Text        = ComponentAttribute.Name;
                labAuthor.Text      = ComponentAttribute.Author;
                labContact.Text     = ComponentAttribute.Contact;
                labVersion.Text     = ComponentAttribute.Version;
                labCopyRight.Text   = ComponentAttribute.CopyRight;
                txtDescription.Text = ComponentAttribute.Description;

                this.Text = "关于 " + ComponentAttribute.Name;

                string path = ComponentAttribute.Logo;
                if (path.IsNotEmpty())
                {
                    this.pictureBox1.Image = new Bitmap(ResourceImageHelper.CreateBitmapFromResources(path, ComponentType.Assembly), 64, 64);
                }
                else
                {
                    Type type = typeof(IManager);
                    var  img  = ResourceImageHelper.CreateBitmapFromResources("XCI.XCIComponent.ComponentLogo.png",
                                                                              type.Assembly);

                    this.pictureBox1.Image = new Bitmap(img, 64, 64);
                }
            }
            if (Logo != null)
            {
                this.pictureBox1.Image = Logo;
            }
        }
Esempio n. 4
0
        public MainForm()
        {
            InitializeComponent();

            //textEdit4.ReadOnly = true;
            textEdit4.Properties.Appearance.Image                    = global::TestDEControls.Properties.Resources.save_16x16;
            textEdit4.Properties.Appearance.Options.UseImage         = true;
            textEdit4.Properties.AppearanceFocused.Image             = global::TestDEControls.Properties.Resources.save_16x16;
            textEdit4.Properties.AppearanceFocused.Options.UseImage  = true;
            textEdit4.Properties.AppearanceDisabled.Image            = global::TestDEControls.Properties.Resources.save_16x16;
            textEdit4.Properties.AppearanceDisabled.Options.UseImage = true;
            textEdit4.Properties.AppearanceReadOnly.Image            = global::TestDEControls.Properties.Resources.save_16x16;
            textEdit4.Properties.AppearanceReadOnly.Options.UseImage = true;

            btnSet.Visible = false;

            _boolVictim4CheckBox = _boolVictim4ToggleSwitch = true;
            _defaultBooleanVictim4ToggleSwitch = DefaultBoolean.True;
            _stringVictim = "123456789012";

            _textEdit3Binding = textEdit3.DataBindings.Add("EditValue", this, "StringVictim", true, DataSourceUpdateMode.OnPropertyChanged);
            _textEdit3Binding.BindingComplete += TextEdit3BindingBindingComplete;
            _textEdit3Binding.Format          += TextEdit3BindingFormat;
            _textEdit3Binding.Parse           += TextEdit3BindingParse;
            textEdit3.CustomDisplayText       += TextEdit3CustomDisplayText;

            //tabControl.SelectedTabPage = tabPageButtons;

            lookUpEdit1.Properties.DataSource    = GetDataTable();
            lookUpEdit1.Properties.ValueMember   = "id";
            lookUpEdit1.Properties.DisplayMember = "Name";
            lookUpEdit1.Properties.Columns.Clear();
            lookUpEdit1.Properties.Columns.Add(new LookUpColumnInfo("Name"));
            lookUpEdit1.Properties.ShowHeader = false;
            lookUpEdit1.Properties.ShowFooter = false;

            lookUpEdit2.Properties.DataSource    = GetListStubsWithIdBool();
            lookUpEdit2.Properties.ValueMember   = "Id";
            lookUpEdit2.Properties.DisplayMember = "Name";
            lookUpEdit2.Properties.Columns.Clear();
            lookUpEdit2.Properties.Columns.Add(new LookUpColumnInfo("Name"));
            lookUpEdit2.Properties.ShowHeader = false;
            lookUpEdit2.Properties.ShowFooter = false;
            //lookUpEdit2.DataBindings.Add("EditValue", editObjectWithBool, "FBool", false, DataSourceUpdateMode.OnPropertyChanged);
            lookUpEdit2.DataBindings.Add("EditValue", editObjectWithNullableBool, "FBool", false, DataSourceUpdateMode.OnPropertyChanged);

            lookUpEdit3.Properties.DataSource    = GetListStubsWithIdInt();
            lookUpEdit3.Properties.ValueMember   = "Id";
            lookUpEdit3.Properties.DisplayMember = "Name";
            lookUpEdit3.Properties.Columns.Clear();
            lookUpEdit3.Properties.Columns.Add(new LookUpColumnInfo("Name"));
            lookUpEdit3.Properties.ShowHeader = false;
            lookUpEdit3.Properties.ShowFooter = false;
            lookUpEdit3.DataBindings.Add("EditValue", editObjectWithInt, "FInt", false, DataSourceUpdateMode.OnPropertyChanged);

            lookUpEdit4.Properties.DataSource    = GetListStubsWithIdDevExpressDefaultBoolean();
            lookUpEdit4.Properties.ValueMember   = "Id";
            lookUpEdit4.Properties.DisplayMember = "Name";
            lookUpEdit4.Properties.Columns.Clear();
            lookUpEdit4.Properties.Columns.Add(new LookUpColumnInfo("Name"));
            lookUpEdit4.Properties.ShowHeader = false;
            lookUpEdit4.Properties.ShowFooter = false;
            lookUpEdit4.DataBindings.Add("EditValue", editObjectWithDevExpressDefaultBoolean, "FBool", false, DataSourceUpdateMode.OnPropertyChanged);

            textEdit1.Properties.Mask.MaskType     = MaskType.RegEx;
            textEdit1.Properties.Mask.EditMask     = "a{1,3}";
            textEdit1.Properties.Mask.AutoComplete = AutoCompleteType.None;

            gridControl1.DataSource = GetDataTable();

            var repositoryItemComboBox = new RepositoryItemComboBox();

            repositoryItemComboBox.Items.AddRange(new[] { 1, 2, 3 });

            // https://documentation.devexpress.com/#WindowsForms/DevExpressXtraEditorsHyperLinkEdit_OpenLinktopic
            var repositoryItemHyperLinkEdit = new RepositoryItemHyperLinkEdit();

            repositoryItemHyperLinkEdit.SingleClick = true;
            //repositoryItemHyperLinkEdit.ReadOnly = true;
            repositoryItemHyperLinkEdit.TextEditStyle = TextEditStyles.DisableTextEditor;

            var repositoryItemSpinEdit = new RepositoryItemSpinEdit();

            repositoryItemSpinEdit.DisplayFormat.FormatString = "0.###############";
            repositoryItemSpinEdit.DisplayFormat.FormatType   = FormatType.Numeric;
            repositoryItemSpinEdit.Mask.EditMask = "n15";
            repositoryItemSpinEdit.MaxLength     = 30;
            repositoryItemSpinEdit.MaxValue      = 79228162514264.337593543950335m;

            gridControl1.RepositoryItems.Add(repositoryItemComboBox);
            gridControl1.RepositoryItems.Add(repositoryItemHyperLinkEdit);
            gridControl1.RepositoryItems.Add(repositoryItemSpinEdit);
            gridView1.Columns.ColumnByFieldName("Dep").ColumnEdit    = repositoryItemComboBox;
            gridView1.Columns.ColumnByFieldName("Url").ColumnEdit    = repositoryItemHyperLinkEdit;
            gridView1.Columns.ColumnByFieldName("Salary").ColumnEdit = repositoryItemSpinEdit;

            repositoryItemComboBox.EditValueChanging += RepositoryItemComboBoxOnEditValueChanging;
            repositoryItemComboBox.EditValueChanged  += RepositoryItemComboBoxOnEditValueChanged;

            gridView1.CustomRowCellEdit += GridViewOnCustomRowCellEdit;
            //gridView1.OptionsBehavior.Editable = false;
            gridView1.Click += gridViewClick;
            //gridView1.CustomDrawRowIndicator += GridViewCustomDrawRowIndicatorFake;

            checkEdit4.DataBindings.Add("EditValue", this, "BoolVictim4CheckBox", false, DataSourceUpdateMode.OnPropertyChanged);
            //checkEdit4.DataBindings.Add("EditValue", this, "BoolVictim4CheckBox", false, DataSourceUpdateMode.OnValidation);

            //pictureEdit.Enabled = false;
            pictureEdit.ReadOnly                = true;
            pictureEdit.Properties.ReadOnly     = true;
            pictureEdit.Properties.AllowFocused = false;
            //pictureEdit.Properties.ShowMenu = false;

            var assembly  = typeof(PictureMenu).Assembly;
            var imageList = ImageHelper.CreateImageCollectionFromResources("DevExpress.XtraEditors.Images.PictureMenu.png", typeof(PictureMenu).Assembly, new Size(0x10, 0x10), Color.Empty);

            Image img = null;

            try
            {
                img = ResourceImageHelper.CreateBitmapFromResources("DevExpress.XtraEditors.ImageEdit.bmp", typeof(ButtonEdit).Assembly);
                img.Save("ImageEdit.bmp");
                imageList = ImageHelper.CreateImageCollectionFromResources("DevExpress.XtraEditors.Images.Editors.bmp", typeof(PictureMenu).Assembly, new Size(0x10, 0x10), Color.Empty);
                imageList.Images[12].Save("12.bmp");
                //img = (Bitmap)Bitmap.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("DevExpress.XtraEditors.Images.Editors.bmp"));
            }
            catch (Exception)
            {
            }

            comboBoxEdit1.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
            comboBoxEdit1.Properties.Items.AddRange(Enumerable.Range(65, 26).Select(item => (object)(new string((char)item, 10))).ToArray());

            //timeEdit1.Properties.ReadOnly = true;
            timeEdit1.Enabled = false;

            listOfAction.Add(GridViewCustomDrawRowIndicatorFake);

            DecimalVictim = 1.123456789010000m;
            //DecimalVictim = 0.00000001m;

            spinEdit1.DataBindings.Add("EditValue", this, "DecimalVictim", false, DataSourceUpdateMode.OnPropertyChanged);
            //spinEdit1.EditValueChanged += SpinEditEditValueChanged;
            //spinEdit1.CustomDisplayText += SpinEditCustomDisplayText;

            toggleSwitch1.DataBindings.Add("EditValue", this, "BoolVictim4ToggleSwitch", false, DataSourceUpdateMode.OnPropertyChanged);
            _toggleSwitch2Binding                  = toggleSwitch2.DataBindings.Add(/*"EditValue"*/ "IsOn", this, "DefaultBooleanVictim4ToggleSwitch", true, DataSourceUpdateMode.OnPropertyChanged);
            _toggleSwitch2Binding.Parse           += ToggleSwitchBindingParse;
            _toggleSwitch2Binding.Format          += ToggleSwitchBindingFormat;
            _toggleSwitch2Binding.BindingComplete += ToggleSwitchBindingBindingComplete;

            buttonEdit1.ReadOnly     = true;
            buttonEdit1.ButtonClick += ButtonEdit1_ButtonClick;
            buttonEdit1.Properties.Buttons[1].Enabled = false;
            buttonEdit1.EditValue = "blah-blah-blah";
        }