Link to home
Start Free TrialLog in
Avatar of ed_dalian
ed_dalian

asked on

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?
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

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
Avatar of ed_dalian
ed_dalian

ASKER

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.
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
I don't need a checkBox, I need a buttom been pushed
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
Hi Bob:
    I want to make a pen button to draw on a picture, I want a button to like windows paint do.
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks