コード例 #1
0
ファイル: BlockController.cs プロジェクト: andyhebear/kitsune
        public BlockController(Graphics textMetrics, Font textFont, Size canvasSize, Func<TextBox> textBoxMaker)
        {
            this.Modified += delegate(object sender) { };
            blockSpace = new BlockSpace();
            blockSpace.OnTopLevelAdded += new TopLevelEvent(blockSpace_OnTopLevelAdded);
            blockSpace.OnTopLevelDeleted += new TopLevelEvent(blockSpace_OnTopLevelDeleted);
            blockSpace.OnTopLevelMoved += new TopLevelEvent(blockSpace_OnTopLevelMoved);

            palette = new Palette(new Size(canvasSize.Width - 20, 60), textMetrics, textFont);
            palette.Modified += new PaletteModifiedEvent(palette_Modified);

            canvasView = new CanvasView(textMetrics, canvasSize, allViews, DropRegions, textFont, palette);
            this.canvasSize = canvasSize;
            state = CanvasState.Ready;
            viewFactory = new BlockViewFactory(textMetrics, textFont, blockSpace, blockViews,
                ()=>Modified(this));

            this.textBoxMaker = textBoxMaker;
        }
コード例 #2
0
ファイル: CanvasView.cs プロジェクト: andyhebear/kitsune
 public CanvasView(Graphics graphics, Size canvasSize, 
     Dictionary<IBlockView, Point> subViews, List<DropRegion> dropRegions,
     Font textFont, Palette palette)
 {
     this.graphics = graphics;
     this.subViews = subViews;
     this.dropRegions = dropRegions;
     this.canvas = new Bitmap(canvasSize.Width, canvasSize.Height, System.Drawing.Imaging.PixelFormat.Format32bppPArgb);
     this.textFont = textFont;
     Bitmap bg = BitmapExtensions.LoadBmp("bg.bmp");
     Bitmap bg2 = new Bitmap(bg.Width, bg.Height, System.Drawing.Imaging.PixelFormat.Format32bppPArgb);
     using (Graphics g = Graphics.FromImage(bg2))
     {
         g.DrawImageUnscaled(bg, 0, 0);
     }
     bg.Dispose();
     this.backgroundBrush = new TextureBrush(bg2);
     this.palette = palette;
     palette.Location = new Point(10, 10);
     // InitBackGround(canvasSize);
 }