コード例 #1
0
        private void LoadPluginData2(string pluginType)
        {
            new Thread((ThreadStart)(delegate()
            {
                try
                {
                    labloading.Invoke((MethodInvoker) delegate() { labloading.Visible = true; });

                    List <PluginClass> plist = new List <PluginClass>();

                    string url = CommonHelper.plugin_serverurl + "/Controller.aspx?controller=efwplus_website@PluginController&method=getpluginlist_client&plugintype=" + pluginType;
                    HttpWebResponse response = HttpWebResponseUtility.CreateGetHttpResponse(url, null, null, null);
                    string ret = HttpWebResponseUtility.GetHttpData(response);
                    string data = (HttpWebResponseUtility.ToResult(ret) as Newtonsoft.Json.JavaScriptArray).ToArray()[0].ToString();
                    DataTable dt = HttpWebResponseUtility.ToDataTable(JavaScriptConvert.DeserializeObject(data));

                    gridweb.Invoke((MethodInvoker) delegate() { gridweb.DataSource = dt; });

                    DataGridViewLabelXColumn bcx = gridweb.Columns["ctitle"] as DataGridViewLabelXColumn;
                    if (bcx != null)
                    {
                        bcx.BeforeCellPaint += bcx_BeforeCellPaint;
                    }

                    labloading.Invoke((MethodInvoker) delegate() { labloading.Visible = false; });
                }
                catch (Exception err)
                {
                    //MessageBox.Show("请求数据失败!\n" + err.Message);
                    MessageBoxEx.Show("请求数据失败!\n" + err.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            })).Start();
        }
コード例 #2
0
ファイル: DgvTools.cs プロジェクト: zh7262703/Emr_MySql
        /// <summary>
        /// 创建DataGridView扩展的Lable列
        /// </summary>
        /// <param name="_dgv">要创建列的DataGridView</param>
        /// <param name="_alignment">设置列的对齐方式</param>
        /// <param name="_columnName">列名</param>
        /// <param name="_headerText">标题名</param>
        /// <param name="_dataPropertyName">绑定数据源的字段名称</param>
        /// <param name="_toolTipText">TipText提示</param>
        /// <param name="_familyName">设置字体</param>
        /// <param name="_fontSize">设置字体大小</param>
        /// <param name="_fontStyle">设置字体样式</param>
        /// <param name="_fontColor">设置字体颜色</param>
        /// <param name="_readOnly">设置列是否只读,true 只读,false 读写</param>
        /// <param name="_visible">设置列是否可见,true 显示,false 隐藏</param>
        /// <param name="_notEmpty">设置列是否为必填列,true 必填,false 非必填</param>
        /// <param name="_backColor">设置列的背景色,当_notEmpty为true时,此项为必需值,为false,此项可以为Color.Empty</param>
        /// <param name="_columnState">装载DataGridView可写可读、只读列的数据字典</param>
        public static void InitDgvLableXColumn(DataGridView _dgv,
                                               DataGridViewContentAlignment _alignment, string _columnName, string _headerText,
                                               string _dataPropertyName, string _toolTipText,
                                               string _familyName, float _fontSize, FontStyle _fontStyle, Color _fontColor,
                                               bool _readOnly, bool _visible, bool _notEmpty, Color _backColor, ref Dictionary <string, bool> _columnState)
        {
            DataGridViewLabelXColumn lablelXCol = new DataGridViewLabelXColumn();

            lablelXCol.HeaderCell.Style.Alignment = _alignment == 0 ? DataGridViewContentAlignment.MiddleLeft : _alignment;
            lablelXCol.Name                                = _columnName;
            lablelXCol.HeaderText                          = _headerText;
            lablelXCol.DataPropertyName                    = _dataPropertyName;
            lablelXCol.ToolTipText                         = _toolTipText;
            lablelXCol.Visible                             = _visible;
            lablelXCol.ReadOnly                            = _readOnly;
            lablelXCol.DefaultCellStyle.ForeColor          = _fontColor;
            lablelXCol.DefaultCellStyle.SelectionForeColor = _fontColor;
            lablelXCol.DefaultCellStyle.Font               = new Font(_familyName, _fontSize, _fontStyle);
            if (_notEmpty == true)
            {
                lablelXCol.DefaultCellStyle.BackColor = _backColor;
            }
            _columnState.Add(_columnName, _readOnly);
            _dgv.Columns.Add(lablelXCol);
        }
コード例 #3
0
        /// <summary>
        /// Initializes our X1 PostalCode environment
        /// </summary>
        private void X1PostalCode_Initialize()
        {
            DataGridViewLabelXColumn bcx =
                dataGridViewX1.Columns["PostalCode"] as DataGridViewLabelXColumn;

            if (bcx != null)
            {
                // Hook onto the BeforeCellPaint event so we can
                // demonstrate cell customization

                bcx.BeforeCellPaint += X1PostalCode_BeforeCellPaint;
            }
        }
コード例 #4
0
        void bcx_BeforeCellPaint(object sender, BeforeCellPaintEventArgs e)
        {
            DataGridViewLabelXColumn bcx = sender as DataGridViewLabelXColumn;

            if (bcx != null)
            {
                DataTable dt           = gridweb.DataSource as DataTable;
                int       rowindex     = e.RowIndex;
                int       Id           = Convert.ToInt32(dt.Rows[rowindex]["Id"]);
                string    name         = dt.Rows[rowindex]["name"].ToString();
                string    title        = dt.Rows[rowindex]["title"].ToString();
                string    introduction = dt.Rows[rowindex]["introduction"].ToString();
                string    downloadpath = dt.Rows[rowindex]["downloadpath"].ToString();
                string    pluginsize   = dt.Rows[rowindex]["pluginsize"].ToString();
                string    pversion     = dt.Rows[rowindex]["pversion"].ToString();
                string    author       = dt.Rows[rowindex]["author"].ToString();
                string    updatedate   = dt.Rows[rowindex]["updatedate"].ToString();
                string    ptype        = dt.Rows[rowindex]["plugintype"].ToString();
                string    url          = CommonHelper.plugin_serverurl + downloadpath;
                bcx.TextAlignment = StringAlignment.Near;
                bcx.Text          = "*" + title + "*    " + "版本:" + pversion + "    " + "作者:" + author + "     " + "更新时间:" + updatedate + "\r\n" + introduction;
            }
        }
コード例 #5
0
        /// <summary>
        /// Handles "PostalCode" BeforeCellPaint events
        /// </summary>
        /// <param name="sender">DataGridViewButtonXColumn</param>
        /// <param name="e">BeforeCellPaintEventArgs</param>
        void X1PostalCode_BeforeCellPaint(object sender, BeforeCellPaintEventArgs e)
        {
            DataGridViewLabelXColumn bcx = sender as DataGridViewLabelXColumn;

            if (bcx != null)
            {
                // Set the label image

                if (string.IsNullOrEmpty(bcx.Text) == true)
                {
                    bcx.Image = imageList1.Images["SecHigh"];
                    bcx.Text  = "<font color=\"red\">Postal Code not Specified</font>";
                }
                else if (bcx.Text.Contains(" "))
                {
                    bcx.Image = imageList1.Images["SecMedium"];
                }

                else
                {
                    bcx.Image = imageList1.Images["SecLow"];
                }
            }
        }
コード例 #6
0
ファイル: FmInv.cs プロジェクト: hanxiaomeme/CERP
        protected override void InitGridColumn()
        {
            #region 初始化列
            DataGridViewLabelXColumn col;

            col            = new DataGridViewLabelXColumn();
            col.Name       = col.DataPropertyName = "InvCode";
            col.HeaderText = "零件号";
            col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
            col.SortMode = DataGridViewColumnSortMode.Automatic;
            col.Width    = 150;
            sGrid.Columns.Add(col);

            col      = new DataGridViewLabelXColumn();
            col.Name = col.DataPropertyName = "InvName";
            col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
            col.HeaderText = "产品名称";
            col.Width      = 120;
            sGrid.Columns.Add(col);

            col      = new DataGridViewLabelXColumn();
            col.Name = col.DataPropertyName = "InvStd";
            col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
            col.HeaderText = "规格型号";
            col.Width      = 150;
            sGrid.Columns.Add(col);

            col      = new DataGridViewLabelXColumn();
            col.Name = col.DataPropertyName = "DDCS";
            col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
            col.HeaderText = "短端参数";
            col.Width      = 100;
            sGrid.Columns.Add(col);

            col      = new DataGridViewLabelXColumn();
            col.Name = col.DataPropertyName = "CDCS";
            col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
            col.HeaderText = "长端参数";
            col.Width      = 100;
            sGrid.Columns.Add(col);

            col      = new DataGridViewLabelXColumn();
            col.Name = col.DataPropertyName = "luoju";
            col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
            col.HeaderText = "螺距";
            col.Width      = 80;
            sGrid.Columns.Add(col);

            col      = new DataGridViewLabelXColumn();
            col.Name = col.DataPropertyName = "ljdb";
            col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
            col.HeaderText = "六角对边";
            col.Width      = 80;
            sGrid.Columns.Add(col);

            col      = new DataGridViewLabelXColumn();
            col.Name = col.DataPropertyName = "houdu";
            col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
            col.HeaderText = "厚度";
            col.Width      = 80;
            sGrid.Columns.Add(col);

            col      = new DataGridViewLabelXColumn();
            col.Name = col.DataPropertyName = "chishu";
            col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
            col.HeaderText = "齿数";
            col.Width      = 80;
            sGrid.Columns.Add(col);

            col      = new DataGridViewLabelXColumn();
            col.Name = col.DataPropertyName = "yachang";
            col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
            col.HeaderText = "牙长";
            col.Width      = 80;
            sGrid.Columns.Add(col);

            col      = new DataGridViewLabelXColumn();
            col.Name = col.DataPropertyName = "cgzj_1";
            col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
            col.HeaderText = "粗杆直径1";
            col.Width      = 80;
            sGrid.Columns.Add(col);

            col      = new DataGridViewLabelXColumn();
            col.Name = col.DataPropertyName = "cgcd_1";
            col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
            col.HeaderText = "粗杆长度1";
            col.Width      = 80;
            sGrid.Columns.Add(col);

            col      = new DataGridViewLabelXColumn();
            col.Name = col.DataPropertyName = "cgzj_2";
            col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
            col.HeaderText = "粗杆直径2";
            col.Width      = 80;
            sGrid.Columns.Add(col);

            col      = new DataGridViewLabelXColumn();
            col.Name = col.DataPropertyName = "cgcd_2";
            col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
            col.HeaderText = "粗杆长度2";
            col.Width      = 80;
            sGrid.Columns.Add(col);

            //sGrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
            #endregion
        }
コード例 #7
0
        public void display_NUDColums()
        {
            nudgrid.Rows.Clear();
            nudgrid.Columns.Clear();
            DataGridViewLabelXColumn colno = new DataGridViewLabelXColumn();

            colno.HeaderText = "Row #";
            colno.Name       = "numberIncrement";
            colno.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
            nudgrid.Columns.Add(colno);

            DataGridViewTextBoxColumn colinvoice = new DataGridViewTextBoxColumn();

            colinvoice.HeaderText = "sdrrno";
            colinvoice.Name       = "sdrrno";
            colinvoice.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
            nudgrid.Columns.Add(colinvoice);

            colinvoice            = new DataGridViewTextBoxColumn();
            colinvoice.HeaderText = "Invoice #";
            colinvoice.Name       = "invoice_no";
            colinvoice.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
            nudgrid.Columns.Add(colinvoice);

            DataGridViewTextBoxColumn colInvoiceValue = new DataGridViewTextBoxColumn();

            colInvoiceValue.HeaderText = "NUD Amount";
            colInvoiceValue.Name       = "nudvalue";
            colInvoiceValue.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
            nudgrid.Columns.Add(colInvoiceValue);

            DataGridViewDateTimeInputColumn colnumber = new DataGridViewDateTimeInputColumn();

            colnumber.HeaderText                 = "Invoice Date";
            colnumber.Name                       = "invoice_date";
            colnumber.MinDate                    = new System.DateTime(2017, 1, 1, 0, 0, 0, 0);
            colnumber.ButtonClear.Checked        = true;
            colnumber.ButtonClear.Visible        = true;
            colnumber.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
            colnumber.ReadOnly                   = true;
            nudgrid.Columns.Add(colnumber);

            DataGridViewComboBoxExColumn colreason = new DataGridViewComboBoxExColumn();

            colreason.HeaderText = "Reason";
            colreason.Name       = "reason";
            colreason.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
            nudgrid.Columns.Add(colreason);

            DataGridViewComboBoxExColumn colstat = new DataGridViewComboBoxExColumn();

            colstat.HeaderText = "Delivery Status";
            colstat.Name       = "delstat";
            colstat.Items.Add("CANCELLED");
            colstat.Items.Add("CUT-ITEMS");
            colstat.Items.Add("FULL-RETURN");
            colstat.Items.Add("RE-DELIVERY");
            colstat.DropDownStyle = ComboBoxStyle.DropDownList;
            colstat.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
            nudgrid.Columns.Add(colstat);

            colstat            = new DataGridViewComboBoxExColumn();
            colstat.HeaderText = "Accountability";
            colstat.Name       = "account";
            colstat.Items.Add("CLIENT");
            colstat.Items.Add("VGL");
            colstat.DropDownStyle = ComboBoxStyle.DropDownList;
            colstat.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
            nudgrid.Columns.Add(colstat);

            DataGridViewTextBoxColumn colzone = new DataGridViewTextBoxColumn();

            colzone.HeaderText = "zone";
            colzone.Name       = "zone";
            colzone.Visible    = false;
            colzone.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
            nudgrid.Columns.Add(colzone);

            DataGridViewTextBoxColumn colTindex = new DataGridViewTextBoxColumn();

            colTindex.HeaderText = "Index";
            colTindex.Name       = "index";
            colTindex.Visible    = false;
            colTindex.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
            nudgrid.Columns.Add(colTindex);

            nudgrid.Columns["numberIncrement"].Width = 35;
            nudgrid.Columns["invoice_date"].Width    = 80;
            nudgrid.Columns["delstat"].Width         = 160;
            nudgrid.Columns["account"].Width         = 130;
            nudgrid.Columns["reason"].Width          = 250;
        }