Hi. Say, in VB6:
Const CLR2 As Long = &HFFF0DC ' light blue
AnyObj.BackColor = CLR2
- How is the equivalent one in C#?
Thanks,
<Harvey Triana /> 4 9393
Harvey Triana wrote:
Hi. Say, in VB6:
Const CLR2 As Long = &HFFF0DC ' light blue
AnyObj.BackColor = CLR2
- How is the equivalent one in C#?
Thanks,
<Harvey Triana />
VB6 colors are BBGGRR, while .NET colors are RRGGBB. Also a .NET color
needs a value for the alpha channel, so you can create color from the
code, then create a solid color from that color:
Const colorTwo As Integer = &HDCF0FF
AnyObject.BackColor = Color.FromArgb(255, Color.FromArgb(colorTwo))
You can also create a color from the separate red, green and blue
components. Then you don't have to specify the alpha value:
AnyObject.BackColor = Color.FromArgb(&HDC, &HF0, &HFF)
--
Göran Andersson
_____ http://www.guffa.com
On Apr 20, 11:35 am, "Harvey Triana" <harveytri...@hotmail.comwrote:
Hi. Say, in VB6:
Const CLR2 As Long = &HFFF0DC ' light blue
AnyObj.BackColor = CLR2
- How is the equivalent one in C#?
Thanks,
<Harvey Triana />
Check out Color.FromARGB method.
Göran Andersson wrote:
Harvey Triana wrote:
>Hi. Say, in VB6:
Const CLR2 As Long = &HFFF0DC ' light blue AnyObj.BackColor = CLR2
- How is the equivalent one in C#?
Thanks, <Harvey Triana />
VB6 colors are BBGGRR, while .NET colors are RRGGBB. Also a .NET color
needs a value for the alpha channel, so you can create color from the
code, then create a solid color from that color:
Const colorTwo As Integer = &HDCF0FF
AnyObject.BackColor = Color.FromArgb(255, Color.FromArgb(colorTwo))
You can also create a color from the separate red, green and blue
components. Then you don't have to specify the alpha value:
AnyObject.BackColor = Color.FromArgb(&HDC, &HF0, &HFF)
Sorry, I gave you VB.NET code, here's the equivalent C# code:
const int colorTwo = 0xDCF0FF;
AnyObject.BackColor = Color.FromArgb(255, Color.FromArgb(colorTwo));
and
AnyObject.BackColor = Color.FromArgb(0xDC, 0xF0, 0xFF);
--
Göran Andersson
_____ http://www.guffa.com
Thanks a lot Göran
<Harvey Triana />
"Göran Andersson" <gu***@guffa.comescribió en el mensaje
news:eV*************@TK2MSFTNGP06.phx.gbl...
Göran Andersson wrote:
>Harvey Triana wrote:
>>Hi. Say, in VB6:
Const CLR2 As Long = &HFFF0DC ' light blue AnyObj.BackColor = CLR2
- How is the equivalent one in C#?
Thanks, <Harvey Triana /> VB6 colors are BBGGRR, while .NET colors are RRGGBB. Also a .NET color needs a value for the alpha channel, so you can create color from the code, then create a solid color from that color:
Const colorTwo As Integer = &HDCF0FF AnyObject.BackColor = Color.FromArgb(255, Color.FromArgb(colorTwo))
You can also create a color from the separate red, green and blue components. Then you don't have to specify the alpha value:
AnyObject.BackColor = Color.FromArgb(&HDC, &HF0, &HFF)
Sorry, I gave you VB.NET code, here's the equivalent C# code:
const int colorTwo = 0xDCF0FF;
AnyObject.BackColor = Color.FromArgb(255, Color.FromArgb(colorTwo));
and
AnyObject.BackColor = Color.FromArgb(0xDC, 0xF0, 0xFF);
--
Göran Andersson
_____ http://www.guffa.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Edward WIJAYA |
last post by:
Hi,
I am new to Python, and I like to
learn more about it. Since I am
used to Perl before, I would like
to know what is Python equivalent
of Perl code below:
$filename = $ARGV;
|
by: Tim Clacy |
last post by:
How is a 64 bit type defined in strict C++?
It seems C has support for 'long long' since C99, but not so for C++?
Looking through one compiler vendor's standard library headers has clouded
the...
|
by: BK |
last post by:
Can someone point me to a code sample that illustrates executing long
running tasks (asynchronous) from a web application in ASP.NET? I assume
that Web Services might come into play at some point,...
|
by: Rhino |
last post by:
I am updating some Java UDFs from DB2GENERAL to DB2JAVA as suggested in the
manuals for DB2 Version 8 but I'm having problems with setSQLstate() and
setSQLmessage(). If I'm reading the manuals...
|
by: MLH |
last post by:
What is the value of X immediately after
declaring the variable? I thought its value
was Null. However, I am unable to assign
a value of Null to X...
X = Null produces an error. I don't...
|
by: Kenjis Kaan |
last post by:
I would like to use the crypt function in a Win32 (ie. C program using
Visual C++ 6.0 compiler). I wrote a little program to see if it will
link but it didn't. So I guess maybe the function isn't...
|
by: arkam |
last post by:
Hi,
I found a sample on internet :
formMain.BeginInvoke(new MyClickHandler(this.OnMyClick));
I would like to do the same but in a class library where there is no forms !
Where can I find...
|
by: Allen |
last post by:
Greetings,
I need to pass a file path to an application. This file path contains long
directory and file names. The target application, pdftotext.exe, only
accepts short directory and file...
|
by: Kunle Odutola |
last post by:
I'm trying to understand where the information in the META.INF directory
including MANIFEST.MF etc is to be found for .NET assemblies.
Also some projects such as Eclipse's OSGi kernel stores...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |