|
Welcome (you and 'psychic coding') to the CP's memorable quotes list
(you my access the list via http://www.codeproject.com/Members/CPallini since the permalink for the list is broken)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Why thank you sir.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
You have a method GetQuotQuntityItem which takes some parameters and you are calling it without specifying the parameters.
|
|
|
|
|
I have a native C DLL which contains the following function:
int FOO(
UINT A,
UINT B,
int X,
int Y,
void *(*get_Z)(int, int, void*),
void* I,
int G, int* &K, int* &L
) throw () ;
What should I do to be able to use it in my C# program.
The solution: this link[^]
Thanks to Henry Minute
Roman
modified on Tuesday, April 21, 2009 7:35 AM
|
|
|
|
|
Wait no more.
Take a look at this[^].
The tool there should enable you to generate the required code.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I have a program which has a control that gets live web cam video feed and plays it on a rectangle in the main form. I have the following code for the control "Mouse_Click" event:
private void videoSourcePlayer_MouseClick(object sender, MouseEventArgs e)
{
txtMouseX.Text = e.X.ToString();
txtMouseY.Text = e.Y.ToString();
}
i need to convert the e.X and e.Y to integer format, and use those values in the getPixel function of the bitmap image taken from the video source player in the following code:
private void videoSourcePlayer_NewFrame( object sender, ref Bitmap image )
{
bool showOnlyObjects = onlyObjectsCheck.Checked;
Bitmap objectsImage = null;
objectsImage = image;
colorFilter.ApplyInPlace( image );
BitmapData objectsData = objectsImage.LockBits( new Rectangle( 0, 0, image.Width, image.Height ),
ImageLockMode.ReadOnly, image.PixelFormat );
UnmanagedImage grayImage = grayscaleFilter.Apply( new UnmanagedImage( objectsData ) );
objectsImage.UnlockBits( objectsData );
blobCounter.ProcessImage( grayImage );
Rectangle[] rects = blobCounter.GetObjectRectangles( );
if ( rects.Length > 0 )
{
Rectangle objectRect = rects[0];
Graphics g = Graphics.FromImage( image );
using ( Pen pen = new Pen( Color.FromArgb( 160, 255, 160 ), 3 ) )
{
}
g.Dispose( );
}
}
how do i get the mouse x and y coordinate values from the first function into the second function so i can use the "image.getPixel()" call?
|
|
|
|
|
sebogawa wrote: how do i get the mouse x and y coordinate values from the first function into the second function
Short answer, you can't!
Judging from its signature, your videoSourcePlayer_NewFrame method is an event handler for the video player you are using. Its parameters are fixed and interfering with then will break the code.
One possible solution is to make the UnmanagedImage grayImage declaration a class field (Move the declaration outside the handler), then in your MouseClick handler do something like
private void videoSourcePlayer_MouseClick(object sender, MouseEventArgs e)
{
txtMouseX.Text = e.X.ToString();
txtMouseY.Text = e.Y.ToString();
Color selectedColor = grayImage.GetPixel(e.X, e.Y);
SomeMethodThatUsesTheColor(grayImage.GetPixel(e.X, e.Y));
}
Your biggest problem might turn out to depend on how quickly the grayImage changes.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Thank you for the help Henry. I was wondering if the videosourcePlayer_NewFrame can inherit the videoSourcePlayer_MouseClick values and apply them to the _NewFrame block? I have been playing around with basic inheritance but involves only classes. I stunbled upon a C# lesson involving polymorphism (inheriting from a method) at the following link:
http://www.softsteel.co.uk/tutorials/cSharp/lesson14.html[^]
Do you think this will help? If not then how can i solve my problem, detaching the greyimage declaration and applying it to mouse click does nothing due to the fact that the greyImage can not be changed. I am trying to make it so that when i click on the live video feed control, it takes the ARGB values of the pixel clicked on (plus or minus 30) and apply it to the ARGB filter textboxes which saturates the image to only show the given color. (color tracking)
the purpose of this app is for a robot that i am working on that tracks while traffic lines, 3 inches thick which the robot must stay in between. I am using webcams, and the AForge library for video processing and I scrapped together pieces of the "Lego Pan and Tilt App" from a Code Project Article. The app works but i have to manually set all the ARGB ranges to find the color i want. It would be easier to just click on the image and get the values. I hope this information helps, im stuck and at a loss for ideas. Any help would be greatly appreciated.
modified on Tuesday, April 21, 2009 3:11 PM
|
|
|
|
|
hi
i'm using TableAdapter to update data, but when i use TableAdapterManager to update, the following exception occure :
Concurrency violation: the UpdateCommand affected 0 of the expected 1 records
i have some trouble with this operation and i've a lot of search over internet and could not solved my problem. also microsoft has a video to demonstrate this, but when i try that, i still get this exception.
Any help would be great appreciated.
|
|
|
|
|
I found this, may bee it's helps.
Make sure you don't modify the access database anywhere in your code without going through the datatable, because if you do the data in the datatable will no longer be synchronized with the database.
|
|
|
|
|
Hi Roman
can u more explain ?
i have a simple form with simple dataBinding. that's it.
Here is my code :
private void customersBindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
this.Validate();
this.customersBindingSource.EndEdit();
this.ordersBindingSource.EndEdit();
this.tableAdapterManager.UpdateAll(this.test2DataSet);
}
private void Form2_Load(object sender, EventArgs e)
{
this.customersTableAdapter.Fill(this.test2DataSet.Customers);
this.ordersTableAdapter.Fill(this.test2DataSet.Orders);
}
private void ordersBindingSource_AddingNew(object sender, AddingNewEventArgs e)
{
this.customersBindingSource.EndEdit();
}
Note : Customers is parent Table and Orders is child Table
|
|
|
|
|
1: try to remove -> this.customersBindingSource.EndEdit(); <- from ordersBindingSource_AddingNew().
or
2: modify
private void customersBindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
this.Validate();
this.customersBindingSource.EndEdit();
this.ordersBindingSource.EndEdit();
DataTable changes = null;
changes = your datatable here.GetChanges();
if (changes != null)
{
TableAdapter.Update(changes);
}
your datatable heree.AcceptChanges();
}
|
|
|
|
|
As u can see in my above code, i'm using TableAdapterManager, not TableAdapter!
|
|
|
|
|
If you use TableAdapterManager your project contain TableAdapters, so try to use them.
Sorry for my English.
|
|
|
|
|
i've use this commands :
Test2DataSet.CustomersDataTable customerChanges = null;
Test2DataSet.OrdersDataTable orderChanges = null;
customerChanges = (Test2DataSet.CustomersDataTable)this.test2DataSet.Customers.GetChanges();
orderChanges = (Test2DataSet.OrdersDataTable)this.test2DataSet.Orders.GetChanges();
if (customerChanges != null)
this.customersTableAdapter.Update(customerChanges);
this.test2DataSet.Customers.AcceptChanges();
if (orderChanges != null)
this.ordersTableAdapter.Update(orderChanges);
this.test2DataSet.Orders.AcceptChanges();
but i got this exception :
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Orders_Customers". The conflict occurred in database "Test2", table "dbo.Customers", column 'CustomerID'.
The statement has been terminated.
|
|
|
|
|
Try this:
this.Validate();
this.customersBindingSource.EndEdit();
this.ordersBindingSource.EndEdit();
Test2DataSet.CustomersDataTable customerChanges = null;
Test2DataSet.OrdersDataTable orderChanges = null;
customerChanges = (Test2DataSet.CustomersDataTable)this.test2DataSet.Customers.GetChanges();
orderChanges = (Test2DataSet.OrdersDataTable)this.test2DataSet.Orders.GetChanges();
if (customerChanges != null)
this.customersTableAdapter.Update(customerChanges);
if (orderChanges != null)
this.ordersTableAdapter.Update(orderChanges); // Error has been occured in this line
this.tableAdapterManager.UpdateAll(this.test2DataSet);
|
|
|
|
|
I've Copy/Paste your code in my app :
this.Validate();
this.customersBindingSource.EndEdit();
this.ordersBindingSource.EndEdit();
Test2DataSet.CustomersDataTable customerChanges = null;
Test2DataSet.OrdersDataTable orderChanges = null;
customerChanges = (Test2DataSet.CustomersDataTable)this.test2DataSet.Customers.GetChanges();
orderChanges = (Test2DataSet.OrdersDataTable)this.test2DataSet.Orders.GetChanges();
if (customerChanges != null)
this.customersTableAdapter.Update(customerChanges);
if (orderChanges != null)
this.ordersTableAdapter.Update(orderChanges);
this.tableAdapterManager.UpdateAll(this.test2DataSet);
but i still got this error :
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Orders_Customers". The conflict occurred in database "Test2", table "dbo.Customers", column 'CustomerID'.
The statement has been terminated.
|
|
|
|
|
I make code for read in web based mySql.
my php code able to read mySql and push to string.
$yoResult = iconv("EUC-KR", "UTF-8", $outxml);
echo $yoResult;
$yoResult is...
<?xml version="1.0" encoding="utf-8" ?>
<yodata>
<yovalue1>bla bla </yovalue1>
</yodata>
my window mobile code read that data string.
But i don't know How to handle that data!
How do I approach that data?
|
|
|
|
|
|
In my plugin project, when i build it,its done successful.I got a window pop up with greeting of hello world whn i click the home icon of IE browser in windows xp.I need the same output pop up window in IE browser in vista system,But when i run same in vista os the error i found are :
1.Error 2 Cannot register assembly "C:\Users\sreeni\Desktop\ESoftIEPlugin\ESoftIEPlugin\ESoftIEPlugin\bin\Debug\ESoftIEPlugin.dll" - access denied. Please make sure you're running the application as administrator. Access to the registry key 'HKEY_CLASSES_ROOT\ESoftIEPlugin.SpicIE' is denied. ESoftIEPlugin
2. Warning 1 Cannot unregister assembly "C:\Users\Surya\Documents\Visual Studio 2008\Projects\ESoftIEPlugin\ESoftIEPlugin\ESoftIEPlugin\bin\Debug\ESoftIEPlugin.dll" - file doesn't exist. ESoftIEPlugin
for this itried to register the dll to rectify the error but again i found window error in vista ie windows cannot find regsvr32"c:\Users\Sreeni\Desktop\E.dll".Make sure you typed the name coirectly,and then try again.
please any one help me out for the above errors or any other suggestion to do.Thanks in adavance.
Thanks and Regards
Ch.Gayatri Subudhi
|
|
|
|
|
While adding dynamically Tab Pages to tab control. New created tab page should come next to selected tab page. By default new tab page will place at last position of tab control.
Is there any property in Tab control to do the same.
Thanks in Advance
|
|
|
|
|
I suggest you reinstall visual studio, I am guessing that intellisense is broken on your machine. Once you do that, if you type myTabControl and hit the ., you will get a list of possible methods to call. Look for the Insert method. You'll find that it even gives you popups telling you what everything does, so you can use it to explore a class for anything you think should be in there.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
This is a real basic question but does anyone know a beginner tutorial that shows how to utilize a webcam attached to a computer? This is something new I am trying to learn and didn't really find much online. What I did find was some video chat that was far too advanced for myself. I am just looking at displaying what the webcam sees for now.
|
|
|
|
|
There's some articles on CP. basically it's a directX stream.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Ok I have found the DirectX.Capture which seems to be usign DirectShow.
Sorry to sound so stupid, but do you happen to have a good book that you know of that teaches how to use DirectShow SDK. I am actually interested in learning how to create a video chat application. I have downloaded the library mentioned at: DirectX.Capture Class Library[^]
Seems it does pretty much everything. I used it with a panel to show myself on a webcam. I'm interested in learning more about this and just wondering if you have any suggestions on books that you may have read or know people have read and liked
|
|
|
|