Visual C# 2005 - ÈçºÎÖÆ×÷¶à±ä»¯×ÖÌåÖ®ÒõÓ°×Ö
2006-11-17 11:43:26
°æÈ¨ÉùÃ÷£ºÔ´´×÷Æ·£¬ÈçÐè×ªÔØ£¬ÇëÓë×÷ÕßÁªÏµ¡£·ñÔò½«×·¾¿·¨ÂÉÔðÈΡ£ |
Net Framework Ö® System.Drawing ÃüÃû¿Õ¼äÖÐµÄ Graphics Óë BrushÀà±ð¿ÉÒÔÈÃÎÒÃÇÇáÒ×¶ÔÎÄ×Ö×ö³ö»æÍ¼±ä»¯¡£ÔÚ´Ë£¬ÎÒÃǽ«Ê¾·¶ÈçºÎÔËÓñÊË¢À´²úÉú´øÓÐÒõӰЧ¹ûµÄÎÄ×Ö¡£
³ÌÐò·¶Àý
![]() ͼ±í1
![]() ͼ±í2
ÎÒÃÇËù׫дµÄ³ÌÐò·¶Àýʾ·¶ÈçºÎÀûÓà Graphics Àà±ðµÄ DrawString ·½·¨£¬À´¸ù¾ÝÓû§ËùѡȡµÄÉ趨»æÖƳö´øÓÐÒõӰЧ¹ûµÄÎÄ×Ö¡£³ÌÐòÖ´Ðнá¹ûÈçͼ±í 1 Óë 2 Ëùʾ£¬Ïà¹Ø³ÌÐò´úÂëÁÐʾÈçÏ£º
SizeF textSize; Graphics g; Brush myShadowBrush = Brushes.Gray; Brush myForeBrush = Brushes.Blue; 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, myShadowBrush, xLocation + (float)this.nudShadowDepth.Value, yLocation + (float)this.nudShadowDepth.Value); g.DrawString(txtShortText.Text, myFont, myForeBrush, xLocation, yLocation); ±¾Îijö×Ô ¡°ÕÂÁ¢Ãñ¡± ²©¿Í£¬×ªÔØÇëÓë×÷ÕßÁªÏµ£¡ ±¾Îijö×Ô 51CTO.COM¼¼Êõ²©¿Í |





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