to Kinglht:
首先谢谢你的回答。
我觉得问题不在于图片的尺寸。对于同一幅图片,只要x坐标>0,则在不同的位置平铺其效果不同。如
g.FillRectangle(brush, new Rectangle(0,
100,top_right.Width,top_right.Height));
平铺正常。而
g.FillRectangle(brush, new Rectangle(10, 100,top_right.Width,top_right.Height));

g.FillRectangle(brush, new Rectangle(20, 100,top_right.Width,top_right.Height));

g.FillRectangle(brush, new Rectangle(30, 100,top_right.Width,top_right.Height));
......
则平铺效果不正常。平铺位置的x坐标离x=0越远,则平铺偏差越大。
我不明白其中的机理。

解决方案 »

  1.   

    确实怪!
    绘制区域的长、宽绝对正确
    绘制区域的x、y坐标应该说没什么限制(只要不出去Form区域就行)
    那为什么在两个区域:new Rectangle(0,0,image.width,image.height)和new Rectangle(100,100,image.width,image.height)上填充该image却得到不同的效果。
    头疼!!!!!!!
      

  2.   

    Try to set RenderingOrigin property before drawing each picture.Hope it could be help.
      

  3.   

    也不行,
    g.RendringOrigin.X不可设置。
      

  4.   

    Try code like this:
    Graphics.RenderingOrigin = new Point(100,100);
      

  5.   

    g.RenderingOrigin = new Point(X,Y);
    X,Y change by rectange location of the picture.
      

  6.   

    Ok, then try follow code:
    for(int x=0;x<=300;x+=100) 
    {
    System.Drawing.Drawing2D.Matrix m = brush.Transform;
    m.Translate(x,0);
    brush.Transform = m;
    g.FillRectangle(brush, new Rectangle(x, 100,top_right.Width,top_right.Height)); 
    }
      

  7.   

    custDlg.cs(101): 
    “System.Drawing.Brush”并不包含对“Transform”的定义
      

  8.   

    TextureBrush.Transform 
    Transform 是TextureBrush的属性
      

  9.   

    成功了吧
    Translate里的两个参数
    分别等于你rectangle起始点的坐标
      

  10.   

    成功了吧
    Translate里的两个参数
    分别等于你rectangle起始点的坐标