Exemplo n.º 1
0
        private void GetImage(ArisaButtonImage BtnSelected)
        {
            OpenFileDialog OF = new OpenFileDialog();

            OF.Filter   = "All Files (*.jpg)|*.jpg";
            OF.FileName = "";
            if (OF.ShowDialog(this) == DialogResult.OK)
            {
                //string S = OF.FileName;
                //FTP F = new FTP("192.168.48.129", "Ftp_User", "M@123456");
                BtnSelected.FileStream = new FileStream(OF.FileName, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);
                //F.UploadFile(fs, @"//mansour4");
            }
        }
Exemplo n.º 2
0
        private void InitialHederAndContext()
        {
            var ConAlignment = ContentAlignment.MiddleLeft;

            foreach (DataGridViewColumn item in GridView.Columns)
            {
                if (item.HeaderText == "ویرایش" || item.HeaderText == "حذف" || item.HeaderText == "انتخاب")
                {
                    ConAlignment = ContentAlignment.MiddleCenter;
                }
                else
                {
                    {
                        Control Control;
                        if (item.DataPropertyName.Contains("Date"))
                        {
                            Control = new ArisaFarsiDatePicker();
                            var DatePicker = Control as ArisaFarsiDatePicker;
                            DatePicker.Anchor      = System.Windows.Forms.AnchorStyles.Top;
                            DatePicker.Font        = new System.Drawing.Font("B Nazanin", 12F, System.Drawing.FontStyle.Bold);
                            DatePicker.GeoDate     = new System.DateTime(2016, 3, 29, 0, 0, 0, 0);
                            DatePicker.Location    = new System.Drawing.Point(7, 25);
                            DatePicker.Margin      = new System.Windows.Forms.Padding(6, 8, 6, 8);
                            DatePicker.MaximumSize = new System.Drawing.Size(2166, 52);
                            DatePicker.Name        = "DatePickerDate";
                            DatePicker.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
                            DatePicker.Size        = new System.Drawing.Size(259, 41);
                            DatePicker.TabIndex    = 83;
                            if (item.Name.Contains("Uniq"))
                            {
                                (Control as ArisaFarsiDatePicker).IsUniq = true;
                            }
                        }
                        else
                        if (item.DataPropertyName.Contains("Image"))
                        {
                            Control             = new ArisaButtonImage();
                            Control.RightToLeft = RightToLeft.Yes;
                            var btn = (Control as Button);
                            btn.FlatStyle = FlatStyle.Flat;
                            btn.FlatAppearance.BorderColor = System.Drawing.Color.Gray;
                            btn.Text       = item.HeaderText;
                            btn.ImageAlign = ContentAlignment.TopRight;
                            btn.Click     += Control_Click;
                        }
                        else
                        {
                            if (_DbContext.GetType().GetProperties().ToList().FirstOrDefault(p => p.Name.Contains((item.Tag as Type).Name)) != null)
                            {
                                Control = new Button();
                                var btn = (Control as Button);
                                btn.FlatStyle = FlatStyle.Flat;
                                btn.FlatAppearance.BorderColor = System.Drawing.Color.Gray;
                                btn.Text       = item.HeaderCell.Tag.ToString();
                                btn.ImageAlign = ContentAlignment.TopRight;
                                btn.Click     += Control_Click;
                            }
                            else
                            {
                                Control           = new ArisaTextBox();
                                Control.ForeColor = System.Drawing.Color.LightSlateGray;
                                Control.AccessibleDefaultActionDescription = "First";
                                Control.Enter += Tbox_Enter;
                                if ((item.Tag as Type) == typeof(Int32) || (item.Tag as Type) == typeof(Int64))
                                {
                                    Control.KeyPress += Tbox_KeyPressInt32;
                                }
                                if (item.Name.Contains("Price"))
                                {
                                    Control.TextChanged += Tbox_TextChanged;
                                }
                                if (item.Name.Contains("Uniq"))
                                {
                                    (Control as ArisaTextBox).IsUniq = true;
                                }
                            }
                        }
                        Control.AccessibleDescription = item.DataPropertyName;
                        Control.Name    = item.HeaderText;
                        Control.Tag     = (item.Tag as Type);
                        Control.Font    = new System.Drawing.Font("B Nazanin", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(178)));
                        Control.Margin  = new Padding(2, 0, 0, 0);
                        Control.Size    = new Size(item.Width - 1, PanelHeder.Height);
                        Control.Visible = item.Visible;
                        PanelContent.Controls.Add(Control);
                    }
                }
                Label l = new Label();
                l.Margin                = new Padding(0);
                l.Size                  = new Size(item.Width, PanelHeder.Height);
                l.Text                  = item.HeaderText;
                l.ForeColor             = System.Drawing.Color.White;
                l.Font                  = new System.Drawing.Font("B Nazanin", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(178)));
                l.BackgroundImage       = FactoryShahin.Properties.Resources.image;
                l.BackgroundImageLayout = ImageLayout.Stretch;
                l.TextAlign             = ConAlignment;
                l.Visible               = item.Visible;
                PanelHeder.Controls.Add(l);
            }
            PanelContent.Controls.Add(btnRegister);
        }