Click here to Skip to main content
15,919,778 members
Home / Discussions / Windows Forms
   

Windows Forms

 
AnswerRe: Role of IIS / Worker process in a desktop or windows application (Distributed remoting architecture) Pin
Dave Kreskowiak22-Feb-10 3:09
mveDave Kreskowiak22-Feb-10 3:09 
GeneralRe: Role of IIS / Worker process in a desktop or windows application (Distributed remoting architecture) Pin
NetQuestions24-Feb-10 17:37
NetQuestions24-Feb-10 17:37 
QuestionAdvanced ComboBox in WinForms Pin
Nick Alexeev12-Feb-10 16:41
professionalNick Alexeev12-Feb-10 16:41 
AnswerRe: Advanced ComboBox in WinForms Pin
Richard MacCutchan12-Feb-10 22:40
mveRichard MacCutchan12-Feb-10 22:40 
AnswerRe: Advanced ComboBox in WinForms Pin
Luc Pattyn13-Feb-10 1:39
sitebuilderLuc Pattyn13-Feb-10 1:39 
AnswerRe: Advanced ComboBox in WinForms Pin
Abhinav S13-Feb-10 7:58
Abhinav S13-Feb-10 7:58 
QuestionProblem with maximized child window in MDI parent Pin
Alan Burkhart11-Feb-10 5:30
Alan Burkhart11-Feb-10 5:30 
QuestionReset Control Attributes Pin
zeos68-Feb-10 7:46
zeos68-Feb-10 7:46 
Hi,

Please forgive me as this may be a very simple question but I am a newbie at this. I have searched for this info for three days now and cannot seem to find any answers. I have two questions:

Q1. How do I reset the background color of a push button.

I have a standard button. In the code snippet below I also have a cursor style change. The cursor changes back to the original (default cursor) when the mouse leaves the button (without me including any cursor specific code in the MouseLeave function) but the back color does not change. I even tried to set up a pointer to store the original color and this works but after the mouse leaves the button the style of the button is chnaged to flat. Do I need to also store the FlatStyle and retrieve it on MoudeLeave?

// declare an int pointer (for the exit button background color) called
btnExit_default_BackColor
int *btnExit_default_BackColor;
// declare a boolean pointer (for the exit button UseVisualStyle background color) called
btnExit_default_UseVisualStyleBackColor
bool *btnExit_default_UseVisualStyleBackColor;

private: System::Void btnExit_MouseEnter(System::Object^ sender, System::EventArgs^ e) {
// allocate memory for an int variable and make the btnExit_default_BackColor pointer
point to this new memmory
btnExit_default_BackColor=new int;
//assign the exit button background color to the memory allocated
*btnExit_default_BackColor=btnExit->UseVisualStyleBackColor;
// allocate memory for a bool variable and make the btnExit_default_UseVisualStyleBackColor
pointer point to this new memmory
btnExit_default_UseVisualStyleBackColor=new bool;
//assign the exit button background color to the memory allocated
*btnExit_default_UseVisualStyleBackColor=btnExit->UseVisualStyleBackColor;
btnExit->Cursor=Cursors::Hand; // change mouse cursor to hand when over a push button
// Change button outline color to 0x00FF4500 (orange red with opacity 0)
System::String^ highlightColor="#0x00FF4500";
btnExit->BackColor=System::Drawing::ColorTranslator::FromHtml(highlightColor);
}

private: System::Void btnExit_MouseLeave(System::Object^ sender, System::EventArgs^ e) {
// Change button outline color to original state before mouse hover
btnExit->BackColor=System::Drawing::Color::FromArgb(*btnExit_default_BackColor);
btnExit->UseVisualStyleBackColor=*btnExit_default_UseVisualStyleBackColor;
delete btnExit_default_BackColor; // delete the btnExit_default_BackColor pointer
delete btnExit_default_UseVisualStyleBackColor; // delete the
btnExit_default_UseVisualStyleBackColor pointer
btnExit_default_BackColor=0; // set pointer to null
btnExit_default_UseVisualStyleBackColor=0; // set pointer to null
}
This seems very complicated for what I think is a very simple thing. I just want the color of the button to chnage when the mouse is over it and have the button revert to its original (design) state when the mouse leaves. Can someone please help me with this. Thank you very much in advance for any help you may be able to provide.

