Is my C.F. 2.0 crazy?.....Or not?
-
Hi all, After it seems that I'm finding the way to resolve my previous problem, now I found another problem. Please read this simple line of code: Imports System Imports System.IO Imports System.Drawing.Graphics Imports System.Drawing.Color ---------------------------------------- TextBox1.BackColor = RGB(255, 255, 0) It generate the following error: Error 1 Value of type 'Integer' cannot be converted to 'System.Drawing.Color'. E:\Documents and Settings\MI\Documenti\Visual Studio 2005\Projects\TrackPlotter\TrackPlotter\Form1.vb 555 30 TrackPlotter I tryed the same line code in VB 5 with the expected result to colorize the Box yellow. Is my C.F. 2.0 crazy?.....Or not? Marco
-
Hi all, After it seems that I'm finding the way to resolve my previous problem, now I found another problem. Please read this simple line of code: Imports System Imports System.IO Imports System.Drawing.Graphics Imports System.Drawing.Color ---------------------------------------- TextBox1.BackColor = RGB(255, 255, 0) It generate the following error: Error 1 Value of type 'Integer' cannot be converted to 'System.Drawing.Color'. E:\Documents and Settings\MI\Documenti\Visual Studio 2005\Projects\TrackPlotter\TrackPlotter\Form1.vb 555 30 TrackPlotter I tryed the same line code in VB 5 with the expected result to colorize the Box yellow. Is my C.F. 2.0 crazy?.....Or not? Marco
I think the code that you would need to use is:
TextBox1.BackColor = Color.FromArgb(255, 255, 0)
Or:TextBox1.BackColor = Color.Yellow
Also, make sure that you have the .Net CF Service Packs installed on your mobile device. (I had a few problems with coloring on my PPC before I installed the .Net CF SP2 on it) I hope this helps -
I think the code that you would need to use is:
TextBox1.BackColor = Color.FromArgb(255, 255, 0)
Or:TextBox1.BackColor = Color.Yellow
Also, make sure that you have the .Net CF Service Packs installed on your mobile device. (I had a few problems with coloring on my PPC before I installed the .Net CF SP2 on it) I hope this helpsHi Mitch, Thanks for reply. I have .Net CF SP2 installed on both device and emulator (Windows Mobile 2003 SE). I know that the code that I would need to use is: TextBox1.BackColor = Color.FromArgb(255, 255, 0) The problem I described in the post is born while I was trying to resolve another previous and primary problem (actually unresolved). This is the main problem: 1)- I need to get an RGB vatue from a txt file (I.E. 65535 for Yellow). 2)- Convert it in Integer or Color (Result is the identical: Appl. retuns a color like Aquamarine instead of Yellow. 3)- Use this value as BackColor property for a TextBox. But........ TextBox1.BackColor = Color.FromArgb(255, 255, 0) work correctly (Colorize TextBox Yellow), but it's not good for my application. ------------------------------------------------------ TextBox1.BackColor = Color.FromArgb (65535) 'Color.FromArgb can accept also an RGB Value as single argument. '65535 is the RGB value of Yellow Don't work correctly (Colorize TextBox like Aquamarine instead of Yellow). -------------------------------------------------------- Are 3 days I'm working around....... But Nothing!
modified on Thursday, April 10, 2008 10:54 AM
-
Hi Mitch, Thanks for reply. I have .Net CF SP2 installed on both device and emulator (Windows Mobile 2003 SE). I know that the code that I would need to use is: TextBox1.BackColor = Color.FromArgb(255, 255, 0) The problem I described in the post is born while I was trying to resolve another previous and primary problem (actually unresolved). This is the main problem: 1)- I need to get an RGB vatue from a txt file (I.E. 65535 for Yellow). 2)- Convert it in Integer or Color (Result is the identical: Appl. retuns a color like Aquamarine instead of Yellow. 3)- Use this value as BackColor property for a TextBox. But........ TextBox1.BackColor = Color.FromArgb(255, 255, 0) work correctly (Colorize TextBox Yellow), but it's not good for my application. ------------------------------------------------------ TextBox1.BackColor = Color.FromArgb (65535) 'Color.FromArgb can accept also an RGB Value as single argument. '65535 is the RGB value of Yellow Don't work correctly (Colorize TextBox like Aquamarine instead of Yellow). -------------------------------------------------------- Are 3 days I'm working around....... But Nothing!
modified on Thursday, April 10, 2008 10:54 AM
Hi all, After 3 days I resolved problem explained above. I discovered that in .Net CF 2.0 (may be also others versions), statement Color.FromArgb(Red, Green, Blue) works as expected (correctly)if it's used to reproduce a color structure from a triade of the three R-G-B components values(one value for each component in the order R-G-B), but if it's used to reproduce a color structure from a color value (I.E. 65535 for yellow), it works with colors components values inverted. More exactely, it reproduce colors like statement: Color.FromArgb(Blue, Green, Red) And then, I resolved problem estracting each single component values from the single color value, and recombined them in Color.FromArgb(Red, Green, Blue), following the normal R-G-B sequence. Thanks Marco
modified on Thursday, April 10, 2008 1:41 PM