Quantcast
Channel: OKWAVE 最新質問(Visual Basic/257)【本日】
Viewing all articles
Browse latest Browse all 7264

VB PictureBoxの描画範囲

$
0
0
VisualStudio2010のVBにて、ピクチャーボックスの範囲をプログラム中で大きくして描画をさせたいのですが、ピクチャーボックスのサイズを大きくしても、大きくした範囲には描画がされません。 やり方は↓の方法です。 まず、formにボタンとピクチャーボックスを300×200で配置して、 http://homepage1.nifty.com/rucio/main/dotnet/Samples/dnSampleKeepImage.htm ↑のページで書かれてた方法でグラフィックを再描画させています。 Public Class Form1 Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim g As Graphics = AutoGraphics(PictureBox1) PictureBox1.Width = 400 g.FillRectangle(Brushes.Black, 100, 100, 10, 10) '1つ目の図形 g.FillRectangle(Brushes.Black, 350, 100, 10, 10) '2つ目の図形 g.Dispose() End Sub Public Function AutoGraphics(ByVal picSource As PictureBox) As Graphics If picSource.Image Is Nothing Then picSource.Image = New Bitmap(PictureBox1.Width, PictureBox1.Height) End If Return Graphics.FromImage(picSource.Image) End Function End Class これを実行すると、1つ目の図形は描画されていますが、拡大した範囲にある2つ目の図形は描画されていません。 ピクチャーボックスの範囲を大きくした所にも描画をさせたいと思っています。 よろしくお願いします。

Viewing all articles
Browse latest Browse all 7264

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>