2011-12-05 10 views
1

最初の画像は私が持っているものです - Rectangleの文字列を "強調表示"するためのリストです。 2番目の画像(右)は、私が見たいもののモックアップです。長方形の間で共有される線分を削除する

共有回線セグメントを削除するにはどうすればよいでしょうか?

What I have What I want

答えて

0

[OK]を私は、私はまともな解決策を考え出したと思います。

// create a pen with a width of 2px (half of it will be blanked out so it will 
// essentially be a width of 1px) 
Pen pen = new Pen(Color.Blue, 2f); 

// build a GraphicsPath with the rectangles 
GraphicsPath gp = new GraphicsPath(); 
gp.AddRectangle(...); 
gp.AddRectangle(...); 
gp.AddRectangle(...); 

// g is our Graphics object 
// exclude the region so the path doesn't draw over it 
Region reg = new Region(gp); 
g.ExcludeClip(reg); 

// now draw path, it won't show up inside the excluded clipping region 
g.DrawPath(pen, gp); 

// clean up 
g.ResetClip(); 
pen.Dispose(); 
gp.Dispose(); 
reg.Dispose(); 
関連する問題