|
These static functions will allow you to create byte[]s from the float[,]s and then convert them back.
<br />
using System;<br />
using System.Runtime.Serialization.Formatters.Binary;<br />
using System.IO;<br />
<br />
public class Utility<br />
{<br />
public static byte[] TwoDFloatArrayToByteArray(float[,] floats)<br />
{<br />
MemoryStream mem = new MemoryStream();<br />
<br />
BinaryFormatter bf = new BinaryFormatter();<br />
<br />
bf.Serialize(mem,floats);<br />
<br />
return mem.ToArray();<br />
}<br />
<br />
<br />
public static float[,] ByteArrayToTwoDFloatArray(byte[] bytes)<br />
{<br />
MemoryStream mem = new MemoryStream(bytes);<br />
<br />
BinaryFormatter bf = new BinaryFormatter();<br />
<br />
float[,] floats = (float[,])bf.Deserialize(mem);<br />
<br />
return floats;<br />
}<br />
}
I can't really help you with the TCP/IP problem. All I can say is "Compress those byte[]s before transmission!". 30 million floats is 120mb... Hope you have a fast connection.
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
Thank you very much, that looks like exactly what I was looking for.
Compression is definitely next on the todo list and should prove to be quite effective given the sparse nature of the data.
Deane
|
|
|
|
|
For a compression library, check out SharpZipLib[^]. This is an easy to use library and is very good using standard algorithms. It is completely written in C#.
Hope this helps,
Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
When I set create a new form and set the parent form for it, the ctrl-c ctrl-v shortcurt stop to work. If I don't set the parent it works fine.
What's happing?
Thanks...
|
|
|
|
|
1. I can't find the files "System.Text.RegularExpressions.dll" or "System.WinForms.dll"...May I ask if it is bundle with VS.NET or SDK itself?
2. May I ask if there is any Reference of Framework Class Library available to download, just like the API from java?? Since I want to develop my program with my notebook, but I didn't install any VS.NET at all.
Thank you very much for your attention.
Regards,
Riddler
|
|
|
|
|
- The namespace
System.Text.RegularExpressions is defined in system.dll ;
The WinForms namespace was renamed after an early beta. It is now called System.Windows.Forms , and is hosted in the file System.Windows.Forms.dll ; - Check out Lutz Roeder's Reflector: http://www.aisto.com/roeder/dotnet/[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
I am writing a windows forms applications with c#
i want the files saved by application with a certain extension be opened by my program i.e. When user double click file , my program executes certain code like open , add to zip actions
I want to know how to add code to program that function
knowing that i am using a setup program to register my file types
All what i get that my application is called ,but the function i mentioned int the verb property is not called
thanks
Wella
|
|
|
|
|
you will probally need to work with The Environment.GetCommandLineArgs();
command....this is a exsample from my program..it may work for you maybe not. if you want more help or questions about this code...(i tryed to mark it atleast kinda clear) email me at res1s5yd@verizon.net
oh and too set up your program too load as the default for that specific file typ try looking in HKEY_CLASSES_ROOT in the registry.... goto txtfile for a hint.
jesse M
<br />
<br />
String[] arguments = Environment.GetCommandLineArgs();<br />
int count =0;<br />
foreach(string jr2 in Environment.GetCommandLineArgs()){ <br />
count++;<br />
string ComandArgs = jr2.ToLower();<br />
int[] jr = new int[]{1};<br />
try{<br />
if(count !=1){<br />
<br />
switch(ComandArgs.Replace("-","")){<br />
<br />
case "fullscreen":<br />
FullScreenFlag=1;<br />
break;<br />
case "min":<br />
FullScreenFlag= -1;<br />
break;<br />
<br />
default:<br />
if(File.Exists(ComandArgs.Replace("-","")))
{<br />
LoadFileOnStart = ComandArgs.Replace("-","");<br />
break;<br />
}<br />
MessageBox.Show("Invalid CommandLine Arguments..\n\nYou Wrote : "+ComandArgs.Replace("-","")+"\n\nValid Command line Arguments are : \"fullscreen\" To Load FullScreen on startup, \"dcheck\" To Disable Registry Check on Startup, \"min\", To run program minmized. \nSpace is required after each Paremeter","Invalid Paremeters",0,MessageBoxIcon.Warning);<br />
<br />
before my program load's i added the following code to adjust acording too the command like args
<br />
switch(FullScreenFlag){<br />
case 1:<br />
this.WindowState=FormWindowState.Maximized;<br />
break;<br />
case -1:<br />
<br />
this.WindowState= FormWindowState.Minimized;<br />
break;<br />
case 0:<br />
break;<br />
}<br />
hope...it helped a little......
|
|
|
|
|
Hi,
how do I set the mouse position to a given x and y-position? This should work over the whole screen, not only in the application client area.
Example: Current mouse position is (10,10). Clicking a button at this position will make the mouse pointer move to (700,300).
bye,
ahpex
|
|
|
|
|
Cursor.Position sets it in relation to the screen.
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
hi every one..........
i want some one to help me how could i call DLL file in my C# program......
plzzz.......in detail cause iam new to C#.....
thx
Islam Is The Only Solution
|
|
|
|
|
mo7amed wrote:
i want some one to help me how could i call DLL file in my C# program......
Assuming you are refering to a Win32 .dll, you need to use the [DllImport] arttribute and define the function call within your code:
[DllImport("user32")]
public static extern int MessageBox(int hWnd,
String pText ,
String pCaption ,
int uType);
If you are refering to a .NET assembly .dll you will need to reference it in your project.
Nick Parker
You see the Standards change. - Fellow co-worker
|
|
|
|
|
Hi Nick .
Thks .. Actually, by referencing it works fine in a C# application. However, I do have one strange problem .
When I put it in a web service it fails. I'm not sure why. I can see all the methods in intellisense. But my first function call ALWAYS returns NULL....I assumed if it worked in my C# app it would work in a service as well ..
Any ideas ??
Note: This is a DLL(COM) that was meant to be called from VB6.
|
|
|
|
|
I'm putting in a reference to a COM obj in my C# program. This DLL was originally written for VB programmers to reference in VB6 apps. I realize that this DLL is "unmanged" code.
What are the repercussions of running unmanaged code ?
Are there any ?
Is there a way to make it managed ???
Thks in advance .
|
|
|
|
|
What does the component do? Can it be easily written in C#? When making calls, the parameters and the returning result will have to be Marshalled to a fro, I suppose it depends on what the component does as to whether or not you will see a difference.
Nick Parker
You see the Standards change. - Fellow co-worker
|
|
|
|
|
Does the built in wndproc in windows forms get all messages as it should , or are some messages removed / modified before / after the one handle the message ?
im trying to make a custom caption here , and it works quite nice , but i have a major problem , as soon as i click the caption bar , windows draws its default min/max/close buttons over my custom gfx.
should it do this? , or is it .net that is messing with the drawing code?
and what decides the position of the mainmenu on a form?
i know the menu could be relocated coz other skinning apps do this , so how is it done?
do i have to resort to ownerdrawing on the menues?
and also , what messages are responsible for answering to the animate window api?
coz when i doubleclick the caption , the window is maximized and animated , and at that time the window uses the standard windows caption , my custom caption drawing code is not called (it is located under the wm_ncpaint , and obviously that message is not sent to the window when animating)
//Roger
|
|
|
|
|
WndProc() does not get all messages. Like with MFC, PreProcessMessage() handles everything from the message loop, and only dispatches whatever is deemed necessary, to WndProc(). I have had to override PreProcessMessage() to do more fundamental window manipulation.
Also, apparently for convenience, you can call a windowed control/form's SetStyle() method with ControlStyles.EnableNotifyMessage set to true, so you can catch the WndProc messages in OnNotifyMessage(). However, it won't catch anything WndProc doesn't already get.
As for custom window styles and extended styles (WS_* and WS_EX_* stuff), which are not to be confused with control/class styles (what GetStyle() and SetStyle() deal with), you need to override the CreateParams property, and set your styles there. There is an example on the CreateParams help page.
In general, you will have to do a lot of custom drawing to achieve what you are trying to do. Main menus are normally automatically placed right below the caption, and displace the client area downwards, so you will have to roll your own. Hope some of this helps.
Cheers
|
|
|
|
|
I heared that vb.net code converted to c#.net then to
microsoft intermediate language, is this correct?
|
|
|
|
|
no, it goes direct to msil.
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Hello
Well i am new to C# and dont know much about it. i designed a form and tried to call it on menuitem. when i click menu item for very first time, the forms appears, but once i have closed the form and try to reclick the menu item again the error message occurs
" An unhandled exception of 'System.ObjectDisposedException' occurred in system.windows.forms.dll
Additional information: Cannot access a disposed object named "Emp"".
plz guide me in this regards
Arkr
|
|
|
|
|
Can you post the code for "menuitem" click?
Sounds like the variable is getting garbage collected between the first and second uses.
Cheers,
Simon
"The day I swan around in expensive suits is the day I hope someone puts a bullet in my head.", Chris Carter.
animation mechanics in SVG
|
|
|
|
|
Suppose EMP is the form, which i want to be appeared when menuitem is clicked, i simply create the instance of the Emp class
private Emp emp = new Emp();
and call
private void menuItem_Click (object sender, System.EventArgs e)
{ emp.Show();
}
Is it OK?
|
|
|
|
|
That should be fine.
This way, you'll have access to public methods/members of the Emp form variable.
You can also control when it should close/hide.
Cheers,
Simon
"The day I swan around in expensive suits is the day I hope someone puts a bullet in my head.", Chris Carter.
animation mechanics in SVG
|
|
|
|
|
Hello,
I am a begginer in c#. I have one textbox. In this textbox user can enter any kind of data in xml format. The xml file format can be any type. What is the simple procudure to validate the xml file entered by user. what is the easy procudure to write simple xml editor(if user types open tag it should automically display close tag) using c#.
thanks in advance,
chito
|
|
|
|
|
Does someone knows how to load a PCX Image with a library or something else?
Trully, if there evil in this world, It lies within the heard of mankind
Shock The Dark Mage
shock@romhack.net
Main Project: Aeru IRC - http://www.sf.net/projects/aeruirc
|
|
|
|