コード例 #1
0
ファイル: Program.cs プロジェクト: Zgencheva/C--OOP
        static void Main(string[] args)
        {
            IDrawer drawer = new FileDrawer("../../../game.txt");
            Game    game   = new Game(drawer);

            game.Start();
        }
コード例 #2
0
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            if (Items.Count == 0)
            {
                return;
            }

            e.DrawBackground();

            var graphic  = e.Graphics;
            var item     = Items[e.Index] as Item;
            var position = new Point(e.Bounds.X, e.Bounds.Y);
            var text     = item.ToString();

            var iconImage = GetItemImage(item);

            graphic.DrawImage(iconImage, position);

            position.X += iconImage.Width + 2; // padding
            position.Y += 2;                   // padding

            var finderMode = FinderDrawer.DetectFinderMode(Parent);

            switch (finderMode)
            {
            case FinderMode.Member:
                if (NeedsHighlighting(e))
                {
                    FinderDrawer.HighLightSearchWords(text, e, position, HighlightWords, brshHighlight);
                }

                DrawMemberItems(e, item, text, position);
                break;

            case FinderMode.File:
                if (NeedsHighlighting(e))
                {
                    FinderDrawer.HighLightSearchWords(text, e, position, HighlightWords, brshHighlight);
                }

                FileDrawer.DrawFiles(text, e, position);
                break;

            case FinderMode.StyleSheet:
                StyleSheetDrawer.
                DrawStyleSheets(e, graphic, position, text, HighlightWords, DummySize, brshHighlight);
                break;

            default:
                break;
            }

            base.OnDrawItem(e);
        }