System.Windows.Forms.Form.CreateGraphics C# (CSharp) Method

CreateGraphics() public method

Drawing stuff
public CreateGraphics ( ) : Graphics
return System.Drawing.Graphics
		public Graphics CreateGraphics ()
		{
			var graphics = Graphics.FromHwnd (m_helper.ContentView.Handle);
			
			//graphics.TranslateTransform(Frame.Width / 2,Frame.Height / 2 );
			//graphics.Transform = new System.Drawing.Drawing2D.Matrix(1,0,0,-1,0,0);
			return graphics;
		}

Usage Example

Example #1
0
        /// <summary>
        /// Метод перестраивающий конечную точку нашего курсора по его перетаскиванию...
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            Point p1;
            Point p2;

            if (((e.Button & System.Windows.Forms.MouseButtons.Left) != 0) && (start != Point.Empty))
            {
                using (Graphics g = view.CreateGraphics())
                {
                    p1 = ((System.Windows.Forms.Control)changedImage).PointToScreen(start);

                    if (end != Point.Empty)
                    {
                        p2 = ((System.Windows.Forms.Control)changedImage).PointToScreen(end);
                        System.Windows.Forms.ControlPaint.DrawReversibleFrame(getRectangleForPoints(p1, p2), Color.Black, System.Windows.Forms.FrameStyle.Dashed);
                    }

                    end.X = e.X;
                    end.Y = e.Y;

                    p2 = ((System.Windows.Forms.Control)changedImage).PointToScreen(end);
                    System.Windows.Forms.ControlPaint.DrawReversibleFrame(getRectangleForPoints(p1, p2), Color.Black, System.Windows.Forms.FrameStyle.Dashed);
                }
            }
        }
All Usage Examples Of System.Windows.Forms.Form::CreateGraphics
Form