Solved

C#, PocketPC, step #2

Posted on 2003-11-03
4
279 Views
Last Modified: 2010-04-16
I wrote these few C# lines in .NET Compact Framework:

using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Data;

namespace SmartDeviceApplication
{
      public class Form1:Form
      {                        
            Button btnTest = new Button();
            Panel pnlTest;          
            public Form1()
            {
                  this.Text="Just4Fun";
                  // the panel...
                  pnlTest=new Panel();
                  pnlTest.Size=new Size(200,200);
                  // ...and BackColor works fine...
                  pnlTest.BackColor=Color.Yellow;
                  // the button...
                  btnTest=new Button();                  
                  btnTest.Size=new Size(150,100);
                  btnTest.Location=new Point(25,50);
                  // ...and the back color is always gray!
                  btnTest.BackColor=Color.Purple;
                  // papaya???
                  btnTest.ForeColor=Color.PapayaWhip;
                  btnTest.Text="PURPLE RAIN...\ntest";
                  // the event OnClick
                  //btnTest.Click+=new EventHandler(btn_clk);
                  pnlTest.Controls.Add(btnTest);
              this.Controls.Add(pnlTest);
            }                                           
 
            private static void Main()
            {
                  Application.Run(new Form1());
            }                      
 
      }
}

and the panel "BackColor" is working fine but the button "Back & ForeColor" are not working.
What I did wrong?

...maybe my .NET is a Balck&White version??? :-)

Thanks 4 your help...
0
Comment
Question by:ellerre
  • 3
4 Comments
 
LVL 6

Expert Comment

by:purpleblob
ID: 9672664
What version of Compact Framework are you using, I believe CF 1.0's Buttons did not actually implement the BackColor property whereas SP2 supposedly has addressed the lack of the BackColor implementation.
0
 
LVL 6

Expert Comment

by:purpleblob
ID: 9672747
Umm, interestingly I've looked into this a little further as I just realised I haven't got SP2 :-) and Compact Framework SP2 appears to have been recalled "because of some issues" whatever that means.
0
 

Author Comment

by:ellerre
ID: 9674184
I should have the last version of both .NET 2003 and Compact Framework.
I'm saying "should" because, if i try to update it, the answer is: "You have the last version... No upgrade avaiable" (bad translation from italian language, I know).

The best is that a lot of examples from Microsoft are not working because or a "method is not valid" or "this class do not accept only 2 parameters" and so on.

well...  another Plug and... Pray system?






0
 
LVL 6

Accepted Solution

by:
purpleblob earned 250 total points
ID: 9674403
Well, I've tried your example on my VS .NET 2003 and got the same problem you had, when I checked this out further I found this information saying that SP2 fixed this problem, but upon searching for the update found the links broken and then eventually found the comment that said the service pack had been recalled.

So basically, I'm afraid, it would look like you've a version which doesn't have SP2 on, in which case I'm afraid it would appear you cannot change the colour of the button.

However this said, you could ofcourse create your own button either as a UserControl or using something like a PictureBox to replace your Button objectand there you can obviously implement your own BackColor style capabilities.

Sorry I couldn't help further
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to read text with RegEx... 2 35
need to convert function to c# 5 44
Need help with a query 14 39
Web page design problem 3 16
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question