Pen mpen(Color(255,255,0,0), 2);
    mpen.SetDashStyle(DashStyleDash);这是我设置的点线画笔,在设置线宽的时候发现了一个问题:
    当线宽为2的时候,所画的线是由20多个短线组成的,
    可是随着线宽的增加短线的数目会越来越少,
    宽为50的时候只剩下三个短线了,
    宽为100时就没有短线了,变成了一条直线;   请问高手这个问题如何解决?
   如何才能在增加线宽的同时不使短线的数目减少呢?

解决方案 »

  1.   

    The length of the dashes in a dashed line is dependent on the dash style and the width of the Pen object. The length of the space that separates two dashes in a dashed line is equal to the width of the Pen object. 
      

  2.   

    REAL dashVals[4] = {
    5.0f,   // dash length 5
            20.0f,   // space length 2
    15.0f,  // dash length 15
    4.0f};  // space length 4 Pen pen(Color(255, 0, 0, 0),50);
    mpen.SetDashPattern(dashVals, 4);我这样试的,dash线的长度还是会随着线宽的增加而增加,
    当画笔宽达到一定的程度时,就又变成直线了
      

  3.   

    那估计就不行了,msdn说了,线和点的长度取决于画笔的宽度,线和点之间的空隙等于画笔的宽度.所以你的画笔线宽越大,这个空隙越大,自然就发生你这种状况.
      

  4.   

    GDI+中 这样的宽度是无法改的;