PC Review


Reply
Thread Tools Rate Thread

Convert C# to vb.net help

 
 
scorpion53061
Guest
Posts: n/a
 
      22nd Aug 2004
(IT is saying the Operator '=' is not defined for types
'System.Drawing.Color' and 'System.Drawing.Color'.

(btnface is a color)



If btnFace = Color.White OrElse btnFace = Color.Black Then

res = highlight

Else

res = Color.FromArgb(GetLightIndex(colorInfo1,
btnFace.R, highlight.R, window.R), GetLightIndex(colorInfo1, btnFace.G,
highlight.G, window.G), GetLightIndex(colorInfo1, btnFace.B,
highlight.B, window.B))

End If







It is saying the Public Event Changed(sender As Object, e As
System.EventArgs)' is an event, and cannot be called directly. Use a
'RaiseEvent' statement to raise an event.



Protected Overridable Sub OnChanged()

If Not (Changed) Is Nothing Then

RaiseEvent Changed(Me, EventArgs.Empty)

End If

End Sub 'OnChanged





Thank you for any help!!


 
Reply With Quote
 
 
 
 
Cor Ligthert
Guest
Posts: n/a
 
      22nd Aug 2004
Scorpion,

Convert it first to argb that goes forerver, a piece of code Peter Huang
showed recently in this newsgroup.


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim kc As Color = Color.FromKnownColor(KnownColor.Blue)
Dim cr As Color = Color.FromArgb(kc.ToArgb())
Dim c As KnownColor
For i As Integer = 1 To 137
If Color.FromKnownColor(i).ToArgb() = cr.ToArgb() Then
Debug.WriteLine(CType(i, KnownColor).ToString())
End If
Next
End Sub

Cor


 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      22nd Aug 2004
* "scorpion53061" <(E-Mail Removed)> scripsit:
> (IT is saying the Operator '=' is not defined for types
> 'System.Drawing.Color' and 'System.Drawing.Color'.
>
> (btnface is a color)
>
>
>
> If btnFace = Color.White OrElse btnFace = Color.Black Then


'If btnFace.Equals(Color.White OrElse...'.

> It is saying the Public Event Changed(sender As Object, e As
> System.EventArgs)' is an event, and cannot be called directly. Use a
> 'RaiseEvent' statement to raise an event.
>
>
>
> Protected Overridable Sub OnChanged()
>
> If Not (Changed) Is Nothing Then
>
> RaiseEvent Changed(Me, EventArgs.Empty)
>
> End If
>
> End Sub 'OnChanged


Remove the 'If Not (Changed)' Is Nothing...' stuff. VB.NET will do the
checking for you.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert Columns of Sensitive Information, and then convert back... =?Utf-8?B?V2lsbGlhbSBFbGVyZGluZw==?= Microsoft Excel Programming 1 12th Oct 2006 09:37 PM
IsNumeric: Convert.ToInt32 vs. Convert.ToInt64 sck10 Microsoft ASP .NET 4 3rd Sep 2006 10:40 PM
Convert file to binary, send it over the network, and convert it b =?Utf-8?B?Q2hld2ll?= Microsoft Dot NET 0 9th Sep 2005 06:04 PM
Convert file to binary, send it over the network, and convert it b =?Utf-8?B?Q2hld2ll?= Microsoft Dot NET Framework 1 9th Sep 2005 06:01 PM
convert decimal number to time : convert 1,59 (minutes, dec) to m =?Utf-8?B?YWdlbmRhOTUzMw==?= Microsoft Excel Misc 8 20th Jan 2005 10:24 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:40 AM.