|
Visual Studio .NET uses bit of next level keyboard shortcut keys like KeyChord Sequences CTRL+K, CTRL \ etc.
I have a couple of questions thereto:
(*) In our Windows Forms too, is it possible to implement it by using Keyboard accelerator style itself or is it a Custom Key Press listener?
(*) Can this be used as a Global Shortcut key?
I think KeyChord Sequences would be definitely be a very unique key sequence to maintain keboard shortcuts for the applications.
Please advise...
Vasudevan Deepak Kumar
Personal Web: http://www.lavanyadeepak.tk/
I Blog At: http://deepak.blogdrive.com/
|
|
|
|
|
Hi,
This sounds really crazy but a simple "for" instruction doesn't work in none of my programs.
The bucle is as follow:
for (int i = 0; i == 5; i++)
{
MessageBox.Show("Hello " + i);
}
I've tried this simple piece of code in every function i have, it compiles fine but at runtime it never get into the loop.
I'll try to reinstall the .NET FrameWork, reboot my PC, whatever. It's so simple but now it don't work. What could be possible wrong?
Thanx,
Heinz
|
|
|
|
|
The for-loop isn't entered, cause its condition (i==5) is never fulfilled.
Try i < 5 or i <= 5 .
www.troschuetz.de
|
|
|
|
|
Hello
Please Solve my Problem
I have added an image using Transperency mode to Overlap two images. I got perfectly. But how can I resize that image? If i resize it the transperency is disappearing it is not resizing. Please help me in this
regards
dhanunjay
|
|
|
|
|
I would like to declare the following structures in C# and be able to utilize the Marshal.StructureToPtr() and Marshal.PtrToStructure() on these structures and pointers later on. The reason being that I need structures that can be used for UDP packets that can be filled, sent, received, and later unpacked in the correct order.
In C++, these structures can be somewhat complex due to nested structures.
However, the example below is a very simple C++ nested structure with an attempted C# conversion. In the C#, I have only one query and that can be seen at the very end when transposing the last structure ie IDENTIFIER_T id[12];
Does anyone know a simple way to convert these simple structures to C#????
C++
typedef struct {
int source;
int destination;
int message;
}HEADER_T;
typedef struct {
double X;
double Y;
double Z;
}VECTOR_T;
typedef struct {
int id;
char[32] IdName;
int nameHashId;
}IDENTIFIER_T;
typedef struct {
int id;
char[64] dataName;
HEADER_T header;
VECTOR_T position;
IDENTIFIER_T id[12];
char[128] spare;
}DATA_T;
Attempted C# Equivalent
[ StructureLayout ( LayoutKind.Sequential ) ]
public struct HEADER_T {
int source;
int destination;
int message;
};
[ StructureLayout ( LayoutKind.Sequential ) ]
public struct VECTOR_T {
double X;
double Y;
double Z;
};
[ StructureLayout ( LayoutKind.Sequential ) ]
public class IDENTIFIER_T {
int id;
[ MarshalAs(UnmanagedType.ByValTStr, SizeConst=32 ]
string IdName;
int nameHashId;
};
public class DATA_T {
int id;
[ MarshalAs(UnmanagedType.ByValTStr, SizeConst=64 ]
string dataName;
HEADER_T header;
VECTOR_T position;
// ????? What happens here????
IDENTIFIER_T id[12];
[ MarshalAs(UnmanagedType.ByValTStr, SizeConst=128 ]
string spare;
};
Rob
-- modified at 1:04 Tuesday 6th September, 2005
|
|
|
|
|
|
Thanks but unfortunately the [MarshalAs(UnmanagedType.ByValArray , SizeConst=12)]will not work.
It compiles ok but will cause a runtime error because the MarshalAs can't determine the size of the structure.
SizeConst can only be specified for fundamental types and not for an array of structures.
-- modified at 19:50 Wednesday 7th September, 2005
|
|
|
|
|
|
Hi,
I have a C# .NET framework 2.0 application that draws a bunch of lines and shapes by creating a Pen and a Graphics object and drawing the "art" onto a PictureBox.
Does anyone know how to save or export the drawn image as a bitmap or a jpeg?
This newbie would really appreciate some help with this question!
Thanks
|
|
|
|
|
Hello
Image image;
image.Save("image.bmp", ImageFormat.Bmp);
image.Save("image.jpg", ImageFormat.Jpeg);
Andrew
|
|
|
|
|
Thanks for the quick response! However, I still can't get it to work. Here's my code:
<br />
Pen myPen;<br />
Graphics g;<br />
myPen = new Pen(System.Drawing.Color.Red, 1);<br />
g = pictureBox1.CreateGraphics();<br />
<br />
g.DrawLine(myPen,1,1,30,30);
<br />
Image image;<br />
image = pictureBox1.Image;<br />
image.Save(@"C:\image.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
I get a NullReferenceExcetion was unhandled error. I'm not sure what that means...
Thanks much, Tim
|
|
|
|
|
Hello
Yes, it will fail. Because you did not initialize Image property of your picter box. If you need to save your drawing, you can use the next code:
Bitmap image = new Bitmap(100, 100);
Pen myPen = new Pen(System.Drawing.Color.Red, 1);
Graphics g = Graphics.FromImage(image);
g.DrawLine(myPen,1,1,30,30);
myPen.Dispose();
g.Dispose();
image.Save(@"C:\image.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
pictureBox1.Image = image;
Andrew
|
|
|
|
|
THANKS MUCH, ANDREW
|
|
|
|
|
I am developing a drawing tool and make Panel as drawing area. I set Autoscroll of the panel true in case that the drawing may be large. But
why the stroll does not appeat automatically?
How can I attach a scroll manually and when you drag the scroll, different part of the drawing apears in the drawing area.
Many thanks!
Radic
|
|
|
|
|
I am calling the Quit() method of the Word Object but sometimes I get an error saying a Dialog is still active. Anybody know how I can tell if a Dialog is still active before I call Quit()
notsnoj
|
|
|
|
|
i need to create some nunit tests for a method, but here's the problem.
i have an object InternalUser it has a method Authenticate(), this one fires events depending on authentication is successful or not.
public InternalUser Authenticate(string userName, string password)
{
Events.PreAuthentication(userName, password, State.PreAuthentication);
...more stuff here...
}
in events class
public static void PreAuthentication(...)
{
Application.Instance().ExecutePreAuthentication(...);
}
in application class
internal static Application Instance()
{
in here i use HttpContext so nunit fails saying no context here.
}
ihave other methods that do the same, but i cant create tests for these because nunit says no context available, any ideas on how i can get around this problem?
thanks
|
|
|
|
|
There isn't an HttpContext beccause you aren't running in asp.net. I've been thinking about modifing one of my articles to allow testing like this. Would you be interested?
For a quick fix, is there any way to mimic the calls you make to HttpContext if it is null? Ie. add code if (HttpContext.Current == null) //etc. If not, another short term solution is to use something like nunitasp.
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|
|
yeah id be very interested, i could change it to work without HttpContext.
i cant use nunitasp because the frontend pages havent been created yet.
|
|
|
|
|
after looking around google i found this
http://www.biasecurities.com/blogs/jim/archive/2005/08/11/2058.aspx, works like a charm
|
|
|
|
|
My C# app needs to call a C++ SDK ( for controlling a digital camera ). I started writing a MC++ dll to wrap it, but I've come unstuck. The SDK uses function pointers, and when I tried to put those in the MC++ app, they would not compile, because everything was garbage collected. __nogc on the class just caused new errors. I also tried building a standard C++ DLL and pInvoking it, but my early attempts were not successful. I'm thinking the third option is COM, however I want to pass Bitmap objects into C#, and also I need to pass a HWND from C# to the dll, for it to draw an image preview on to.
What's the best way for me to go about this ? Is there a way around the MC++ problem ? It seems the best idea to me, but as I've come to a problem, I'm stopping to re-evaluate my approach...
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote:
The SDK uses function pointers, and when I tried to put those in the MC++ app, they would not compile, because everything was garbage collected. __nogc on the class just caused new errors.
Compile all unmanaged code as unmanaged, without /clr. But its weird you say it cant deal with function pointers. What errors are you getting?
xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots
|
|
|
|
|
leppie wrote:
Compile all unmanaged code as unmanaged, without /clr.
How do I then call it from C# ? Where does the MC++ code go into it ?
I get errors like this :
d:\Contract Work\Fotovision\Imaging\Imaging.cpp(121): error C2664: 'CDStartViewfinder' : cannot convert parameter 3 from 'cdUInt32 (cdVoid *,cdUInt32,cdUInt32,cdContext)' to 'cdViewFinderCallbackFunction (__stdcall *)'
d:\Contract Work\Fotovision\Imaging\Imaging.cpp(136): error C2440: 'type cast' : cannot convert from 'LPVOID' to 'Imaging::Canon __gc *'
The second was for passing this into a function.
If I put __nogc on the class, I get this:
d:\Contract Work\Fotovision\Imaging\Imaging.h(22): error C3381: 'Imaging::Canon' : an assembly access specifier can only be applied to a managed type
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I am displaying all members of class Test:
Type ClassType = typeof(Test);
MemberInfo[] Members = ClassType.GetMembers();
foreach(MemberInfo Member in Members)
{
Writer.WriteLine("<" + Member.Name + ">" + <big>???</big>));
}
and I would like also to display in the same foreach loop values of these members of given object Test. How to make it?
|
|
|
|
|
Make the function recursive, and keep calling it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I cannot see a difference... I must display a value of a member, but this member is different each time.
|
|
|
|
|