|
I got the help from MSDN that ViewPort3D could solve it
But I don't know how to code it
not in a WPF Project
I want to Display it in a WindowsFormsApplication Project
(in the Form1)
If display a 2DWPF I knew that DraingVisual could deal it in WFA
but How to display a 3D(WPF)?
thanks to all assistants!
This is my first question here,
and I am a new learner
Please excuse me for any faults.
|
|
|
|
|
Message Closed
modified 23-Nov-14 7:14am.
|
|
|
|
|
Thank you verry much,
and especially thanks for your introduction of the "online MSDN"
I solved it!
|
|
|
|
|
Hey,
I have a nullable 2d Double array which I want to convert to a non nullable 2d Double array. Is there any sane way of doing this?
Cheers!
Jeroen De Dauw
---
Forums ; Blog ; Wiki
---
70 72 6F 67 72 61 6D 6D 69 6E 67 20 34 20 6C 69 66 65!
|
|
|
|
|
By nullable 2d array, I presume you mean an array containing double?s.
So you want to convert double?[] to double[]... What happens if there is a null in there then?
Regards,
Rob Philpott.
|
|
|
|
|
At the point where I want to convert from nullable to non nullable, there are no null values.
I indeed mean Double?[,];
Jeroen De Dauw
---
Forums ; Blog ; Wiki
---
70 72 6F 67 72 61 6D 6D 69 6E 67 20 34 20 6C 69 66 65!
|
|
|
|
|
var nullableDoubles = new double?[2][];
nullableDoubles[1] = new double?[]{null, 1.1, null, 1.2};
double[][] nonNullableDoubles = nullableDoubles.Select(doubleArray=>{
if(doubleArray==null)
return null;
else
return doubleArray.Where(doubleValue => doubleValue.HasValue).Cast<double>().ToArray();}).ToArray();
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Hey,
Since I'm getting an error saying that 'double?[*,*]' does not contain a definition for 'select', I'm assuming I need to import some namespace. Which one?
Cheers!
Jeroen De Dauw
---
Forums ; Blog ; Wiki
---
70 72 6F 67 72 61 6D 6D 69 6E 67 20 34 20 6C 69 66 65!
|
|
|
|
|
System.Linq
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
I'm trying to draw a PNG (with transparency) onto the screen above everything else but finding it difficult as I can only draw on forms and they are limited to a single transparent color... is there any way to draw directly on the screen's device above everything else or to make the window use a mask or something?
|
|
|
|
|
|
Hi I'm trying to program a wrapper class in C# for an unmanaged C DLL. The DLL contains a function that allows you to register a callback function so i call the register callback function and pass in my callback function, now when i call a function that uses that callback in the DLL, the function only calls it once and then my program just crashes it comes back with "ConsoleApplication1.exe has encountered a problem and needs to close. We are sorry for the inconvenience" message, the callback function only gets called once, this shouldn't happen, could this be because the garbage collector is disposing my callback function object or something ? how do i solve this problem?
Thanks.
|
|
|
|
|
We need to see the relavent code (particularly the API function C declaration, your C# implementation of it and your delegate declaration) to figure out what's going on
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
ok.
[DllImport("ProSdk.dll", EntryPoint = "RegisterStreamDirectReadCallback", CharSet = CharSet.Unicode)]
private static extern int _RegisterStreamDirectReadCallback(stream_direct_read_callback streamReadCallback, IntPtr context);
...
public delegate void stream_direct_read_callback(int channelNum, Byte[] dataBuf, UInt32 length, int frameType, IntPtr context);
...
public void stream_read_callback(int channelNum, Byte[] dataBuf, UInt32 length, int frameType, IntPtr context)
{
System.Console.WriteLine(channelNum+" channel callback func called");
}
...
stream_direct_read_callback str = new stream_direct_read_callback(stream_read_callback);
_RegisterStreamReadCallback(str, IntPtr.Zero);
is that enough information, i can give you a link to the api documentation for the dll if you want?
|
|
|
|
|
I would guess your definition of the delegate does not match what the unmanaged function expects (number of parameters, return value, calling convention), so stack gets corrupted when your callback function is called.
Unmanaged signature:
typedef int (*STREAM_DIRECT_READ_CALLBACK)(ULONG channelNumber,void
*DataBuf,DWORD Length,int FrameType,void *context);
Your code:
public delegate void stream_direct_read_callback(int channelNum, Byte[] dataBuf, UInt32 length, int frameType, IntPtr context);
You used byte[] where the unmanaged code used void*. AFAIK the marshaller will automatically convert byte[] to void*, but NOT in the other direction as needed for callbacks. Moreover, the callback seems to be using the default calling convention (C-decl), not __stdcall as the .NET marshaller expects normally.
I would try changing the delegate signature to:
using System.Runtime.InteropServices;
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate int stream_direct_read_callback(int channelNum, IntPtr dataBuf, UInt32 length, int frameType, IntPtr context);
|
|
|
|
|
thanks that worked. So the C DLL was using the C-decl calling convention then ? because i thought it was using stdcall calling convetion. So that code you put above the delegate [UnmanagedFunctionPointer(CallingConvention.Cdecl)] converts it from stdcall to C-decl then?
|
|
|
|
|
I have searched the Internet and found sites that say this is possible, and others that say it is not possible. I am wondering if anyone has done it, or know a specific reason why it is not possible. This is a UI widget that we wish to make available to customers that are using an ActiveX container on Windows CE 4.2. They do not have the .Net Compact Frmaework install, but I am confident we can resolve that issue. I do not want to spend time on this if in the end it is not possible to host a .Net UI Widget within an ActiveX wrapper on Windows CE. I have read that the hosting API does not exist on CE and therefore this will not work. I am unclear what the Hosting API is, and why this means that I cannot have a COM callable wrapper for my .Net component on CE.
Tanks for your support
Pat O
<a href="http://currentchaos.blogspot.com/">Blog</a>
_ _ _
|
|
|
|
|
If you've found conflicting answers, be a programmer and try it yourself. Short of that, go to the best authority - MSDN - and ask your question there.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
|
O MGW FT
CCC solved so far: 2 (including a Hard One!)
37!?!! - Randall, Clerks
|
|
|
|
|
|
|
hi coders
i have a problem about my codes
let me tell the scenario first...i have two Forms(frm1 and frm2)...i opened frm2 by clicking a button on frm1..there is no problem till here...i want to save informations by filling the blanks on frm2 and save it but when i click save button there is nothing happen..here are my codes.. i couldnt see anything wrong in my connection or in my insert command...i need help about it
try
{
con = new SqlConnection("data source=Erdal2\\SQLEXPRESS;initial catalog=Medya;integrated security=true");
cmd = new SqlCommand("insert into Rehber (ad,soyad,firma,sektor,grup,cep_no,is_no,ev_no,fax,mail,web,msn,skype,dgm_tarih,adres,ilce,sehir,vergi_no,vrgi_daire) values (@ad,@soyad,@firma,@sektor,@grup,@cep_no,@is_no,@ev_no,@fax,@mail,@web,@msn,@skype,@dgm_tarih,@adres,@ilce,@sehir,@vergi_no,@vrgi_daire)", con);
con.Open();
cmd.Parameters.Add("@ad", SqlDbType.NVarChar).Value = txtAd.Text;
cmd.Parameters.Add("@soyad", SqlDbType.NVarChar).Value = txtSoyad.Text;
cmd.Parameters.Add("@firma", SqlDbType.NVarChar).Value = cmbFirma.SelectedItem;
cmd.Parameters.Add("@sektor", SqlDbType.NVarChar).Value = cmbSektor.SelectedItem;
cmd.Parameters.Add("@grup", SqlDbType.NVarChar).Value = txtGrup.Text;
cmd.Parameters.Add("@cep_no", SqlDbType.NVarChar).Value = txtCep.Text;
cmd.Parameters.Add("@is_no", SqlDbType.NVarChar).Value = txtisTlf.Text;
cmd.Parameters.Add("@ev_no", SqlDbType.NVarChar).Value = txtEvTlf.Text;
cmd.Parameters.Add("@fax", SqlDbType.NVarChar).Value = txtFax.Text;
cmd.Parameters.Add("@mail", SqlDbType.NVarChar).Value = txtMail.Text;
cmd.Parameters.Add("@web", SqlDbType.NVarChar).Value = txtURL.Text;
cmd.Parameters.Add("@msn", SqlDbType.NVarChar).Value = txtMSn.Text;
cmd.Parameters.Add("@skype", SqlDbType.NVarChar).Value = txtSkype.Text;
cmd.Parameters.Add("@dgm_tarih", SqlDbType.SmallDateTime).Value = dateTimePicker1.Value;
cmd.Parameters.Add("@adres", SqlDbType.NVarChar).Value = txtAdres.Text;
cmd.Parameters.Add("@ilce", SqlDbType.NVarChar).Value = txtIlce.Text;
cmd.Parameters.Add("@sehir", SqlDbType.NVarChar).Value = txtSehir.Text;
cmd.Parameters.Add("@vergi_no", SqlDbType.NVarChar).Value = txtVergiNo.Text;
cmd.Parameters.Add("@vrgi_daire", SqlDbType.NVarChar).Value = txtVergiDaire.Text;
if ((txtAd.Text != "") || (txtSoyad.Text != ""))
{
if (cmd.ExecuteNonQuery() == 1)
MessageBox.Show("Done", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
else
MessageBox.Show("Error during saving processes","Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
MessageBox.Show("There must be name and surname entered","warning",MessageBoxButtons.OK,MessageBoxIcon.Error);
i declared con and cmd as global variables...
|
|
|
|
|
If nothing at all is happening, then either it is not executing any of your code - place a breakpoint or MessageBox.Show before the "try" to check that - or it has an error and is going to your catch block - which you haven't shown.
BTW:
if ((txtAd.Text != "") || (txtSoyad.Text != "")) does not check that both name and surname are provided - you need "&&" not "||". Your error message implies both are required.
All those who believe in psycho kinesis, raise my hand.
|
|
|
|
|
hii man thanks for your reply
i tried to understand about my mistake by using breakpoint
it doesnt drop in if block..i mean the block below
if ((txtAd.Text != "") && (txtSoyad.Text != ""))
{
if (cmd.ExecuteNonQuery() == 1)
MessageBox.Show("Ekleme İşlemi Tamamlandı", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning);
else
MessageBox.Show("Ekleme Sırasında Hata Oluştu","Dikkat", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
MessageBox.Show("İsim ve Soyisim Giriniz","Dikkat",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
it leaves the if control when it comes to ExecuteNonQuery() line and goes catch block.. here is my catch and finally block
catch (Exception)
{
if (((txtisTlf.Text.Length) + (txtKod.Text.Length)) > 20 || ((txtCep.Text.Length) + (txtCepKod.Text.Length)) > 20 || ((txtEvKod.Text.Length) + (txtEvTlf.Text.Length)) > 20 ||(txtFax.Text.Length) > 20)
MessageBox.Show("İş Telefonu,Cep Telefonu,Ev Telefonu,Fax No Alanları 20 Karakterden Fazla Olamaz", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
con.Close();
}
|
|
|
|
|