日期:2014-05-18  浏览次数:20782 次

请教关于GDI+画选择框时出现的一个问题

如图,在鼠标选择窗体上的控件时,选择框在正常情况下应该处于按钮的上层,但我不知道应该怎样做,请各位帮我修改一下!

下面是代码:

Form4.Designer.cs
---------------------
namespace MapDemo
{
  partial class Form4
  {
  /// <summary>
  /// Required designer variable.
  /// </summary>
  private System.ComponentModel.IContainer components = null;

  /// <summary>
  /// Clean up any resources being used.
  /// </summary>
  /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
  protected override void Dispose(bool disposing)
  {
  if (disposing && (components != null))
  {
  components.Dispose();
  }
  base.Dispose(disposing);
  }

  #region Windows Form Designer generated code

  /// <summary>
  /// Required method for Designer support - do not modify
  /// the contents of this method with the code editor.
  /// </summary>
  private void InitializeComponent()
  {
  this.panel1 = new System.Windows.Forms.Panel();
  this.pictureBox1 = new System.Windows.Forms.PictureBox();
  this.button1 = new System.Windows.Forms.Button();
  this.button2 = new System.Windows.Forms.Button();
  this.panel1.SuspendLayout();
  ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
  this.SuspendLayout();
  // 
  // panel1
  // 
  this.panel1.AutoScroll = true;
  this.panel1.Controls.Add(this.button2);
  this.panel1.Controls.Add(this.button1);
  this.panel1.Controls.Add(this.pictureBox1);
  this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
  this.panel1.Location = new System.Drawing.Point(0, 0);
  this.panel1.Name = "panel1";
  this.panel1.Size = new System.Drawing.Size(295, 173);
  this.panel1.TabIndex = 3;
  // 
  // pictureBox1
  // 
  this.pictureBox1.Image = global::MapDemo.Properties.Resources.四号线地图;
  this.pictureBox1.Location = new System.Drawing.Point(0, 0);
  this.pictureBox1.Name = "pictureBox1";
  this.pictureBox1.Size = new System.Drawing.Size(575, 767);
  this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
  this.pictureBox1.TabIndex = 3;
  this.pictureBox1.TabStop = false;
  this.pictureBox1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseMove);
  this.pictureBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseDown);
  this.pictureBox1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseUp);
  // 
  // button1
  // 
  this.button1.Location = new System.Drawing.Point(53, 52);
  this.button1.Name = "button1";