掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
テキストボックスの文字列を、そのままピクチャボックスに描画するには? (ID:121838)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
>このcanvasと言う名のピクチャボックスに描かれる文字列の全体の >幅が入力用テキストボックスの文字列の幅と変わってしまいます。 読んだのですが、理解できませんでした。 PictureBoxに描画するときにTextBoxのフォントと 同じ大きさで描画したいということでしょうか? それをしたいならば、 TextBoxのコントロール名はInputBoxにしています。 PictureBoxのコントロール名は貼り付けたときの名前です。 あと、Buttonも追加してください。 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim g As Graphics = Nothing g = PictureBox1.CreateGraphics g.Clear(SystemColors.Control) Dim drawbrush As Brush = New SolidBrush(Color.DarkBlue) g.DrawString(InputBox.Text, InputBox.Font, drawbrush, 0, 0) If Not g Is Nothing Then g.Dispose() g = Nothing End If If Not drawbrush Is Nothing Then drawbrush.Dispose() drawbrush = Nothing End If End Sub
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.