タイトル : Re^4: DrawStringについて 投稿日 : 2007/07/22(Sun) 23:57 投稿者 : Edward
イラストレーター等の文字装飾機能の簡易版を 自前で作りたいと言う要望が有ります。 >下記の程度の事なら比較的簡単にできますが > http://hanatyan.sakura.ne.jp/dotnet/font03.htm はい、参考にさせていただいております。 花ちゃんのサンプルに斜体機能と基準点設定(左中右/上中下)機能と 太字機能とミリ単位での文字列の大きさ設定機能が追加出来れば、 事足りる要望なのですが。 MSDNのサンプルに以下のようなものを見つけました 任意の角度の斜体を作れるのですが、傾斜の基点が 左上になります、普通は左下ですよね Dim textSize As SizeF Dim g As Graphics Dim myForeBrush As Brush = Brushes.Black Dim myFont As New Font("Times New Roman", Me.nudFontSize.Value, FontStyle.Regular) Dim myTransform As Matrix ' Used for shearing text Dim xLocation, yLocation As Single ' Used for the location g = picDemoArea.CreateGraphics() g.Clear(Color.White) textSize = g.MeasureString(Me.txtShortText.Text, myFont) xLocation = (picDemoArea.Width - textSize.Width) / 2 yLocation = (picDemoArea.Height - textSize.Height) / 2 g.TranslateTransform(xLocation, yLocation) myTransform = g.Transform myTransform.Shear(nudSkew.Value, 0) g.Transform = myTransform g.DrawString(txtShortText.Text, myFont, myForeBrush, 0, 0) どうすれば左下を基点にした斜体に出来るか悩んでおります 何方か御指導下さいますようよろしくお願いいたします。 (太字は出来なくても良いかなと思っています) |