|
Why try it when you can ask here instead ? :P
I would feel sure if no path is given, it will use the working directory.
Christian Graus
Driven to the arms of OSX by Vista.
"Iam doing the browsing center project in vb.net using c# coding" - this is why I don't answer questions much anymore. Oh, and Microsoft doesn't want me to.
|
|
|
|
|
got it to somewhat work
"{System.Net.WebException: An exception occurred during a WebClient request. ---> System.UnauthorizedAccessException: Access to the path..." is an error i get now.
code being used
public Download(string URL1)
{
Url = URL1;
WebClient client = new WebClient();
string[] s;
s = Url.Split(new Char[] { '/' });
string l;
l = @System.IO.Directory.GetCurrentDirectory();
l = l + s[1];
client.DownloadFile(Url,l);
}
i *had* to specify path, and also use http://
|
|
|
|
|
got it working, sorry about that
|
|
|
|
|
Hello,
How do I convert from points (font) to world coordinates?
When I create a font as such: var font = new Font(family, size, style, GraphicsUnit.World),
it seems like font.Size is exactly 3/4 of font.SizeInPoints. Is this a constant, or does it depend on something else?
I thought world coordinates were like pixels, but I haven't supplied any dpi information to the font constructor. Does it default to 96? 96/72 = 4/3, as would be the case if I wanted to convert points to pixels.
Please help! This is all very confusing. I need this to create a string shaped GraphicsPath, and then draw it onto a Graphics.
|
|
|
|
|
Hi,
I don't know and never had a need to know either. Are you aware of Graphics.MeasureString()?
it calculates the size a Graphics.DrawString() action would require.
|
|
|
|
|
I have not said anything about measuring strings.
|
|
|
|
|
Hello,
I have an application that reads XML files containing coordinates of text and graphics objects (lines, arrows, etc...). The coordinates are in units equal to (font height) / 8. In my override of Control.OnPaint(), I include a line like this to change the PageScale property of the Graphics object passed in to the function.
float font_height = Font.GetHeight(e.Graphics);
e.Graphics.PageScale = font_height / 8;
This works as expected in that Graphics.PageScale is set to approximately 2.8 and all of the calls to the drawing and text ends up at the coordinates read from the XML files multiplied by 2.8.
The problem is in my override of OnMouseMove. I need to change the color of these lines and text as the user passes the mouse over them. Since there is not a Graphics object passed into OnMouseMove I create one using Control.CreateGraphics(). The problem is that even though I change the PageScale property to the same value as in OnPaint, the drawing functions do not recognize the new scaling factor. In the debugger I can see that the value of PageScale has been successfully changed.
Has anyone run into this problem or am I doing something wrong?
Thanks.
|
|
|
|
|
CreateGraphics is probably fine to use in a mouse event, as you don't want what is drawn to persist, but I tend to stick to calling Invalidate() to force a paint event.
Christian Graus
Driven to the arms of OSX by Vista.
"Iam doing the browsing center project in vb.net using c# coding" - this is why I don't answer questions much anymore. Oh, and Microsoft doesn't want me to.
|
|
|
|
|
I've a third party DLL that exports this function:
typedef UCHAR (__cdecl *RESPONSE_FUNC)(UCHAR eventID);
__declspec(dllimport) void SetCallback(RESPONSE_FUNC pfResponse, UCHAR* responseBuffer);
I must allocate the buffer, call the SetCallback function, and read the modified data when the callback function is called.
I tried with this code:
static byte[] responseBuffer = new byte[10];
delegate bool RESPONSE_FUNC(byte eventID);
[DllImport("mydll.dll", CallingConvention=CallingConvention.Cdecl)]
private static extern void ANT_SetCallback (RESPONSE_FUNC callback, byte[] responseBuffer);
public void test
{
ANT_SetCallback (EventCallback, responseBuffer);
}
static bool EventCallback(byte eventID)
{
return true;
}
When the dll doesn't try to modify the buffer then the Callback function is called without errors(the first event doesn't access the buffer).
But when the DLL tries to modify the data in the buffer, the program crashes with a 0xc0000409 exception.
I'm stuck on this, any suggestion ?
modified on Sunday, November 9, 2008 1:01 PM
|
|
|
|
|
This
typedef UCHAR (__cdecl *RESPONSE_FUNC)(UCHAR eventID);
should be
typedef UCHAR (<code>__stdcall</code> *RESPONSE_FUNC)(UCHAR eventID);
Also, make sure you pass a buffer large enough to accomodate whatever
writing the DLL is doing in it
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: This
typedef UCHAR (__cdecl *RESPONSE_FUNC)(UCHAR eventID);
should be
typedef UCHAR (__stdcall *RESPONSE_FUNC)(UCHAR eventID);
It's a third party library, I'm not able to change it
And yes, I'm sure the buffer is bigh enough... it should be 3 bytes, I'm passing 10
|
|
|
|
|
Paolo Vernazza wrote: I'm not able to change it
Oops, sorry.
On the C# side...
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate bool RESPONSE_FUNC(byte eventID);
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
hi evryone
how can i send text from my C# program to external program ?
i need to send text where the cursor is at this moment
than'k alot for any help
|
|
|
|
|
What do you mean by sending text? If you want to send a message you can P/Invoke SendMessage() function. If you mean interprocess communication, than you can use pipes or remoting.
|
|
|
|
|
i'll try to explane
i have my program, i need to send text from my program to any open
program (word for example) where the cursor is blinking
how can i send my text to external open program in the cursor position
than'k alot
|
|
|
|
|
|
Process.StandardInput -> MSDN
|
|
|
|
|
Haha! Yeah, I like that one! Process.StandardInput -> MSDN
Nice...
|
|
|
|
|
what's the different when we run an application with .exe file and debug mode?
thanks
|
|
|
|
|
That's a very wide question. Are you looking for the internals of how the debugger hooks up the executable, the difference in performance for the application or what you do to accomplish debugging?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
i meant the difference in performance?
Do they give the same errors?....
|
|
|
|
|
Code compiled in debug mode contains a lot of extra NOP (no operation) instructions, so that there is always at least one instruction per source code line, in order for the debugger to be able to place a breakpoint on any line.
The compiler doesn't optimize the code by rearranging any instructions when compiling for debug mode, so that the compiled code exactly resembles the source code, in order to be able to single step through the code.
Exceptions takes a lot more time to handle when the code runs in debug mode.
The garbage collector works differently in debug mode, expanding the usage of variables to their entire scope, so that you can view the values of the variables in the debugger as long as they are in scope, even if the object is actually unused and could have been collected.
As the compiled code differs slightly, any race conditions or other timing problems that exist in your code may only occur in debug mode or only in release mode.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi..
How to find parent's child in matrix (in maze)?
please more describtion for me...!
thanks..
|
|
|
|
|
What the hell are you talking about ?
Christian Graus
Driven to the arms of OSX by Vista.
"Iam doing the browsing center project in vb.net using c# coding" - this is why I don't answer questions much anymore. Oh, and Microsoft doesn't want me to.
|
|
|
|