VS 2008 Checking A Color's ARGB Value
Jul 15, 2009I was curious why this bit of code won�t detect that the ARGB value is Blue:
[Code]...
When I run the code it says that the color isn�t Blue.
I was curious why this bit of code won�t detect that the ARGB value is Blue:
[Code]...
When I run the code it says that the color isn�t Blue.
Im using VBStudio 2010 Pro and I am writing to the registry the Font and Background colors so that my form load will apply the chosen colors. Can't get it to work for me though.
Am setting like this:
ColorDialog.ShowDialog()
My.Computer.Registry.SetValue("HKEY_CURRENT_USERBMSUFontColor", "FontColor",
[code].....
I need to create hex color to visualize wit it a number on google earth. Moreover I would like to create a small image file that depicts the color used in google earth. so I convert hex color from ARGB to brush color This is my
dim oo=new random()
Dim filecolori = New StreamWriter(dir_colori + "lista_colori.txt")
Dim b = Nothing
[Code]....
I've set up a transparent user control (used for drawing tools) over a page, and I'm trying to set up some code that will allow you to click through the control if the pixel underneath the pointer is transparent, but will NOT let you click through if the pixel is colored. Basically, if they've drawn a line there, I don't want them clicking through it.
View 5 RepliesI'd like to know how to convert argb to rgb
View 12 RepliesI have a hexadecimal value contained in a string in the format like #FF00 for red, #0FF0 for green and #00FF for blue. I remove the hash sign so it's just the hexadecimal number but after that, I'm stuck? I know there's a convert.tostring or something but I'm not sure how to use it when converting from hex to decimal.[code]How do you do the reverse of this? From Hexadecimal to Decimal so I can create the argb value of my brush colour. If there is an easier way, please say but, as far as I am aware, Visual Basic.net 2010 doesn't let you define a colour using #0FF0.
View 19 Replies1: Start with bitmap in picturebox colored white2: Draw a filled rectangle (50,50,100, 100) Color black - ARGB (255,0,0,0)3: Draw a filled rectangle covering black rectangle (25,25,150, 150) Color blue, with Alpha set to 100 - ARGB (100,0,0,255) -because of 100 Alpha setting the black rectangle is visible through the blue rectangleProblem : Using bitmap.GetPixel on the blue rectangle (over white background) the result is ARGB(255,155,155,255) -an Alpha value of 255. The new color loooks the same but is not transparent.Question: How to find Alpha(transparency) value of pixel
View 7 RepliesQ1. is there a way to set an argb value to a Control?
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.AllowTransparency = True
Me.BackColor = Color.FromArgb(155, 255, 0, 0)
End Sub
i get error when setting BackColor "control does not support tarnsparent background colors"
Q2. is there any difference between this 2:
argb(255,0,0,127) "opacity is 1, blue is half" and
argb(127,0,0,255) "opacity is half, blue is max"
Q3. what if there are rounding off errors in the conversion to/from argb/rgb say argb(200,0,0,150) when converted to 255 opacity i get (255,0,0,117.5585938~)can i say that argb(255,0,0,118) is exactly equal to argb(200,0,0,150) or is argb(255,0,0,117) exactly equal to argb(200,0,0,150), or is there no way to exactly convert argb(200,0,0,150) to a value with alpha at 255?
Q4. is it true that there is absolutely no relation between argb and rgb, because the actual rgb value of an argb depends on the color of the element behind it?
Alright inside of a combo box I have a list of colors and I want to change the background color of the combo box to the selected color...basically this... but im not sure what the problem is here anyone have some advice or is this not possible?
CBLinerColor.BackColor() = CBLinerColor.Items.Item(0)
Basically i want dynamic code that will change the color depending on the items in the box.
I want the background of my form to be the same color as the window frame color that the user selects, even if that changes. I selected System->WindowFrame as my background color, but it always remains a dark grey, regardless of what I have my window color set to. How else would I achieve what I want? I assumed I was doing it the correct way. Do I actually need code that gets the system window color and then apply it?
View 4 Repliesi use this code to insert argb value from picturebox to listview
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Dim bmp As New Bitmap(Me.PictureBox3.Image)
Dim x, y, a, r, g, b As Integer
[code]....
it's code very slowly.....
I'm looking to get the label to show the ARGB value of the backcolor on my current form using vb 2010.
View 2 RepliesWhy is it that in parts of the .Net architecture that ARGB colours are expected be as type Integer when ARGB is outside the range of Integer? (ARGB requires 32 bits of precission, but Int has 31 bits of precission).Now of course I could just do a conversion, but what freaking conversion to use??? (I'm not affluent with all the VB global methods and the sort)
I've tried things like:
Code:
Dim value As Integer = &H80000014
Dim uvalue As UInteger = CType(value, value)
''overflow others include Convert.ToUInt32 -> value was either to large or to small and a few others all offering up nonsense about overflows, when all I freakin' want is a colour that Microsoft's own engineers have done stupid things like expect Integer values in places where UInteger should be, or vice versa. How about some consistency...
Code:
Dim value As UInteger = &H80000014 ''<- not represntable as a Uinteger???
Dim uvalue As UInteger = 2147483668 ''<- same value in decimal, same exact value! and it works this says it's not representable as a UInteger?
Im havin a problem changing my picturebox back color to System color "Control".I can set it to color.red , color.blue etc , but not control .
View 6 RepliesIs there any better performance by checking for a true value like this:
[CODE]..............
Than like this:
[CODE]..............
i have a textbox in a calculator and i want an if function so that it checks that there cannot be 2 .'s in it:[code]
View 2 RepliesI'm trying to determine the framework version that is installed via the registry. When poking around, I found this key: HKLMSOFTWAREMicrosoft.NETFrameworkPolicyv4.0 I've created the following function to determine if the key exists:
[Code]...
I've verified the key exists, but it keeps returning False.
i know My.Computer.Network.Ping but as alot of people know, it's glitchy and bugged.
I want something that checks to see if it can connect with something, as simple as it sounds.
I'm experimenting with sockets at the moment, but having trouble so i thought i would come and ask here
What i'm up to:
VB
IP = Net.IPAddress.Parse(getinfo("settings.inf", i & "IP"))
socket = New Net.Sockets.Socket(Net.Sockets.AddressFamily.InterNetwork, Net.Sockets.SocketType.Stream, Net.Sockets.ProtocolType.IP)
[Code].....
However the problem with this it that i pinged 1.1.1.1 and it still connects, ALSO i would like to be able to check a hostname not just an IP to make things more convenient, please help me to find a way to properly check a connection with IP or hostname.
Note: The getinfo function is defined by me
In the following code, a Date variable is declared but not set to anything:
Dim myDate As Date
What's the proper method of checking if the Date variable is "new" and not set to anything?
For example, getting the lowest date value from an array of dates:
Dim dtMostRecent As Date
For i As Intger = 0 To myDateArray.Count - 1
If myDateArray(i) < dtMostRecent Then dtMostRecent = myDateArray(i)
Next
In the code above, I need a way to check first if dtMostRecent is unassigned, in which case just give it the first value, after which it can be compared with subsequent values. How to check if a Date variable is unassigned.
I've created the following function and thrown it inside of a timer:
[code]...
It works, but it keeps trying to open media player for each process it looks like. I need to continuously run the function so that Media Player opens when it's closed.how to make sure it opens only once when the process doesn't exist?
Can someone tell me why this code works exactley the opposite of the way I thought it should?
[code]...
I have a combobox (cbKeyWords). I want to make sure tbAddEdit.Text does not already exist before I save. To me I should be testing for a False result not True. But the above code, goes to the msgbox if findstringexact=false and saves the data if it's true.
I have agroupbox control and on this groupbox control there is upto 10 checkboxes, if any of them are unchecked i was going to throw a warning "No checkboxes selected" i'm not sure how to go about it so far i have:
For Each ctrl As Control In GroupBox10.Controls
'Not sure what to do here...
Next
[code].....
I have 22 text boxes that have to be checked to see if the value has changed. I am using the TextChanged Event handler to do this thus:
Private Sub TextStringChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
DataChanged = True
RemoveHandler ........
[code]....
The Handler would be added after the data had been loaded. The question is:Is there another way of checking for text changes without having to add and remove 22 handlers.
I'm having trouble using the HasChanges method.I'm trying to get a message box to show if a user hits the edit button, makes a change, then hits the close button without hitting the save button first. From what I understand, the HasChanges(DataRowState.Modified) statement should work.In reality, when I hit the edit button, make a change to a field (zip for example), then hit the close, it just closes without showing the messagebox.Here's my code so far...
Private Sub CustomerForm_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) _
Handles Me.FormClosing
[code].....
I am trying to have my program check for the existence of a registry key so I do not get a null reference exception error. The key may or may not exist depending on the computer. How can I check to see if it exists and then change its value if it does exist or skip over it to the next one if it does not exist? (I already know how to change the value part of it) Im just not sure how to check for the existence of it for example would be trying to set the value of a key that does not exist called test below... this obviously would throw a null exception error so how do I check for the existence of the key before executing these instructions and then if it does not exist it skips this and keeps going to the next code ?
Dim testkey As RegistryKey = Registry.LocalMachine.OpenSubKey("SystemCurrentControlSetTEST", True)
Dim keyval As Int32
' Set to ON
keyval = 1
testkey.SetValue("ON", keyval)
I also check the status of the registry entry on form load
Dim Test As RegistryKey = Registry.LocalMachine.OpenSubKey("SystemCurrentControlSetMYTEST", False)
'Get the reg value.
Dim Testflag As Integer = CInt(Test.GetValue("ON"))
[code]....
I have tried to solve this myself and I know I am probably doing something really silly here what I have is two different registry values that control what is displayed in the combobox on my form RegistryKey1 has the following values:0,1 or it does not existRegistryKey2 has the following values2,3, or 4 the combobox has the following values 0,1,2,3 However here is the problem if the RegistryKey2 is 2 then it further has to be checked if RegistryKey1 is either 0,1 or does not exist
if it is 1 then the selectedindex = 0
if it is 0 or does not exist then the selectedindex = 1
if RegistryKey2 is 3 then the selectedindex = 2
[code].....
Suppose I have 5 Integers(A, B, C, D, and E) and 5 Textboxes. When the program run, the user is going to input 5 numbers to those 5 textboxes. When a button is pressed, a label will show up and write the textbox number with the biggest number.
View 1 RepliesI'm very green with VB Express 2008 and am going through the tutorial. I'm skipping over a lot of the exercises as some of it is review for me - I've a fairly solid background in MS Access VBA and forms design there. But I have a simple question on VB Express forms design (I'm not worried about data handling or anything yet).How do I test a form? In my first form on my project, I just press F5 (Start debugging) and it opens just fine. However, I'm playing around with a second form in design mode and can't seem to get it to open to test some of the code (simple msgboxes associated with buttons).
In Access 2003 and earlier, there was a design mode and form view. The Access design mode was the equivalent of the design tab in the VB project, but I can't seem to find the equivalent of the Access form view in VB so that I can open that form. VB F5 only seems to open the first form.BTW, is VS 2008 the correct tag/prefix for this question on VB Express 2008? I see there's a separate tag list - is there an approved list of tags aside from the prefix before the title in the posting screen?
I'm checking is a file exists as follows.
If txtGradeObs.Text = "" Or Dir(txtGradeObs.Text) = "" Then
MsgBox("Specify the Grade job of Obstructions", vbExclamation, MsgBoxTitle)
Exit Sub
End If
I get an error if the drive does not exist - i.e. G: rather than C:. It used to work in VB6. How can I get it to work.
I want to make a program where I can chose a COM port (For example COM 1), then check if it's working. It would be really useful for me, seeing as I work a lot with broken COM cards.
View 1 Replies