新しいフォームにこのコンストラクターがあります。
public MagnifierForm(Point MousePosition)
{
_doMove = true;
FormBorderStyle = FormBorderStyle.None;
ShowInTaskbar = false;
TopMost = true;
Width = 150;
Height = 150;
GraphicsPath gp = new GraphicsPath();
gp.AddEllipse(ClientRectangle);
Region = new Region(gp);
mTimer = new Timer();
mTimer.Enabled = true;
mTimer.Interval = 20;
mTimer.Tick += new EventHandler(HandleTimer);
mScreenImage = new Bitmap(Screen.PrimaryScreen.Bounds.Width,
Screen.PrimaryScreen.Bounds.Height);
//maybe subtract half of the forms width/height from the points (offset them)
mStartPoint = MousePosition;
mTargetPoint = MousePosition;
speed = 0.35F;
}
コンストラクターの下部に、次のコードを追加しました。
mStartPoint = MousePosition;
mTargetPoint = MousePosition;
Form1 には、次のコードがあります。
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == (Keys.Control | Keys.M))
{
if (mf == null)
{
mf = new Magnifier20070401.MagnifierForm(System.Windows.Forms.Cursor.Position);
mf.StartPosition = FormStartPosition.Manual;
mf.Location = Control.MousePosition;
mf.Show();
this.Select();
}
else if (mf.IsDisposed)
{
mf = new Magnifier20070401.MagnifierForm(System.Windows.Forms.Cursor.Position);
mf.StartPosition = FormStartPosition.Manual;
mf.Location = Control.MousePosition;
mf.Show();
}
else
{
mf.Close();
mf = null;
}
}
return base.ProcessCmdKey(ref msg, keyData);
}
すべてが正常に機能しています。そして、フォームの位置/場所を設定するこの mStartPoint もうまく機能しています。
しかし、文はどういう意味ですか?//たぶん、ポイントからフォームの幅/高さの半分を引きます (それらをオフセットします)
センテンスは、mStartPoint および mTargetPoint と関係があります。
この文を使いたい場合、どのように見えるべきかの例を誰かに見せてもらえますか?