im working on changing this code.. The code do a "floodfill", but I want a "floodfill" with a range of color..so i dont understand very much of this code, but somehow i want to change the recursive funciontion to paint only in a certain region I think I have to work whit this function. Actually I do, changing the fourth parameter (before: &HFFFFFF)ExtFloodFill(hMDC, e.X, e.Y, CInt("&H" + Hex(pixR) + Hex(pixG) + Hex(pixB)), 1) I only found this code to do that, I tried to do my own recursive function, but it didnt work..
I have decided to use a flood fill algorithm for my application, using this pseudo-code from Wikipedia:Flood-fill (node, target-color, replacement-color):
1. Set Q to the empty queue.
2. If the color of node is not equal to target-color, return.
3. Add node to Q.
4. For each element n of Q:
5. If the color of n is equal to target-color:
6. Set w and e equal to n.
7. Move w to the west until the color of the node to the west of w no longer matches target-color.
8. Move e to the east until the color of the node to the east of e no longer matches target-color.
9. Set the color of nodes between w and e to replacement-color.
10. For each node n between w and e:
11. If the color of the node to the north of n is target-color, add that node to Q.If the color of the node to the south of n is target-color, add that node to Q.
12. Continue looping until Q is exhausted.
13. Return.
I was doing alright, until I hit the "continue looping until Q is exhausted".I don't quite get that.
A short semi fast flood fill. I'm about to run it on 10+ million shapes. There always seem to be a few unique situations where something doesn't work.
Public Sub Fill(ByVal bmp As Bitmap, ByVal pos As Point, ByVal color As Color) If bmp Is Nothing OrElse pos.X < 0 OrElse pos.Y < 0 OrElse pos.X >= bmp.Width OrElse pos.Y > bmp.Height Then Exit Sub Dim bmd As BitmapData = bmp.LockBits(New Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadWrite, bmp.PixelFormat) Dim stride As Integer = bmd.Stride
faster way to flood fill an area of a bitmap? It basically acts just like the fill flood bucket in MS Paint. clsBitmapImage is a Bitmap variable.
Code:
Code: Public Sub FloodFill(ByVal AtPoint As Point, ByVal newColor As Color) Dim oldColor As Color = clsBitmapImage.GetPixel(AtPoint.X, AtPoint.Y) If oldColor.ToArgb <> newColor.ToArgb Then
I am trying to create a legend for some colors and thought of adding rectangleshpes to do so. However, I do not seam to be able to set the fill color of the shape.
I have an image saved in a bitmap (bmp) as a result of some graphic manipulation. Part of it is transparent. And I can save it to a file in bmp, jpg, png, tif with no problem. I also want to fill the image background with a color of choice, which is saved in a PictureBox control (ColorBox1). I suppose I need to draw a rectangle like[code]...
I need to create an on-screen shape (circle) that has a fill color, which will blink every X seconds (go from fill color, to white, back to fill color). This is trivial to do...BUT... i want to do it in my own class, so that I can instantiate it numerous times passing it unique coordinates for each instantiation.
How do I do it? Can a class have its own "timer control" in it independent from the form? How would I draw a shape from a class?
I am currently making a small flood runner like game, I completed most of it, but I can't seem to get the jump action right. I got it to jump straight up and back down again, but it doesn't work when I use a left/right arrow key with it to perform a left/right jump. The sprite goes straight up if I only press space.What I want- The sprites goes up and right or left when I press space while holding right or left.
Im using a dataset to display data in a datagrid from a sql server DB. One of the colums I have in my datagrid is "Status" the table adapter sql statment selects certain items based on whether there open or closed e.g "where = Open ". I want to remove this row entirely and instead of displaying open or closed for status column, display the open/ closed results in colour on the datagrid. Im really not sure how to go about this whether i need to do it in the table adapter or some sort of property. I presume i need to write a sql statement and selct the identity of the row where x= open etc , is there a way of assigning a colour in sql statement so it displays on my vb form ?
I found an example of a simple irc client, but I'm really confused about how it sends data back to the irc server. In the example, this is the code used to respond to the server's PING request. it lies in the onDataArrival event of a sockets client:[Code]
However with this simplified code, as soon as it tries to respond to the PING request it is disconnected from the irc server with the reason "Excess Flood". So I was hoping someone could explain to me the difference between the pretty complicated method and my simplified one which doesn't work.
I am using the following code in the Load method of a VB form to generate random numbers in the range 1 to 8. Without fail after enough loops the range is exceeded and 9 is the random number returned every time. The line using the Rnd function is from: Rnd Function (Visual Basic)
I am getting the error:"Range variable 'sender' hides a variable in an enclosing block or a range variable previously defined in the query expression."for this
Imports System.Data.SqlClient Imports System.Linq Public Class Form1
[code]....
I can select any other item from the table without the error. "sender" has the same properties as "receiver" in the SQL table.
I just want to display data of a single column from an oracle table into a datagridview or a listbox for readonly with no requirements to make changes to it. Simply display the information.What is the best way forward... To used DATAADAPTER or DATAREADER.s DATAGRIDVIEW SLOWER TO FILL THAN a LISTBOX.i am using the following code to fill datatgridview but for some odd reasons at time it is slow to display the data. I want to use listbox instead
Dim ds As New DataSet Dim adp As OracleDataAdapter adp = New OracleDataAdapter("select customer_name from customers")
I have a question of VB event handler and color picker. Now I have a label, and I want when user click it, it pops up a color picker dialog and let user to change the background color of the label. Not sure how to implement this, can anyone give me a direction?
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?
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?
I have a array of pixels. And I would like to Quantize them.
For Example
FF00FF,00FFFF stuff like that, but most are custom colors and are not a standard 256 color palette. So I need code to convert a color to a 256 color. I dont have any idea on how to do this, but thats why I came here. I do not want to use System.Graphics.Image.Palette or anything like that as this project uses arrays for images. I would like to if at all possible be able to convert a R, G, B color to 8bit, 16bit, 256bit and possibly use the HSL or NeuQuant method or something close to that, or maybe even some other methods of doing it. I do need to be able to do this for a single pixel, but I will also need a method for a array of them.
Right Click drop down menu using ContextMenuStrip. The background color of an unselected menu item is set with "BackColor".The color of the text of a selected menu item is set with "ForeColor".How to set the background color of a selected menu item? Default appears as a dark grey and I would like to change it.
I am using .NET 1.1, so I don't have the access to listitem object. I would like to change the text color or the background color of certain items in a listbox. can it do it in .NET 1.1?
I am trying to write code to load all nown color names from color.xxxxxxx in a ComboBox, but can not get it right. I can not find the Color Enum member. What I had in mind was something like this:
vb.net 2003 asp.net 1.1Web ApplicationI have a dynamic DataGrid with the alternating rowcolors and paging, with a textbox in each row. I need to know how to make the background color ofthe texboxes the same color as the row that they are in.