GridControl的列显示成图片+文字,并且不同的文字对应不同的图片

     public static void SetDispatchStatus(GridView aGridView1, GridColumn aColStatus, bool aOnlyImage)
        {
            var imageList = new ImageList();
            imageList.ImageSize = new Size(12, 12);
            imageList.ColorDepth = ColorDepth.Depth32Bit;
            imageList.Images.Add("0", Resources.已录入12);
            imageList.Images.Add("1", Resources.待返工12);
            imageList.Images.Add("2", Resources.出库中12);
            imageList.Images.Add("3", Resources.中断待料12);
            imageList.Images.Add("4", Resources.中断待答复12 );
            imageList.Images.Add("5", Resources.已完工12);
            imageList.Images.Add("6", Resources.已完检12);
            imageList.Images.Add("7", Resources.作废12);
         

            imageList.TransparentColor = Color.Transparent;
            //
            var repositoryItemImageComboBoxStatus = new RepositoryItemImageComboBox();
            aColStatus.ToolTip = "状态";
            if (aOnlyImage)
            {
                aColStatus.Width = 22;

                repositoryItemImageComboBoxStatus.Items.AddRange(new[]
                                                                     {
                                                                         new ImageComboBoxItem("",JobDispatchStatus.READY,0),
                                                                         new ImageComboBoxItem("",JobDispatchStatus.WAIT_REWORK,1),
                                                                         new ImageComboBoxItem("",JobDispatchStatus.WORKING,2),
                                                                         new ImageComboBoxItem("",JobDispatchStatus.BREAK_FOR_PARTS,3),
                                                                         new ImageComboBoxItem("",JobDispatchStatus.BREAK_FOR_REPLY,4),
                                                                         new ImageComboBoxItem("",JobDispatchStatus.FINISHED,5),
                                                                         new ImageComboBoxItem("",JobDispatchStatus.CHECKED,6),
                                                                         new ImageComboBoxItem("",JobDispatchStatus.CANCELED,7),
                                                                    
                                                                     });
            }
            else
            {
                repositoryItemImageComboBoxStatus.Items.AddRange(new[]
                                                                     {
                                                                         new ImageComboBoxItem("待开工",JobDispatchStatus.READY,0),
                                                                         new ImageComboBoxItem("待返工",JobDispatchStatus.WAIT_REWORK,1),
                                                                         new ImageComboBoxItem("维修中",JobDispatchStatus.WORKING,2),
                                                                         new ImageComboBoxItem("中断待料",JobDispatchStatus.BREAK_FOR_PARTS,3),
                                                                         new ImageComboBoxItem("中断待答复",JobDispatchStatus.BREAK_FOR_REPLY,4),
                                                                         new ImageComboBoxItem("已完工",JobDispatchStatus.FINISHED,5),
                                                                         new ImageComboBoxItem("已完检",JobDispatchStatus.CHECKED,6),
                                                                         new ImageComboBoxItem("已作废",JobDispatchStatus.CANCELED,7),
                                                                     });
            }
            repositoryItemImageComboBoxStatus.Name = "repositoryItemImageComboBoxStatus";
            repositoryItemImageComboBoxStatus.SmallImages = imageList;
            //
            aColStatus.ColumnEdit = repositoryItemImageComboBoxStatus;
        }

效果图:

posted @ 2013-09-23 15:47  沙耶  阅读(3421)  评论(0编辑  收藏  举报