1
我有一個tablelayout與10x10(列x行),我可以下降對象到這些單元格。
我想添加一個圖像(作爲背景)到該桌面佈局,可以是可滾動並覆蓋所有表格單元格,用戶可以上傳任何圖像大小。winform中tablelayout的可滾動backgroundimage
拖放正在工作,我的問題是:我無法滾動tablebackgound圖像eventho我設置AutoScroll
爲true。 任何想法如何解決這個問題
更新: 現在我可以滾動,但圖像顯示在錯誤的方式
private void addImage()
{
Image img = Image.FromFile(@"C:\Users\c1\Desktop\img_Clean.png");
if (tableLayoutDropZone.BackgroundImage != null) tableLayoutDropZone.BackgroundImage.Dispose();
tableLayoutDropZone.BackgroundImage = img;
tableLayoutDropZone.AutoScrollPosition = Point.Empty;
tableLayoutDropZone.AutoScrollMinSize = new Size(img.Width, img.Height);
}
感謝您的答覆,但是當我滾動圖像內容雜亂請看看[鏈接](HTTP: //imgur.com/3vfDDu3)事件我超越了OnPaint方法,如你所說 –
嗯,不在這裏。請更新問題以顯示完整的畫圖代碼! (順便說一句,我沒有看到圖像中的錯誤) – TaW
請看看這個:[鏈接](http://imgur.com/a/T7Sj5) –