示例#1
0
        public LuaCanvas(
            EmulationLuaLibrary emuLib,
            int width,
            int height,
            int?x,
            int?y,
            NLuaTableHelper tableHelper,
            Action <string> logOutputCallback)
        {
            _emuLib           = emuLib;
            _th               = tableHelper;
            LogOutputCallback = logOutputCallback;

            SuspendLayout();

            AutoScaleDimensions = new SizeF(6F, 13F);
            AutoScaleMode       = AutoScaleMode.Font;
            AutoSize            = true;
            AutoSizeMode        = AutoSizeMode.GrowAndShrink;
            ClientSize          = new Size(284, 261);
            FormBorderStyle     = FormBorderStyle.FixedSingle;
            Name = "LuaCanvas";
            Text = "LuaCanvas";

            if (x.HasValue)
            {
                StartPosition = FormStartPosition.Manual;
                Left          = (int)x;
                if (y.HasValue)
                {
                    Top = (int)y;
                }
            }

            luaPictureBox = new LuaPictureBox
            {
                Image       = Properties.Resources.LuaPictureBox,
                Location    = new Point(0, 0),
                Margin      = new Padding(0),
                Name        = "luaPictureBox",
                Size        = new Size(100, 50),
                SizeMode    = PictureBoxSizeMode.AutoSize,
                TabIndex    = 0,
                TableHelper = _th,
                TabStop     = false
            };
            Controls.Add(luaPictureBox);

            ResumeLayout();

            // was this done after reflow for a reason? --yoshi
            luaPictureBox.Width  = width;
            luaPictureBox.Height = height;
            luaPictureBox.Image  = new Bitmap(width, height);
            PerformLayout();
        }