|
It will be all referenced assemblies, but not necessarily all assemblies in the project. Referenced assemblies are those that are actually listed in the References tree in Visual Studio and imported by namespace into the project. If you have any late bound assemblies (assemblies loaded by reflection using Assembly.Load() ), they won't be in this list.
|
|
|
|
|
Hi...
I have been working with a image thing and all the stuff i have done is with the system.drawing.image part. now i would like to use some of the system.drawing.bitmap fetchers and would like to do it with out saving the Image to file and opening it as a Bitmap.
Running in VS2005 C#.
I have been trying all sorts of things i have read all around the Internet but just cant seem to get the right syntax.
all help would be greatly appreciated.
thanks
|
|
|
|
|
Bitmap bit = new Bitmap(image);
|
|
|
|
|
What!? You mean it's that simple? After all the hours spent researching this if I had only read the documentation, Bitmap.Bitmap(Image) Constructor
only two letters away from being an asset
|
|
|
|
|
Mark Nischalke wrote: You mean it's that simple
True. System.Drawing.Imaging is a magic wand in fact. I was inspired to put down a few points on the same as an UtilityAPI here:
http://dotnetspider.com/kb/Article3446.aspx[^]
|
|
|
|
|
I have a 3rd party treeView Control which shows its own context Menu on right click. I want to override it with my Own.
I set control's CONTextMenu to my own contextMenu , what actually happening that it shows all items as Disabled. Also shows default context Menu.
Help me please!
|
|
|
|
|
Hi Adnan, it's been awhile.
Try inheriting from the control and overriding OnMouseDown. When that occurs, show your own context menu.
|
|
|
|
|
yeah, not much into soapbox thingie due to time and since I was not in MS technologies for long time so was not participating in other forums either
i am away from net for long time, could be take ma as DUMMY and give some rough example what do you mean by Overriding OnMouseDown?
I am actually tracking MouseUP event. When user clicks right button, I am setting control.contextMenu to my Context Menu at the location of Mouse clck(e.x,e.y)
I am surprised why the heck it shows disable Items?
|
|
|
|
|
Hi all,
How would one do the following over in C# ?
short unsigned int crc16(char *pBuf, short int Len, short int InitialCrc)
{
short unsigned int crc=0, i=0;
crc = 0;
for (i = 0; i < Len; i++ )
{
crc = (crc >> 8) | (crc << 8);
crc = crc ^ *pBuf;
crc = crc ^ ((crc & 0xff) >> 4);
crc = crc ^ (crc << 12);
crc = crc ^ ((crc & 0xff) << 5);
pBuf++;
}
return(crc);
}
Many Thanks in advance
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
I think this would be it:
ushort crc16(ref char pBuf, short Len, short InitialCrc)
{
int crc=0, i=0;
crc = 0;
for (i = 0; i < Len; i++ ) {
crc = (crc >> 8) | (crc << 8);
crc = crc ^ pBuf;
crc = crc ^ ((crc & 0xff) >> 4);
crc = crc ^ (crc << 12);
crc = crc ^ ((crc & 0xff) << 5);
pBuf++;
}
return((ushort)crc);
}
Everything stays the same, short unsigned int, becomes ushort. short int becoms short.
I changed crc to an int because whenever you did a bitwise operation, it came back as one, so you just change it back when you return it.
My current favourite word is: PIE!
Good ol' pie, it's been a while.
|
|
|
|
|
Does this article on CRC16 algorithm in C#[^] help?
For what it's worth, that code can almost be recompiled in C# since pointers and addressof operators are supported. If you wanted to port it with minimal impact, you might write something like this:
unsafe ushort crc16(char *pBuf, short int Len, short int initialCrc)
{
ushort crc = 0;
ushort i = 0;
for (i = 0; i < Len; i++ )
{
crc = (crc >> 8) | (crc << 8);
crc = crc ^ *pBuf;
crc = crc ^ ((crc & 0xff) >> 4);
crc = crc ^ (crc << 12);
crc = crc ^ ((crc & 0xff) << 5);
pBuf++;
}
return crc;
} That uses "unsafe" code (pointers, etc.) that can't be verified by the runtime. By the way, it appears initialCrc isn't used and could be removed.
|
|
|
|
|
|
A fact that the previous posters totally missed, is that a character is something completely different in .NET and C++. The equivalent of a char in C++ is a byte in .NET. If you try to calculate a crc16 checksum on a string you will not get the correct result, as characters in .NET are 16 bit values.
The code in C# would look something like this:
public static short CalculateCrc16(byte[] data) {
int crc = 0;
foreach (byte b in data) {
crc = (crc >> 8) | (crc << 8);
crc ^= b;
crc ^= (crc & 255) >> 4;
crc ^= crc << 12;
crc ^= (crc & 255) << 5;
}
return (short)crc;
}
Note: As the calculations are done in an int, some values might have to be masked down to a 16 bit value to correspond to the 16 bit operations used in the C++ code.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
Thanks to all ... I really appreciate it.
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Hi All
I have webapplication running at server1 with culture as en-US
and Webservice running at another server2 with culture nl-NL.Now I have problem updating and inserting Datatable with column datetime. I am updating SqlServer with sqlBulkCopy option.
Thanks
Navneet.H
Develop2Program & Program2Develop
|
|
|
|
|
I guess there are many things that could go wrong...
One is that you use DateTime.Now instead of DateTime.UtcNow which would be really bad if your servers are in different time zones.
Another are formatting problems (DD-MM-YYYY vs MM/DD/YYYY), you can fix this by specifying a fixed format, using CultureInfo.InvariantCulture or "Roundtrip" format.
|
|
|
|
|
Hi,
Does anyone know how to access the curently logged on user to Windows in C#?
I've heard there's an object somewhere in the WMI (Windows Management Instrumentation), is this the case?
Thanks,
Conor.
|
|
|
|
|
conor20 wrote: Does anyone know how to access the curently logged on user to Windows in C#?
What do you mean? Your subject and that sound like 2 different things Do you want to get the currently logged on user, and the domain?
public static string getCurrentUsernameAndDomain()
{
WindowsIdentity user = WindowsIdentity.GetCurrent();
return user.Name;
}
conor20 wrote: Subject:Re: Finding currently logged on user
That will "find" the current logged on user.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
|
Thanks guys.
I meant to get the user's name in/on the system.
It's to store session state information along with their username.
I have it now.
Thanks again,
Conor.
|
|
|
|
|
I've run into a problem...
I used
String username = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
to get the username. And this works fine when accessing the webpage if it's on my own computer but when I publish the site and access it from anywhere else, it returns “NT AUTHORITY\NETWORK SERVICE” for the username.
Is there any way to have this work for people accessing the site from somewhere else as well?
Thanks,
Conor.
|
|
|
|
|
Hi guys. I wonder if you could help me or point me in the right direction. I have a datagrid as part of my project. I however want to export the data from the datagrid to a csv file. Can anybody point me in the right direction or have any article i can read that would show me how to do this?
Much appreciated
|
|
|
|
|
|
i can help you but send to me what do you need exacly?
123
|
|
|
|
|
Hi,
I have a UserControl in which it has a TableLayoutPanel and the TableLayoutPanel contains some labels and buttons. When I change the Enabled property of the form that contains this UserControl on run-time, naturally the UserControl that is in it becomes disabled too. But, the forecolor of the labels that are contained within that UserControl's TableLayoutPanel change (they become gray) which is I do not want. I tried changing forecolors of the labels in EnableChanged event but didn't help. How can I specify a forecolor for a label when it becomes disabled?
|
|
|
|