Esempio n. 1
0
 //============================================================
 // <T>单击显示图片。</T>
 //============================================================
 private void qgvTextures_RowEnter(object sender, DataGridViewCellEventArgs e)
 {
     if (!_loading)
     {
         int rowIndex = e.RowIndex;
         if (-1 != rowIndex)
         {
             DataGridViewRow    row     = qgvTextures.Rows[rowIndex];
             FDrMaterialTexture texture = row.Tag as FDrMaterialTexture;
             if (null == texture)
             {
                 qpbViewer.Clear();
                 qpbViewer.Visible = false;
                 return;
             }
             else
             {
                 texture.Open();
                 if (null != texture.Bitmap)
                 {
                     qpbViewer.LoadBitmap(texture.Bitmap.Image.Native);
                 }
                 qpbViewer.Visible = true;
             }
         }
     }
 }
Esempio n. 2
0
        //============================================================
        // <T>加载材质信息。</T>
        //
        // @prama material 材质名称
        //============================================================
        public void LoadMaterialGroup(FDrMaterialGroup materialGroup)
        {
            _loading = true;
            // 打开材质
            materialGroup.Open();
            _materialGroup = materialGroup;
            // 建立材质集合
            lbxThemes.Items.Clear();
            foreach (FDrMaterial material in materialGroup.Materials)
            {
                lbxThemes.Items.Add(material.ThemeCode);
            }
            lbxThemes.SelectedIndex = 0;
            // 设置属性
            qdrMaterialGroup.LoadMaterialGroup(materialGroup);
            qdrMaterialInfo.LoadMaterial(materialGroup.Materials.First);
            // 建立列表
            FDrMaterialTexture firstTexture = null;

            qgvTextures.Rows.Clear();
            foreach (FDrMaterialTexture texture in materialGroup.Textures)
            {
                // 创建数据行
                DataGridViewRow row = new DataGridViewRow();
                row.DefaultCellStyle.BackColor = Color.LightGreen;
                row.Tag = texture;
                // 创建类型单元格
                DataGridViewTextBoxCell cellType = new DataGridViewTextBoxCell();
                cellType.Value = texture.TypeName;
                row.Cells.Add(cellType);
                // 创建有效性单元格
                DataGridViewTextBoxCell cellValid = new DataGridViewTextBoxCell();
                cellValid.Value = texture.IsValid;
                row.Cells.Add(cellValid);
                // 创建来源单元格
                DataGridViewTextBoxCell cellSource = new DataGridViewTextBoxCell();
                cellSource.Value = texture.Source;
                row.Cells.Add(cellSource);
                // 创建来源类型单元格
                DataGridViewTextBoxCell cellSourceType = new DataGridViewTextBoxCell();
                cellSourceType.Value = texture.TypeName;
                row.Cells.Add(cellSourceType);
                // 创建来源索引单元格
                DataGridViewTextBoxCell cellSourceIndex = new DataGridViewTextBoxCell();
                cellSourceIndex.Value = texture.SourceIndex;
                row.Cells.Add(cellSourceIndex);
                // 创建尺寸单元格
                DataGridViewTextBoxCell cellSize = new DataGridViewTextBoxCell();
                if (null != texture.Bitmap)
                {
                    cellSize.Value = texture.Bitmap.Size.Width + "X" + texture.Bitmap.Size.Height;
                }
                row.Cells.Add(cellSize);
                // 创建数据长度单元格
                DataGridViewTextBoxCell cellLength = new DataGridViewTextBoxCell();
                if (null != texture.Bitmap)
                {
                    cellLength.Value = texture.Bitmap.Length;
                }
                row.Cells.Add(cellLength);
                qgvTextures.Rows.Add(row);
                // 设置首行
                if (null == firstTexture)
                {
                    row.Selected = true;
                    firstTexture = texture;
                }
            }
            // 默认显示第一张图片
            if (null != firstTexture)
            {
                qpbViewer.LoadBitmap(firstTexture.Bitmap.Image.Native);
            }
            else
            {
                qpbViewer.Clear();
            }
            _loading = false;
        }