• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 174
  • Last Modified:

Two questions about control

In windows application:
1. how to set a button, when I click it, it drops down and don't pop up, when I click it again it pops op?
2. how to set a mouse cursor to be a picture or a icon that I want, when it move over a control?
0
ed_dalian
Asked:
ed_dalian
  • 4
  • 4
1 Solution
 
Bob LearnedCommented:
1) If you want a checked button, then use a CheckBox instead of a button.  It will stay down until checked again.

2) Set button cursor to an image:

   this.button1.Cursor  = new Cursor(@"c:\windows\cursors\pen_i.cur");

Bob
0
 
ed_dalianAuthor Commented:
for 1) I want to check the button like the pan in the paint soft , click the pen I could paint on a picture, click again it wont.
0
 
Bob LearnedCommented:
These are the settings that you need for a CheckBox button:

  this.checkBox1.Appearance = System.Windows.Forms.Appearance.Button;
  this.checkBox1.Checked = true;
  this.checkBox1.CheckState = System.Windows.Forms.CheckState.Checked;
  this.checkBox1.Image = ((System.Drawing.Image)(resources.GetObject("checkBox1.Image")));
  this.checkBox1.Location = new System.Drawing.Point(172, 48);
  this.checkBox1.Name = "checkBox1";
  this.checkBox1.Size = new System.Drawing.Size(64, 32);
  this.checkBox1.TabIndex = 0;

Bob
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
ed_dalianAuthor Commented:
I don't need a checkBox, I need a buttom been pushed
0
 
Bob LearnedCommented:
Ed,

With these settings, you will get a control that looks just like a button, but it will stay pushed as long as Checked = true.  When you don't want it to be pushed any more set Checked = false.

Bob
0
 
ed_dalianAuthor Commented:
Hi Bob:
    I want to make a pen button to draw on a picture, I want a button to like windows paint do.
0
 
Bob LearnedCommented:
Right, so change the CheckBox.Appearance to Button and set the Image to a pen, et voila you have a button like Paint.

Bob
0
 
ed_dalianAuthor Commented:
Thanks
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now