查看“我的作品:文华”的源代码
←
我的作品:文华
跳转至:
导航
、
搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{{用户文华}} <br> <center><font size="6" color=blue;">'''我的作品'''</font></center> <font size="5" color="#545454> ---- Graphics gdi(this->GetDC()->m_hDC); //构造一个GDI+对象 Pen red(Color(255,255,0,0),3); //构造一个画笔 画笔透明度是255 gdi.DrawLine(&red,10,10,50,10); //画线 FontFamily m_font(L"宋体"); Font font(&m_font,24); //构造字体 SolidBrush brush(Color(255,0,0,255)); //输出字符串要构造一个画刷 CRect rect; this->GetClientRect(&rect); //得到客户区大小 PointF point(rect.right/2,rect.bottom/2);//坐标点 gdi.DrawString(L"中华",2,&font,point,&brush);//输出字符串 ———————————————— 版权声明:本文为CSDN博主「a550853006a」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/a550853006a/article/details/45769215 ---- public partial class Form1 : Form { Timer timer = new Timer(); string[] lines = { "hellow world", "nihao", "line3", "line4", "line5", "end" }; int currentLine = 0; ---- public Form1() { InitializeComponent(); timer.Interval = 300; timer.Tick += delegate { currentLine++; this.Invalidate(); }; timer.Start(); } protected override void OnPaint(PaintEventArgs e) { for (int i = 0; i < currentLine % lines.Length; i++) { e.Graphics.DrawString(lines[i], this.Font, Brushes.Black, 10, 20 * i); } } } ---- string[] lines;//所有文字,每行都有回车 int nextLine; //下一行 private void button2_Click(object sender, EventArgs e) { richTextBox1.Text =Resources.String1; lines=richTextBox1.Lines; richTextBox1.Text = ""; timer1.Interval = 1000; timer1.Tick += new EventHandler(timer1_Tick); timer1.Start(); } void timer1_Tick(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(richTextBox1.Text); if (richTextBox1.Text != "") { sb.Append("\r\n"); } sb.Append(lines[nextLine]); //添加下一行文字 richTextBox1.Text = sb.ToString(); richTextBox1.Select(); richTextBox1.SelectionStart = richTextBox1.Text.Length; nextLine++; if (nextLine >= lines.Length) { timer1.Enabled = false; } } ---- private void button1_Click(object sender, EventArgs e)//画图响应按钮(类似完成MFC中BitBlt或StrechBlt的功能) { Bitmap bitmap = new Bitmap(@"D:/工作照.jpg"); Graphics g = CreateGraphics(); //获得窗口屏幕大小 Rectangle rect = System.Windows.Forms.SystemInformation.VirtualScreen; int width = rect.Width; int height = rect.Height; g.DrawImage(bitmap, rect); button1.Visible = true; } private void button2_Click(object sender, EventArgs e)//动态输出文字(类似MFC中的TextOut()) { Font myFont = new Font("Verdana", 12); Graphics g = CreateGraphics(); //创建线渐变画刷: LinearGradientBrush myBrush = new LinearGradientBrush(ClientRectangle, Color.FromArgb(120, 120, 250), Color.Red, LinearGradientMode.Vertical); // g.DrawString("GDI 显示字符串", myFont, myBrush, new RectangleF(10, 10, 500, 200)); //创建一般画刷: SolidBrush bru1 = new SolidBrush(Color.FromArgb(250, 200, 0)); g.DrawString("GDI 显示字符串", myFont, bru1, new RectangleF(10, 10, 500, 200)); Pen newpen = new Pen(bru1); Point[] p = new Point[] { new Point(0, 0), new Point(100, 100), new Point(50, 100), new Point(200, 100) }; g.DrawEllipse(newpen,50,50, 100, 100); } ———————————————— 版权声明:本文为CSDN博主「还可以吧有点纯纯的」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/kahncc/article/details/86623525 ---- private void Form1_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; g.Clear(Color.White); g.SmoothingMode = SmoothingMode.AntiAlias; //定义输出字体 Font myFont = new Font("Arial", 15, FontStyle.Regular, GraphicsUnit.Pixel); //定义文本输出格式 StringFormat strFmt = new StringFormat(); strFmt.Alignment = StringAlignment.Near; strFmt.LineAlignment = StringAlignment.Near; string tempStr = string.Empty; //获取系统所有已安装的字体系列 InstalledFontCollection installedCollection = new InstalledFontCollection(); FontFamily[] fontFamilyArray = installedCollection.Families; int index = 0; //访问 fontFamilyArray 数组中的每一个成员 foreach (FontFamily i in fontFamilyArray) { //获取当前字体系统的名称 tempStr += i.Name + ","; index++; } //绘制所有字体 Rectangle textOutRect = new Rectangle(0, 15, Width, Height); g.DrawString(tempStr, myFont, Brushes.Black, textOutRect, strFmt); tempStr = string.Format("系统中已经安装的字体有{0}种,其名称分别为:\n", index + 1); g.DrawString(tempStr,myFont,Brushes.Red,new PointF(0,0)); } ———————————————— 版权声明:本文为CSDN博主「keep_silence_」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/keep_silence_/article/details/8130005
该页面使用的模板:
模板:用户文华
(
查看源代码
)
返回至
我的作品:文华
。
导航菜单
个人工具
创建账户
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
导航
首页
社区主页
新闻动态
最近更改
随机页面
帮助
华师附中老三届
站群链接
社友网(sn)
产品百科(cpwiki)
产品与服务(sn)
社区支持农业(sn)
工具
链入页面
相关更改
特殊页面
页面信息