Visual C# 2005 - ÈçºÎÖÆ×÷¶à±ä»¯×ÖÌåÖ®¸¡µñ×Ö
2006-11-22 09:54:18
°æÈ¨ÉùÃ÷£ºÔ´´×÷Æ·£¬ÈçÐè×ªÔØ£¬ÇëÓë×÷ÕßÁªÏµ¡£·ñÔò½«×·¾¿·¨ÂÉÔðÈΡ£ |
±¾ÎĽ«Ê¾·¶ÈçºÎÀûÓà System.Drawing ÃüÃû¿Õ¼äÖÐµÄ Graphics Óë Brush Àà±ðÀ´ÖÆ×÷³ö´øÓи¡µñЧ¹ûµÄÎÄ×Ö¡£
³ÌÐò·¶Àý
![]() ͼ±í1
![]() ͼ±í2
ͼ±í 1 Óë 2 ÊÇÎÒÃÇËù׫д֮³ÌÐò·¶ÀýµÄÖ´Ðнá¹û¡£ÎÒÃÇÖ÷ҪʹÓà Graphics Àà±ðµÄ DrawString ·½·¨£¬²¢¸ù¾ÝÓû§ËùѡȡµÄ¿Ì¶ÈÈ¥µ÷Õû»æÍ¼×ֺţ¬ÒÔ±ãÖÆ×÷³ö´øÓи¡µñЧ¹ûµÄÎÄ×Ö¡£³ÌÐò´úÂëÁÐʾÈçÏ£º
SizeF textSize; Graphics g; Brush myBackBrush = Brushes.Blue; Brush myForeBrush = Brushes.White; Font myFont = new Font("Times New Roman", (float)this.nudFontSize.Value, FontStyle.Regular); float xLocation, yLocation; g = picDemoArea.CreateGraphics(); g.Clear(Color.White); textSize = g.MeasureString(this.txtShortText.Text, myFont); xLocation = (picDemoArea.Width - textSize.Width) / 2; yLocation = (picDemoArea.Height - textSize.Height) / 2; g.DrawString(txtShortText.Text, myFont, myBackBrush, xLocation + (float)this.nudEmbossDepth.Value, yLocation + (float)this.nudEmbossDepth.Value); g.DrawString(txtShortText.Text, myFont, myForeBrush, xLocation, yLocation); ±¾Îijö×Ô ¡°ÕÂÁ¢Ãñ¡± ²©¿Í£¬×ªÔØÇëÓë×÷ÕßÁªÏµ£¡ ±¾Îijö×Ô 51CTO.COM¼¼Êõ²©¿Í |





ÕÂÁ¢Ãñ
²©¿Íͳ¼ÆÐÅÏ¢
ÈÈÃÅÎÄÕÂ
×îÐÂÆÀÂÛ
ÓÑÇéÁ´½Ó