Exemplo n.º 1
0
        public CaptureForm(SetunaOption.SetunaOptionData opt)
        {
            this.InitializeComponent();
            this.targetScreen = this.GetCurrentScreen();
            InitScreenNewSize();
            var tBitmap = new Bitmap(this.ScreenNewSize.Width, this.ScreenNewSize.Height, PixelFormat.Format24bppRgb);
            var tXDpi   = (float)this.ScreenNewSize.Width / this.targetScreen.Bounds.Width;
            var tYDpi   = (float)this.ScreenNewSize.Height / this.targetScreen.Bounds.Height;

            if (tXDpi != 1 || tYDpi != 1)
            {
                tXDpi = tXDpi - .1F;
                tYDpi = tYDpi - .1F;
                tBitmap.SetResolution(tXDpi * 100, tYDpi * 100);
            }

            Console.WriteLine(string.Format("XDpi:{0},YDpi:{1}", tXDpi, tYDpi));
            imgSnap = tBitmap;
            selArea = new Form();
            selArea.AutoScaleMode         = AutoScaleMode.None;
            selArea.BackColor             = Color.Blue;
            selArea.BackgroundImageLayout = ImageLayout.None;
            selArea.ControlBox            = false;
            selArea.FormBorderStyle       = FormBorderStyle.None;
            selArea.MaximizeBox           = false;
            selArea.MinimizeBox           = false;
            selArea.MinimumSize           = new Size(1, 1);
            selArea.ClientSize            = new Size(1, 1);
            selArea.ShowIcon      = false;
            selArea.ShowInTaskbar = false;
            selArea.SizeGripStyle = SizeGripStyle.Hide;
            selArea.StartPosition = FormStartPosition.Manual;
            selArea.Text          = "CaptureSelArea";
            selArea.TopMost       = true;
            selArea.Left          = 0;
            selArea.Top           = 0;
            selArea.Width         = 1;
            selArea.Height        = 1;
            selArea.Visible       = false;
            base.AddOwnedForm(selArea);
            selLineHor1 = new CaptureSelLine(SelLineType.Horizon, opt.SelectLineSolid, opt.SelectLineColor);
            base.AddOwnedForm(selLineHor1);
            selLineHor1.Show(this);
            selLineHor2 = new CaptureSelLine(SelLineType.Horizon, opt.SelectLineSolid, opt.SelectLineColor);
            base.AddOwnedForm(selLineHor2);
            selLineHor2.Show(this);
            selLineVer1 = new CaptureSelLine(SelLineType.Vertical, opt.SelectLineSolid, opt.SelectLineColor);
            base.AddOwnedForm(selLineVer1);
            selLineVer1.Show(this);
            selLineVer2 = new CaptureSelLine(SelLineType.Vertical, opt.SelectLineSolid, opt.SelectLineColor);
            base.AddOwnedForm(selLineVer2);
            selLineVer2.Show(this);
            selLineHor1.Visible = false;
            selLineHor2.Visible = false;
            selLineVer1.Visible = false;
            selLineVer2.Visible = false;
            selArea.Visible     = false;
            base.Opacity        = 0.99000000953674316;
        }
Exemplo n.º 2
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     CaptureSelLine.AddDashOffset();
     selLineVer1.Refresh();
     selLineVer2.Refresh();
     selLineHor1.Refresh();
     selLineHor2.Refresh();
 }
Exemplo n.º 3
0
 public CaptureForm(SetunaOption.SetunaOptionData opt)
 {
     this.InitializeComponent();
     imgSnap = new Bitmap(this.screenNewSize.Width, this.screenNewSize.Height, PixelFormat.Format24bppRgb);
     selArea = new Form();
     selArea.AutoScaleMode         = AutoScaleMode.None;
     selArea.BackColor             = Color.Blue;
     selArea.BackgroundImageLayout = ImageLayout.None;
     selArea.ControlBox            = false;
     selArea.FormBorderStyle       = FormBorderStyle.None;
     selArea.MaximizeBox           = false;
     selArea.MinimizeBox           = false;
     selArea.MinimumSize           = new Size(1, 1);
     selArea.ClientSize            = new Size(1, 1);
     selArea.ShowIcon      = false;
     selArea.ShowInTaskbar = false;
     selArea.SizeGripStyle = SizeGripStyle.Hide;
     selArea.StartPosition = FormStartPosition.Manual;
     selArea.Text          = "CaptureSelArea";
     selArea.TopMost       = true;
     selArea.Left          = 0;
     selArea.Top           = 0;
     selArea.Width         = 1;
     selArea.Height        = 1;
     selArea.Visible       = false;
     base.AddOwnedForm(selArea);
     selLineHor1 = new CaptureSelLine(SelLineType.Horizon, opt.SelectLineSolid, opt.SelectLineColor);
     base.AddOwnedForm(selLineHor1);
     selLineHor1.Show(this);
     selLineHor2 = new CaptureSelLine(SelLineType.Horizon, opt.SelectLineSolid, opt.SelectLineColor);
     base.AddOwnedForm(selLineHor2);
     selLineHor2.Show(this);
     selLineVer1 = new CaptureSelLine(SelLineType.Vertical, opt.SelectLineSolid, opt.SelectLineColor);
     base.AddOwnedForm(selLineVer1);
     selLineVer1.Show(this);
     selLineVer2 = new CaptureSelLine(SelLineType.Vertical, opt.SelectLineSolid, opt.SelectLineColor);
     base.AddOwnedForm(selLineVer2);
     selLineVer2.Show(this);
     selLineHor1.Visible = false;
     selLineHor2.Visible = false;
     selLineVer1.Visible = false;
     selLineVer2.Visible = false;
     selArea.Visible     = false;
     base.Opacity        = 0.99000000953674316;
 }