private void InitGridList()
        {
            DSkinGridListColumn dSkinGridListColumn1 = new DSkinGridListColumn();
            DSkinGridListColumn dSkinGridListColumn2 = new DSkinGridListColumn();

            //
            //
            //
            dSkinGridListColumn1.Item.Font            = new System.Drawing.Font("宋体", 9F);
            dSkinGridListColumn1.Item.ForeColor       = System.Drawing.Color.Black;
            dSkinGridListColumn1.Item.InheritanceSize = new System.Drawing.SizeF(0F, 1F);
            dSkinGridListColumn1.Item.Location        = new System.Drawing.Point(0, 0);
            dSkinGridListColumn1.Item.Name            = string.Empty;
            dSkinGridListColumn1.Item.Size            = new System.Drawing.Size(40, 22);
            dSkinGridListColumn1.Item.Text            = "项";
            dSkinGridListColumn1.Item.TextAlign       = System.Drawing.ContentAlignment.MiddleCenter;
            dSkinGridListColumn1.Name             = "项";
            dSkinGridListColumn1.Visble           = true;
            dSkinGridListColumn1.Width            = 88;
            dSkinGridListColumn1.DataPropertyName = "Column_Item";
            //
            //
            //
            dSkinGridListColumn2.Item.Font            = new System.Drawing.Font("宋体", 9F);
            dSkinGridListColumn2.Item.ForeColor       = System.Drawing.Color.Black;
            dSkinGridListColumn2.Item.InheritanceSize = new System.Drawing.SizeF(0F, 1F);
            dSkinGridListColumn2.Item.Location        = new System.Drawing.Point(40, 0);
            dSkinGridListColumn2.Item.Name            = string.Empty;
            dSkinGridListColumn2.Item.Size            = new System.Drawing.Size(70, 22);
            dSkinGridListColumn2.Item.Text            = "值";
            dSkinGridListColumn2.Item.TextAlign       = System.Drawing.ContentAlignment.MiddleCenter;
            dSkinGridListColumn2.Name             = "值";
            dSkinGridListColumn2.Visble           = true;
            dSkinGridListColumn2.Width            = dSkinGridList_FileInfo.Width - 88 - 5;
            dSkinGridListColumn2.DataPropertyName = "Column_Value";

            //dSkinGridList_FileInfo.RowHeight = 22;
            dSkinGridList_FileInfo.ColumnFill = true;  //窗体最大化后,列宽自适应
            dSkinGridList_FileInfo.EnablePage = false;
            dSkinGridList_FileInfo.Dock       = System.Windows.Forms.DockStyle.Fill;

            //设置透明
            dSkinGridList_FileInfo.BackColor            = Color.Transparent;
            dSkinGridList_FileInfo.DoubleItemsBackColor = Color.Transparent;
            dSkinGridList_FileInfo.SingleItemsBackColor = Color.Transparent;
            DSkinLinearGradientBrush dSkinLinearGradientBrush1 = new DSkinLinearGradientBrush();

            dSkinGridList_FileInfo.ColumnHeaderBrush      = dSkinLinearGradientBrush1;
            dSkinGridList_FileInfo.ColumnHeaderHoverBrush = dSkinLinearGradientBrush1;
            dSkinGridList_FileInfo.ColumnHeaderPressBrush = dSkinLinearGradientBrush1;

            dSkinGridList_FileInfo.Columns.AddRange(new DSkinGridListColumn[] {
                dSkinGridListColumn1,
                dSkinGridListColumn2
            });
        }
Beispiel #2
0
        /// <summary>
        /// 读取excel
        /// </summary>
        private void 导入excel_Click()
        {
            string path = "";

            System.Windows.Forms.OpenFileDialog fd = new System.Windows.Forms.OpenFileDialog();
            fd.Title  = "选择文件";                                          //选择框名称
            fd.Filter = "xls files (*.xls)|*.xls";                       //选择文件的类型为Xls表格
            if (fd.ShowDialog() == System.Windows.Forms.DialogResult.OK) //当点击确定
            {
                path = fd.FileName.Trim();                               //文件路径
                path = path.Replace("\\", "/");
            }


            dSkinGridList1.Rows.Clear();

            string mystring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='";

            mystring += path.ToString();
            mystring += "';User ID=admin;Password=;Extended properties='Excel 8.0;IMEX=1;HDR=NO;'";
            OleDbConnection  cnnxls = new OleDbConnection(mystring);
            OleDbDataAdapter myDa   = new OleDbDataAdapter("Select * from [Sheet1$]", cnnxls);
            DataSet          myDs   = new DataSet();

            myDa.Fill(myDs);    //数据存放在myDs中了
            System.Data.DataTable dataTable = myDs.Tables[0];
            for (int i = 10; i < dataTable.Columns.Count; i++)
            {
                DSkinGridListColumn dSkinGridListColumn = new DSkinGridListColumn();
                dSkinGridListColumn.Name             = dataTable.Columns[i].ColumnName;
                dSkinGridListColumn.Width            = 100;
                dSkinGridListColumn.DataPropertyName = dataTable.Columns[i].ColumnName;
                dSkinGridList1.Columns.Add(dSkinGridListColumn);
            }
            for (int j = 0; j < dataTable.Rows.Count; j++)
            {
                if (dataTable.Rows[j].ItemArray[3].ToString() != "")
                {
                    dSkinGridList1.Rows.AddRow(dataTable.Rows[j].ItemArray);
                }
            }
        }