Q2. Can someone please explain to me the funcion of the ^ in the parameter list of the functions above; i.e. in

private: System::Void btnExit_MouseLeave(System::Object^ sender, System::EventArgs^ e) {

I cannot find any reference to this operator. The closest I have come is that it may be a top-level reference but I don't know what this means and how it works,

Please forgive if these are too simple questions. Thank you.
Paul
AnswerRe: Reset Control Attributes Pin
Richard Andrew x6416-Feb-10 16:26
professionalRichard Andrew x6416-Feb-10 16:26 
QuestionFormat Input for SharePoint DateTime field Pin
elizas8-Feb-10 1:03
elizas8-Feb-10 1:03 
QuestionCustom Controls Desgin-Time question Pin
Steve517713-Feb-10 9:51
Steve517713-Feb-10 9:51 
AnswerRe: Custom Controls Desgin-Time question Pin
Som Shekhar12-Feb-10 5:44
Som Shekhar12-Feb-10 5:44 
Question"Application Error" on SQLConnection.Open(), following a FolderBrowserDialog.ShowDialog() Pin
Member 33374853-Feb-10 2:17
Member 33374853-Feb-10 2:17 
QuestionRe: "Application Error" on SQLConnection.Open(), following a FolderBrowserDialog.ShowDialog() Pin
Eddy Vluggen3-Feb-10 5:02
professionalEddy Vluggen3-Feb-10 5:02 
GeneralRe: "Application Error" on SQLConnection.Open(), following a FolderBrowserDialog.ShowDialog() Pin
Member 333748524-Feb-10 18:02
Member 333748524-Feb-10 18:02 
GeneralRe: "Application Error" on SQLConnection.Open(), following a FolderBrowserDialog.ShowDialog() Pin
Eddy Vluggen25-Feb-10 10:31
professionalEddy Vluggen25-Feb-10 10:31 
GeneralRe: "Application Error" on SQLConnection.Open(), following a FolderBrowserDialog.ShowDialog() Pin
Member 333748528-Feb-10 18:16
Member 333748528-Feb-10 18:16 
GeneralRe: "Application Error" on SQLConnection.Open(), following a FolderBrowserDialog.ShowDialog() Pin
Eddy Vluggen2-Mar-10 0:57
professionalEddy Vluggen2-Mar-10 0:57 
QuestiontoolStripSplitButton Doesn;t comes in Pressed state. Pin
Member 404145831-Jan-10 22:54
Member 404145831-Jan-10 22:54 
AnswerRe: toolStripSplitButton Doesn;t comes in Pressed state. Pin
Eddy Vluggen1-Feb-10 0:57
professionalEddy Vluggen1-Feb-10 0:57 
GeneralRe: toolStripSplitButton Doesn;t comes in Pressed state. Pin
Member 40414581-Feb-10 17:57
Member 40414581-Feb-10 17:57 
GeneralRe: toolStripSplitButton Doesn;t comes in Pressed state. Pin
Eddy Vluggen2-Feb-10 3:18
professionalEddy Vluggen2-Feb-10 3:18 
Questioncreate IM Pin
rockracker28-Jan-10 14:18
rockracker28-Jan-10 14:18 
AnswerRe: create IM Pin
Garth J Lancaster28-Jan-10 15:17
professionalGarth J Lancaster28-Jan-10 15:17 
AnswerRe: create IM Pin
Luc Pattyn28-Jan-10 15:43
sitebuilderLuc Pattyn28-Jan-10 15:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.