|
Hi Saiyed,
Try this in your app.
Set the KeyPreview property of the main form to true and also set a KeyDown event handler for the main form.
With these two elements in place, the main form key handler will see all keys destined for any child control on the form so it will not matter which control has focus when the user presses Ctrl + S.
You can then test specifically for Ctrl + S as shown in the code fragment.
private void MainForm_KeyDown(object sender, KeyEventArgs e) {
if (e.KeyData == (Keys.Control | Keys.S)) {
MessageBox.Show("Key trapped" + Environment.NewLine +
e.KeyData.ToString());
e.SuppressKeyPress = true;
}
}
Just insert your save method in place of the message box code.
Alan.
|
|
|
|
|
Thank u so much Alan. It did work and it was great.Hope to know many more from u in future.
Johnny
|
|
|
|
|
How would i go about changing values in pixels in an area? Note, all pixels will have the same value.
I was thinking of using unsafe code to visit every single pixel in that area, but that may be too slow if i do this multiple time.
|
|
|
|
|
YOU CAN USE SetPixel()
Bitmap bitmap = new Bitmap(@"C://1.bmp");
Color newColor = Color.FromArgb(0, 0,100);
bitmap.SetPixel(i, j, newColor);
Vikas Amin
My First Article on CP" Virtual Serial Port "[^]
modified on Thursday, July 24, 2008 5:33 PM
|
|
|
|
|
What's an "area"?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
That's IT! I'm going to lunch!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
You have two "easy" options:
* http://msdn.microsoft.com/en-us/library/system.drawing.graphics.fillrectangle.aspx[^]
* directly accessing the pixels via an unmanaged pointer in an unsafe block
I suggest you try both methods and see which one is faster.
The fastest approach would probably be to set up a DirectX graphics device and render the area using a custom pixel shader. Depending on your needs this might be a bit overkill, though.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I set a specific value of intensity (for greyscale) or color within that region so fillrectangle is out of the question. So i guess unsafe is the way to go.
As far as DirectX goes, I have no idea how to set it up.
To answer the question above, an "area" is considered a portion of an image. Hence an area or region.
|
|
|
|
|
Can you express this area as a Region (System.Drawing)?
If so can you create a Region from the image and use
Graphics.FillRegion()?
gigahertz205 wrote: I set a specific value of intensity (for greyscale) or color within that region so fillrectangle is out of the question.
What do you mean by that? Your original post stated all the
pixels in the area will be the same color. You can use any color
brush you want to with FillRectangle()
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
1.creat a new bitmap (with new color)
2.put the new bitmap on you want area using GDI+
|
|
|
|
|
u can make a new bitmap with u want color
and put it on your want change area using GDI+
|
|
|
|
|
Hi guys, I am looking for application that looks a like PowerPoint. Bascially, it should be able to show you the view on the left while the clip objects are being edited like moving on the stage. I searched on CP but they are either reading from the app or writing in the power point. Can somebody provide me a link to a useful resource to get started.
Thanks
|
|
|
|
|
netJP12L wrote: Hi guys, I am looking for application that looks a like PowerPoint
Do you have a C# question or are you lost? If you are lost I believe we have some fellow Canadians on CP that might be able to help you out.
led mike
|
|
|
|
|
Yes I had question related to C# sir that's why I requested for help. I am wondering if somebody developed something like that in C#.
|
|
|
|
|
netJP12L wrote: I am wondering if somebody developed something like that in C#.
Ah, yeah I didn't get that from your first post. I can be dense sometimes.
led mike
|
|
|
|
|
So what would you like to recommend me. Would you like to share any resources that may help me out.
Thanks
|
|
|
|
|
No. I wouldn't imagine that anything like that exists, but it never hurts to look. Don't limit your search to CP. Use Google and certainly check SourceForge[^]
led mike
|
|
|
|
|
hi,
when I switch the form view, form.designer.cs corrupts and when I run the code Anchors change their positions
today I installed Visual Studio 2008 sp1...
According to me, menu can be cause it
any ideas?
thanx...
I want to fly but I don't have wings
|
|
|
|
|
You are not suppose to change stuff inside the form.desiner.cs .....If you want to change your control behaviour you may either do at the design time or within the form.cs file.
|
|
|
|
|
hi there! I want to save a xml document at the local disk from a string what I am getting from a database. can someone point me at some direction how I can do that? Thx ahead
|
|
|
|
|
Assuming xmlString contains valid xml from the DB and xmlFullPath contains a valid path with filename and permissions are OK.
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xmlString);
xmlDoc.Save(xmlFullPath);
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
the path is like for example:
string path = "C:\\XML";
and it doesn't want to save there, it just goes through all the lines and it does not save
this is the code
string xmlFullPath = "C:\XML";
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xmlOrder_Data);
xmlDoc.Save(xmlFullPath);
and it goes without saving at the local directory. Any help? Thx
|
|
|
|
|
laziale wrote: and it goes without saving at the local directory. Any help?
I should save the file otherwsie and exception would be thrown
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
laziale wrote: string xmlFullPath = "C:\XML";
Did you leave out a backslash?
|
|
|
|