?
Solved

C#, PocketPC, step #2

Posted on 2003-11-03
4
Medium Priority
?
281 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 750 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

Independent Software Vendors: 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

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

777 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