Хорошо ... Итак, у меня есть эта довольно скромная система скриншотов, которую я использовал некоторое время ... Она в значительной степени включает в себя создание несколько прозрачной формы, которая автоматически подгоняет размеры под все мониторы ... Что даетэкран (ы) - эффект затемнения ... У меня есть скрытый элемент управления "кнопка", чье положение устанавливается при наведении мыши ... Затем, до наведения мыши, размер кнопки будет изменяться в реальном временисоздать своего рода область «выделения» ... Для реализации этого эффекта кнопке предоставляется полная прозрачность.
Пример источника: http://db.tt/LWxfDB6 [Также опубликовано ниже]
IУ меня есть две проблемы, которые напрямую связаны, я считаю.
1.) Для мультимониторов координаты отключены, он правильно возвращает координаты, по которым щелкнули (выделены), но поле выделения (эффект) часто находится на неправильном мониторе.
2.) Вы можете выбирать только из верхнего левого угла ---> нижнего правого и не универсального.
Извините, если я не объяснил это хорошо, источник должен объяснить лучше.Заранее спасибо за любую помощь.:)
: MarkRect.cs:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Imaging;
using System.IO;</p>
<p>namespace TW_Media_Chat_
{
public partial class MarkRect : Form
{
Point Point1;
Point Point2;
public MarkRect()
{
InitializeComponent();
// Programatically maximize to all monitors
Screen[] Screens = Screen.AllScreens;
int AllWidth = 0;
int AllHeight = 0;
for (int index = 0; index < Screens.Length; index++)
{
AllWidth += Screens[index].Bounds.Width;
AllHeight += Screens[index].Bounds.Height;
}
this.Width = AllWidth;
this.Height = AllHeight;</p>
<pre><code> }
private void Transparency_MouseDown(object sender, MouseEventArgs e)
{
button1.Visible = true;
button1.Location = Cursor.Position;
Point1 = Cursor.Position;
}
private void Transparency_MouseUp(object sender, MouseEventArgs e)
{
this.Visible = false;
Point2 = Cursor.Position;
AjaxChatBridge.AjaxVars.Point1 = Point1;
AjaxChatBridge.AjaxVars.Point2 = Point2;
this.Close();
}
private void MarkRect_MouseMove(object sender, MouseEventArgs e)
{
this.button1.Width = Cursor.Position.X - this.button1.Left;
this.button1.Height = Cursor.Position.Y - this.button1.Top;
}
}
}
: MarkRect.Designer.cs:
namespace TW_Media_Chat_
{
partial class MarkRect
{
///
/// Required designer variable.
///
private System.ComponentModel.IContainer components = null;</p>
<pre><code> /// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.BackColor = System.Drawing.Color.Lime;
this.button1.ForeColor = System.Drawing.Color.Lime;
this.button1.Location = new System.Drawing.Point(220, 172);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(19, 18);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = false;
this.button1.Visible = false;
//
// MarkRect
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Black;
this.ClientSize = new System.Drawing.Size(490, 406);
this.Controls.Add(this.button1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "MarkRect";
this.Opacity = 0.5D;
this.Text = "Transparency";
this.TopMost = true;
this.TransparencyKey = System.Drawing.Color.Lime;
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Transparency_MouseDown);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.MarkRect_MouseMove);
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.Transparency_MouseUp);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button button1;
}
}