2011-04-24 53 views
4

我有一個MSChart註釋,圖表區域很大,因此使用舊學校800x600的人可以看到圖表。MSChart註釋尺寸

問題是,當我在此低分辨率下查看我的圖表時,其中的註釋隨圖表縮小並開始切斷最後幾個字母。

例如,正常情況下帶有「Hello world」的註釋會變成800x600下的「Hello W」。

任何人都知道我可以如何設置annotaiton屬性,以便它們不縮水?

回答

1

我有同樣的問題,我一直沒能找到一種方法來使註釋的固定大小。我確實注意到註釋尺寸被設置爲圖表的百分比(即其調整大小的原因是Width = 25實際上意味着圖表寬度的25%),所以我寫了一些小技巧來在圖表大小調整時調整註釋的大小:

var annotation = new RectangleAnnotation() { ... } 

chart.Annotations.Add(annotation); 

chart.Resize += (sndr, ev) => { 
    // Shoot for 60 pixels tall and 130 wide 
    // Annotation dimensions are set as a percentage of the chart area 
    annotation.Width = (130d/chart.Width) * 100; 
    annotation.Height = (60d/chart.Height) * 100; 
}; 

這是一種醜陋的,但它適用於我。