Example #1
0
        public override void Draw(IDraw draw)
        {
            if(TempDraw == null)
            {
                TempDraw = (IDraw)draw.Clone();
                this.SortContent();
            }

            int curIndex = -1;
            foreach (EditorContent content in this.ContentList)
            {
                curIndex++;

                // 此判断是判断需要绘制的内容对象是否被选中
                if (curIndex >= Math.Min(this.SelectStart, this.SelectEnd) && 
                    curIndex < Math.Max(this.SelectStart, this.SelectEnd))
                {
                    if (content.GetType() == typeof(EditorImage))
                    {
                        // 如果是图片,在选择状态下先画图片,再画选择的阴影
                        content.Draw(draw);
                        this.DrawBackground(draw, content, this.SelectBackgroundColor);
                    }
                    else
                    {
                        // 默认选中状态是先画背景阴影,再画内容
                        this.DrawBackground(draw, content, this.SelectBackgroundColor);
                        content.Draw(draw);
                    }
                }
                else
                {
                    // 如果是没被选中的内容,则直接绘制对象。
                    content.Draw(draw);
                }
            }
        }