Beispiel #3
0
        private void InitDSkinListView()
        {
            DSkinGridListColumn dSkinGridListColumn0  = new DSkinGridListColumn();
            DSkinGridListColumn dSkinGridListColumn1  = new DSkinGridListColumn();
            DSkinGridListColumn dSkinGridListColumn11 = new DSkinGridListColumn();

            //dSkinGridListColumn0.ItemType = ControlType.DuiPictureBox;
            dSkinGridListColumn0.Item.Font            = new System.Drawing.Font("宋体", 9F);
            dSkinGridListColumn0.Item.ForeColor       = System.Drawing.Color.Black;
            dSkinGridListColumn0.Item.InheritanceSize = new System.Drawing.SizeF(0F, 1F);
            dSkinGridListColumn0.Item.Location        = new System.Drawing.Point(0, 0);
            dSkinGridListColumn0.Item.Name            = "";
            dSkinGridListColumn0.Item.Size            = new System.Drawing.Size(25, 25);
            dSkinGridListColumn0.Item.Text            = "DeviceIcon";
            dSkinGridListColumn0.Item.TextAlign       = System.Drawing.ContentAlignment.MiddleLeft;
            dSkinGridListColumn0.DockStyle            = DockStyle.Fill;
            dSkinGridListColumn0.Name             = "DeviceIcon";
            dSkinGridListColumn0.Visble           = true;
            dSkinGridListColumn0.Width            = 25;
            dSkinGridListColumn0.DataPropertyName = "Column_Icon";

            dSkinGridListColumn1.Item.Font            = new System.Drawing.Font("宋体", 9F);
            dSkinGridListColumn1.Item.ForeColor       = System.Drawing.Color.Black;
            dSkinGridListColumn1.Item.InheritanceSize = new System.Drawing.SizeF(0F, 1F);
            dSkinGridListColumn1.Item.Location        = new System.Drawing.Point(0, 0);
            dSkinGridListColumn1.Item.Name            = "";
            dSkinGridListColumn1.Item.Size            = new System.Drawing.Size(40, 22);
            dSkinGridListColumn1.Item.Text            = "Device名称";
            dSkinGridListColumn1.Item.TextAlign       = System.Drawing.ContentAlignment.MiddleLeft;
            dSkinGridListColumn1.DockStyle            = DockStyle.Left;
            dSkinGridListColumn1.Name             = "Device名称";
            dSkinGridListColumn1.Visble           = true;
            dSkinGridListColumn1.Width            = 180;
            dSkinGridListColumn1.DataPropertyName = "Column_Name";

            dSkinGridListColumn11.Item.Font            = new System.Drawing.Font("宋体", 9F);
            dSkinGridListColumn11.Item.ForeColor       = System.Drawing.Color.Black;
            dSkinGridListColumn11.Item.InheritanceSize = new System.Drawing.SizeF(0F, 1F);
            dSkinGridListColumn11.Item.Location        = new System.Drawing.Point(0, 0);
            dSkinGridListColumn11.Item.Name            = "";
            dSkinGridListColumn11.Item.Size            = new System.Drawing.Size(40, 22);
            dSkinGridListColumn11.Item.Text            = "DeviceID";
            dSkinGridListColumn11.Item.TextAlign       = System.Drawing.ContentAlignment.MiddleLeft;
            dSkinGridListColumn11.DockStyle            = DockStyle.Left;
            dSkinGridListColumn11.Name             = "DeviceID";
            dSkinGridListColumn11.Visble           = true;
            dSkinGridListColumn11.Width            = 180;
            dSkinGridListColumn11.DataPropertyName = "Column_Name";

            dSkinGridList_DLNA.RowHeight            = 25;
            dSkinGridList_DLNA.ColumnHeadersVisible = false;

            //设置透明
            dSkinGridList_DLNA.BackColor            = Color.Transparent;
            dSkinGridList_DLNA.DoubleItemsBackColor = Color.Transparent;
            dSkinGridList_DLNA.SingleItemsBackColor = Color.Transparent;
            DSkinLinearGradientBrush dSkinLinearGradientBrush1 = new DSkinLinearGradientBrush();

            dSkinGridList_DLNA.ColumnHeaderBrush = dSkinLinearGradientBrush1;

            dSkinGridList_DLNA.Columns.AddRange(new DSkinGridListColumn[] {
                dSkinGridListColumn0,
                dSkinGridListColumn1,
                dSkinGridListColumn11
            });
        }