//設置旋轉中心點
pb_graphics.translatetransform(panelruley.width / 2, panelruley.height / 2);
//設置旋轉角度
pb_graphics.rotatetransform(90);
//平移
pb_graphics.translatetransform(i - 19 - panelruley.height / 2 + 22 - (20-panelwork.top), -3);
//畫文字
pb_graphics.drawstring(((int)(i - 19)).tostring(), font, new solidbrush(color.black), 0, 0);
//恢復為默認場景
pb_graphics.resettransform();
本來事情有可能就這樣結束了,不過,今天在書店里溜達,隨手看到了更為直接的實現豎排文字的方法,于是趕緊買下書,回家按其方法實現了豎排文字,最新代碼如下(僅一句代碼):
pb_graphics.drawstring(((int)(i - 19)).tostring(), font, new solidbrush(color.black), -2, i -(20 - panelwork.top)+2, new stringformat(stringformatflags.directionvertical));
注意:精簡框架集不支持,我就是在精簡框架集下試這個代碼,所以沒有查到該方法!
新聞熱點
疑難解答