//------------------------------------------------------------------------------------ #region 描画関係 //------------------------------------------------------------------------------------ private void Form1_Paint(object sender, PaintEventArgs e) { e.Graphics.InterpolationMode = _zoom < 1.0 ? InterpolationMode.High : InterpolationMode.Low; e.Graphics.CompositingMode = CompositingMode.SourceOver; e.Graphics.CompositingQuality = CompositingQuality.GammaCorrected; e.Graphics.SmoothingMode = SmoothingMode.None; e.Graphics.PixelOffsetMode = PixelOffsetMode.None; e.Graphics.TranslateTransform((float)_centerX, (float)_centerY); e.Graphics.RotateTransform((float)_angle); e.Graphics.ScaleTransform((float)_zoom, (float)_zoom); e.Graphics.DrawImage(_bmp, -_bmp.Width / 2f, -_bmp.Height / 2f, (float)_bmp.Width, (float)_bmp.Height); e.Graphics.ResetTransform(); if (_optShowGrip) { switch (_gripNow) { case Grip.TopLeft: e.Graphics.FillRectangle(_sbBlue, 0, 0, GripWidth, GripWidth); break; case Grip.Top: e.Graphics.FillRectangle(_sbBlue, GripWidth, 0, ClientSize.Width - GripWidth * 2, GripWidth); break; case Grip.TopRight: e.Graphics.FillRectangle(_sbBlue, ClientSize.Width - GripWidth, 0, GripWidth, GripWidth); break; case Grip.Right: e.Graphics.FillRectangle(_sbBlue, ClientSize.Width - GripWidth, GripWidth, GripWidth, ClientSize.Height - GripWidth * 2); break; case Grip.BottomRight: e.Graphics.FillRectangle(_sbBlue, ClientSize.Width - GripWidth, ClientSize.Height - GripWidth, GripWidth, GripWidth); break; case Grip.Bottom: e.Graphics.FillRectangle(_sbBlue, GripWidth, ClientSize.Height - GripWidth, ClientSize.Width - GripWidth * 2, GripWidth); break; case Grip.BottomLeft: e.Graphics.FillRectangle(_sbBlue, 0, ClientSize.Height - GripWidth, GripWidth, GripWidth); break; case Grip.Left: e.Graphics.FillRectangle(_sbBlue, 0, GripWidth, GripWidth, ClientSize.Height - GripWidth * 2); break; default: break; } } switch (_gripNow) { case Grip.Angle: e.Graphics.FillRectangle(_sbGreen, GripWidth, GripWidth, GripWidth, GripWidth); e.Graphics.DrawImage(_bmp_angle, GripWidth, GripWidth, _bmp_angle.Width, _bmp_angle.Height); break; case Grip.Move: e.Graphics.FillRectangle(_sbGreen, GripWidth * 2, GripWidth, ClientSize.Width - GripWidth * 6, GripWidth); break; case Grip.Min: e.Graphics.FillRectangle(_sbGreen, ClientSize.Width - GripWidth * 4, GripWidth, GripWidth, GripWidth); e.Graphics.DrawImage(_bmp_min, ClientSize.Width - GripWidth * 4, GripWidth, _bmp_min.Width, _bmp_min.Height); break; case Grip.Max: e.Graphics.FillRectangle(_sbGreen, ClientSize.Width - GripWidth * 3, GripWidth, GripWidth, GripWidth); e.Graphics.DrawImage(_bmp_max, ClientSize.Width - GripWidth * 3, GripWidth, _bmp_max.Width, _bmp_max.Height); break; case Grip.Close: e.Graphics.FillRectangle(_sbRed, ClientSize.Width - GripWidth * 2, GripWidth, GripWidth, GripWidth); e.Graphics.DrawImage(_bmp_close, ClientSize.Width - GripWidth * 2, GripWidth, _bmp_close.Width, _bmp_close.Height); break; default: break; } if (_optShowDebug) { e.Graphics.DrawRectangle(Pens.Red, (int)_centerX - 2, (int)_centerY - 2, 5, 5); DrawString(e.Graphics, 0, 0, Application.ProductName + " Version " + Application.ProductVersion); DrawString(e.Graphics, 0, 1, "_fielname: " + _fielname); DrawString(e.Graphics, 0, 2, "_bmp.Width: " + _bmp.Width.ToString()); DrawString(e.Graphics, 0, 3, "_bmp.Height: " + _bmp.Height.ToString()); DrawString(e.Graphics, 0, 4, "_bmp.PixelFormat: " + _bmp.PixelFormat.ToString()); DrawString(e.Graphics, 0, 5, "_bmp.RawFormat: " + GetRawFormatString(_bmp.RawFormat)); DrawString(e.Graphics, 0, 6, "_centerX: " + _centerX.ToString("000.0")); DrawString(e.Graphics, 0, 7, "_centerY: " + _centerY.ToString("000.0")); DrawString(e.Graphics, 0, 8, "_angle: " + _angle.ToString("0.000")); DrawString(e.Graphics, 0, 9, "_zoom: " + _zoom.ToString("0.000")); DrawString(e.Graphics, 0, 10, "_gripDown: " + _gripDown.ToString()); DrawString(e.Graphics, 0, 11, "_gripNow: " + _gripNow.ToString()); DrawString(e.Graphics, 0, 12, "_gripOld: " + _gripOld.ToString()); DrawString(e.Graphics, 0, 13, "_ptDown: " + _ptDown.ToString()); DrawString(e.Graphics, 0, 14, "_ptGrip: " + _ptGrip.ToString()); DrawString(e.Graphics, 0, 15, "_downShift: " + _downShift.ToString()); DrawString(e.Graphics, 0, 16, "_downCtrl: " + _downCtrl.ToString()); DrawString(e.Graphics, 0, 17, "_optFitImage: " + _optFitImage.ToString()); DrawString(e.Graphics, 0, 18, "_optNoBorder: " + _optNoBorder.ToString()); DrawString(e.Graphics, 0, 19, "_optShowGrip: " + _optShowGrip.ToString()); DrawString(e.Graphics, 0, 20, "_optShowDebug: " + _optShowDebug.ToString()); } }