All pastes #45926 Raw Edit

Someone

public text v1 · immutable
#45926 ·published 2006-03-16 15:43 UTC
rendered paste body
		private void PaintBackground() 
		{
			int widthDiff = 10;
			int heightDiff = 10;
			PointD p1,p2;	
			
			Console.WriteLine("Background");
			
			int height = Allocation.Height;
			int width = Allocation.Width;
			
			context.Save();
			
			
			// Paint lines
			
			context.Color = new Color(0, 0, 0, 0.1);
			context.LineWidth = 1;
			context.Antialias = Antialias.None;

			// Horizontal lines

			int i = 0;
			
			while (i < width)
			{
				p1 = new PointD (i, 0);
    				p2 = new PointD (i, height);
    			
				context.MoveTo(p1);
		    		context.LineTo(p2);
			    context.ClosePath();
        		    context.Stroke();  
        		
				
				i += widthDiff;
			}
			
			// Vertical lines
			
			i = 0;
			
			while (i < height)
			{
				p1 = new PointD (0, i);
    				p2 = new PointD (width, i);
    			
				context.MoveTo(p1);
		    		context.LineTo(p2);
			    context.ClosePath();
        		    context.Stroke();  
        		
				
				i += heightDiff;
			}			
			
			context.Restore();
		}

		protected override bool OnExposeEvent(Gdk.EventExpose evnt)
		{
			base.OnExposeEvent(evnt);
			
			Console.WriteLine("OnExposeEvent");
			
			if (paintBackground == true) 
			{
				PaintBackground();
			}
			
			return true;
		}