从usercontrol继承的
楼上的说得没错,就是这个意思。
我现在遇到的主要问题是在拖动时如何绘制窗体轮廓,具体是不知道如何获取全屏绘画(而不是仅仅在窗体客户区)的graphics对象,以及绘制方法:第一次绘画显示线条,第二次在原位同样绘制就是擦除刚绘制的图象,而对背景没有影响,这个我不知道用什么pen或者brush。
楼上的说得没错,就是这个意思。
我现在遇到的主要问题是在拖动时如何绘制窗体轮廓,具体是不知道如何获取全屏绘画(而不是仅仅在窗体客户区)的graphics对象,以及绘制方法:第一次绘画显示线条,第二次在原位同样绘制就是擦除刚绘制的图象,而对背景没有影响,这个我不知道用什么pen或者brush。
解决方案 »
- 怎样判断一个输入的字符串是不是空格?
- C#调用ActiveX控件的参数传递问题byte[]与ref byte
- 关于DataGridView列的一个问题
- 判断输入格式
- Windows Media Player播放流媒体如何进行下载?
- 如何让dropdownlist互相梆定值得
- datagridview1改變后的值
- 如何反编译.net的dll?
- C# winform 递归数据库表 生成树节点
- J#.NET? 微软是在搞什么东东
- 请教水晶报表?
- -------------------->>关于C#,如何自动取ListBox中的所有值,高手请进------------------------------------------
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;namespace WindowsApplication1
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null; [System.Runtime.InteropServices.DllImport("user32.dll")]
public static extern bool ReleaseCapture();
[System.Runtime.InteropServices.DllImport("user32.dll")]
public static extern bool SendMessage(IntPtr hwnd,int wMsg,int wParam,int lParam);
public const int WM_SYSCOMMAND=0x0112;
public const int SC_MOVE=0xF010;
private System.Windows.Forms.Label label1;
public const int HTCAPTION=0x0002;
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()
{
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
//
this.label1.BackColor = System.Drawing.SystemColors.Desktop;
this.label1.Location = new System.Drawing.Point(48, 72);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(152, 23);
this.label1.TabIndex = 0;
this.label1.Text = "label1";
this.label1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.label1_MouseDown);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(292, 273);
this.Controls.Add(this.label1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false); }
#endregion /// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
} private void label1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
ReleaseCapture();
SendMessage(this.Handle,WM_SYSCOMMAND,SC_MOVE+HTCAPTION, 0);
}
}
}