画的图最小化后怎么就没有了? 拜托了我是小鸟,分都问完了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 是不是刷新一下就没了? 我对GUI也不太懂, 下面的是以前的一个作业, 画直线, 希望能对楼主有说帮助using System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;using System.Data;namespace 画直线_Demo_02101434_陈剑{ /// <summary> /// Form1 的摘要说明。 /// </summary> public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.PictureBox picDrawLine; private Pen myPen; private bool drawState; private Graphics gTemp; private Graphics g; private int x, y; private int xD, yD; /// <summary> /// 必需的设计器变量。 /// </summary> private System.ComponentModel.Container components = null; public Form1() { // // Windows 窗体设计器支持所必需的 // InitializeComponent(); // // TODO: 在 InitializeComponent 调用后添加任何构造函数代码 // } /// <summary> /// 清理所有正在使用的资源。 /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows 窗体设计器生成的代码 /// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1)); this.picDrawLine = new System.Windows.Forms.PictureBox(); this.SuspendLayout(); // // picDrawLine // this.picDrawLine.BackColor = System.Drawing.Color.White; this.picDrawLine.Image = ((System.Drawing.Image)(resources.GetObject("picDrawLine.Image"))); this.picDrawLine.Location = new System.Drawing.Point(5, 5); this.picDrawLine.Name = "picDrawLine"; this.picDrawLine.Size = new System.Drawing.Size(370, 305); this.picDrawLine.TabIndex = 0; this.picDrawLine.TabStop = false; this.picDrawLine.MouseUp += new System.Windows.Forms.MouseEventHandler(this.picDrawLine_MouseUp); this.picDrawLine.MouseMove += new System.Windows.Forms.MouseEventHandler(this.picDrawLine_MouseMove); this.picDrawLine.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picDrawLine_MouseDown); // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.ClientSize = new System.Drawing.Size(377, 315); this.Controls.Add(this.picDrawLine); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Name = "Form1"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "画直线_Demo_02101434_陈剑"; this.Load += new System.EventHandler(this.Form1_Load); this.ResumeLayout(false); } #endregion /// <summary> /// 应用程序的主入口点。 /// </summary> [STAThread] static void Main() { Application.Run(new Form1()); } private void Form1_Load(object sender, System.EventArgs e) { gTemp = this.picDrawLine.CreateGraphics(); myPen = new Pen(Brushes.Blue, 2); g = System.Drawing.Graphics.FromImage(this.picDrawLine.Image); } private void picDrawLine_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { drawState = true; xD = x = e.X; yD = y = e.Y; } private void picDrawLine_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { if (drawState == true) { gTemp.DrawLine(new Pen(Brushes.White, 2), x, y, xD, yD); gTemp.DrawLine(myPen, x, y, e.X, e.Y); this.Refresh(); xD = e.X; yD = e.Y; //this.picDrawLine.Image.Save("paint.bmp");// this.picDrawLine.BackgroundImage.Save("paint.bmp"); } } private void picDrawLine_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { if (drawState == true) { drawState = false; g.DrawLine(myPen, x, y, e.X, e.Y); //gTemp.Clear(Color.White); this.Refresh(); } } }} 你应该在paint事件中绘制,这样最小化后再还原时,会重新绘制 重写OnPaint 把绘制操作写在当中 sql2008怎样从r1升级到r2 数据库问题 求DATAGRIDVIEW列标题宽度解决方法 如何在WinForm里面制作一个可以淡入淡出的提示框?就类似于QQ邮箱来邮件时的提示那种 dataset和泛型 C# 图片层叠顺序 如何在派生类中彻底隐藏基类中的方法,使得派生类的使用者及它的派生类中都看不到基类的方法 用C# HttpWebRequest时,本地IP可以伪造吗? (除了用代理IP方法外) 你信吗? 新人,大家帮看看这程序哪有问题啊,该怎么解决? 我想大师兄们关于listview的打印问题! 20分求解:listview控件中的问题
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;namespace 画直线_Demo_02101434_陈剑
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.PictureBox picDrawLine;
private Pen myPen;
private bool drawState;
private Graphics gTemp;
private Graphics g;
private int x, y;
private int xD, yD; /// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null; public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent(); //
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
} /// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
} #region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.picDrawLine = new System.Windows.Forms.PictureBox();
this.SuspendLayout();
//
// picDrawLine
//
this.picDrawLine.BackColor = System.Drawing.Color.White;
this.picDrawLine.Image = ((System.Drawing.Image)(resources.GetObject("picDrawLine.Image")));
this.picDrawLine.Location = new System.Drawing.Point(5, 5);
this.picDrawLine.Name = "picDrawLine";
this.picDrawLine.Size = new System.Drawing.Size(370, 305);
this.picDrawLine.TabIndex = 0;
this.picDrawLine.TabStop = false;
this.picDrawLine.MouseUp += new System.Windows.Forms.MouseEventHandler(this.picDrawLine_MouseUp);
this.picDrawLine.MouseMove += new System.Windows.Forms.MouseEventHandler(this.picDrawLine_MouseMove);
this.picDrawLine.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picDrawLine_MouseDown);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(377, 315);
this.Controls.Add(this.picDrawLine);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "画直线_Demo_02101434_陈剑";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false); }
#endregion /// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
} private void Form1_Load(object sender, System.EventArgs e)
{
gTemp = this.picDrawLine.CreateGraphics();
myPen = new Pen(Brushes.Blue, 2);
g = System.Drawing.Graphics.FromImage(this.picDrawLine.Image);
} private void picDrawLine_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
drawState = true;
xD = x = e.X;
yD = y = e.Y;
} private void picDrawLine_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (drawState == true)
{
gTemp.DrawLine(new Pen(Brushes.White, 2), x, y, xD, yD);
gTemp.DrawLine(myPen, x, y, e.X, e.Y);
this.Refresh();
xD = e.X;
yD = e.Y;
//this.picDrawLine.Image.Save("paint.bmp");
// this.picDrawLine.BackgroundImage.Save("paint.bmp");
}
} private void picDrawLine_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (drawState == true)
{
drawState = false;
g.DrawLine(myPen, x, y, e.X, e.Y);
//gTemp.Clear(Color.White);
this.Refresh();
}
}
}
}