Graphics DrawString 怎么在窗体写一个字,和画一个图片
Winform窗体 Graphics g = Graphics.FromImage(this.BackgroundImage);
g.DrawString("ddds", new Font("宋体", 9), new SolidBrush(Color.Green), new Point(159, 250));
我这样不有效果
Winform窗体 Graphics g = Graphics.FromImage(this.BackgroundImage);
g.DrawString("ddds", new Font("宋体", 9), new SolidBrush(Color.Green), new Point(159, 250));
我这样不有效果
解决方案 »
- his.Invoke调用webservice System.InvalidOperationException: 客户端发现响应内容类型为空
- C#winform 父子窗体问题
- VS2008中如何给做好的C#项目打包成exe文件?
- 问题 什么时候使用缓存
- 数据库连接问题,急等
- 怎么实现界面的换肤
- 我刚才申请了一个花生护照,同时有了一个免费域名(****.vicp.net),请问我可以让这个域名指到我的局域网的WEB服务器的IP(192.168.1.99)吗?
- 怎样用C#做拼图游戏,
- C#调用VC控件传出的屏幕DC,绘图时出现闪屏问题
- 利用wmi得到xp2系统的软硬件信息.
- c#语言有没有什么版本之分??
- C#做windows Form的调查问卷,如何实现一页中有多个题目?
private void panel2_Paint(object sender, PaintEventArgs e)
{
ControlPaint.DrawBorder(e.Graphics,
panel2.ClientRectangle,
Color.Red,1,ButtonBorderStyle.Solid,
Color.Red,1,ButtonBorderStyle.Solid,
Color.Red,1,ButtonBorderStyle.Solid,
Color.Red,1,ButtonBorderStyle.Solid);
}
给panal画个边框
{
using (Graphics g = this.CreateGraphics())
{
g.DrawString("test", this.Font, Brushes.Black, 0, 0);
g.DrawImage(MyImage, 0, 0);
}
}
Image MyImage = new Bitmap();
或
Image MyImage = Image.FromFile(imagefile);
获得
Font a = new Font(this.SelectedFontFamily, 150, fs);
Bitmap bmp = new Bitmap(300,300);
Brush b=Brushes.Black;
using(Graphics g = Graphics.FromImage(bmp))
{
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
g.DrawString("A", a, b, new PointF(10, 10));
bmp.Save("D:\\a.png");
}
http://topic.csdn.net/u/20100606/11/4dc5642c-3506-43c7-af17-7c38bbdb7dfc.html
{
g.DrawString("test", this.Font, Brushes.Black, 0, 0);
g.DrawImage(MyImage, 0, 0);
}可以在按钮这样显示图片和文字,那在窗体Load的时候怎么显示呢
Label1.Text="testtest"
文章最后有整个工程的 下载地址给分吧
吧你的具体的绘图代码写在窗体的Paint事件里,然后在按钮的单击事件里写上这样一句:
this.Invalidate(true);