|
I create a user control that shows some different pictures(it look like just animation ). Here the code :
Bitmap dblbuffer;
g1=Graphics.FromImage(dblbuffer);
g1.Clear(this.BackColor);
g1.DrawImage(bmp1,...);//maybe next time it will draw anothe picture
g.DrawImageUnscaled(dblbuffer,0,0);
When backColor is not transparent,it works well.
But if backColor is transparent,the problem appear.That is,it cannot appropriately draw background when to draw smaller picture after bigger one.
So, how to copy the appropriate portion of the image(or background) of parent control onto my control's own surface.
thanks a lot
|
|
|
|
|
I mean that the code of "g1.Clear(this.BackColor)" dose not work well when BackColor is transparent.
|
|
|
|
|
I want to get the security permissions of a file in C#, Can anybody help to get worked out this ? What are the classes shall We use to get or set the Security Permissions of a file using C# code.
I'm using .Net framework 1.0,
can anybody help?
Thanks in Advance,
SMARTech
|
|
|
|
|
Check out the FileIOPermission Class here[^].
|
|
|
|
|
|
What is the easiest way to delete a read-only file?
I mean, is there a way, or do I have to reset it's read-only flag before I delete it?
Thanks.
|
|
|
|
|
File.Delete doesn't work if it's read only ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian Graus wrote: File.Delete doesn't work if it's read only ?
Nope, it throws UnauthorizedAceesException. It came as a surprise to me, too.
|
|
|
|
|
Remove the readonly attribute by using File.SetAttributes:
string file = @"C:\temp\somedir\somefile.txt";<br />
FileAttributes fileAtts = File.GetAttributes(file);<br />
File.SetAttributes(file, fileAtts & ~FileAttributes.ReadOnly);<br />
Directory.Delete(@"C:\temp\somedir",true);
|
|
|
|
|
Hi,
We have a situation where we need to 'move' a file from one location to another. We are using the moveTo method of fileInfo class for this. But the issue with this is that when we execute it, the file, after it has been moved to the destination folder retains the previleges of the source folder whereas it should have gotten the previleges of the destination folder. copyTo method of the same object does not have this problem.
One alternative is to use the copyTo method and then delete method but that becomes a little risky and we do not want to go that route.
Any ideas how we could acheve 'moving' a file in VB.NET without using the fileInfo.moveTo()?
we are using .Net 1.0
Responses will be greatly appreciated.
Thanks in advance
|
|
|
|
|
Hi Rajesh,
I'm looking for the same , please let me know if you find any solution.
Thanks in Advance,
SMARTech
|
|
|
|
|
Hello everyone,
I'm wondering if there's a way to obtain user input without using a Form KeyDown event. I'm specifically looking for a method to get printable characters no matter which keyboard layout.
I'm developing an user interface for a graphical engine and I'm coding a textbox from scratch. I'm currently using GetKeyboardState, MapVirtualKeyEx and ToAsciiEx from user32, but sometimes I get odd repeated characters and I have no means to tell the repeated characters from the actual input.
Is there a managed way to get the same functionality?
Thanks in advance,
Rob
|
|
|
|
|
Roberto Collina wrote: if there's a way to obtain user input without using a Form KeyDown event
No, not without digging deep into the bios.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Thank you for your reply. I'm sorry to hear since this is going to be problematic. I was pretty much sure I'd have eventually found a .net counterpart for the user32 methods I mentioned.
I'm curious to know how user interface developers in the .net era address to this issue. After all, text input is a basic feature.
Thanks again.
|
|
|
|
|
Roberto Collina wrote: I'm sorry to hear since this is going to be problematic.
I have always thought the OS takes care of any internationalization.
Roberto Collina wrote: curious to know how user interface developers in the .net era address to this issue.
I wonder if there are any google groups that can shed light.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
Paul Conrad wrote: I have always thought the OS takes care of any internationalization.
But it does. The scanToAscii method returns modifier-aware input. If you press shift and then a, you get "A". It's indeed very handy.
My main problem is that it behaves oddily. So, to reiterate, I was wondering how this can be done in a managed way - I don't care if it eventually boils down to those user32 calls. I think WPF has an Input.Keyboard class somewhere, I was looking for something similar for previous .net versions.
Still, thanks for your reply. I will check the google groups for info as well.
Regards.
|
|
|
|
|
Hello,
Is there a way for me to use the cool LINQ syntax to query XML using VS2005? Or do I need VS2008 for that?
i.e.:
XElement xml = new XElement("contacts",<br />
from c in db.Contacts<br />
orderby c.ContactId<br />
select new XElement("contact",<br />
new XAttribute("contactId", c.ContactId),<br />
new XElement("firstName", c.FirstName),<br />
new XElement("lastName", c.LastName))<br />
);
Thanks!
|
|
|
|
|
There isn't a way to access this syntax in VS2005. You need VS2008 (such as the free Express edition) to do that.
|
|
|
|
|
To be exact: you need C#3, VB9 and the .net 3.5 framework. All that comes with VS2008.
|
|
|
|
|
|
I want to write code to download pages from BBS and then analyze the data. The first step is to retrieve the structure of the page. "webBrowser" has many methods and properties that sounds help.
The main loop should be sth like this:
foreach (HtmlElement elem in elemColl)
{
}
I can get the elements easily. But how can I get the structure among the elements? How to get the user submitted info from the advertisements, signatures, links......
Thanks.
modified on Friday, December 21, 2007 12:35:18 AM
|
|
|
|
|
Hello,
I want to develop an application which intercepts messages sent to the Windows explorer.This is like i want to know which file or folder has been clicked or double clicked and want to prevent some files/folders from opening.How can I do this, will be grateful if someone can help me on this....
Thanks in advance
Prashanth
|
|
|
|
|
You can't do this with pure .net.
You will have to go deep into the windows kernel (I guess you will have to write a kernel driver / rootkit to do this stuff).
Normaly this is not a good idea. Better use your admistrator to enforce some constrains on those files/folders and use the existing system.
|
|
|
|
|
What are some advantages of using Forms over MessageBoxes?
And, is a return statement required in a method that returns the type void?
|
|
|
|
|
cmh623 wrote: What are some advantages of using Forms over MessageBoxes?
Well, the obvious one is that you can design a form any way you like, a MessageBox is very limited.
cmh623 wrote: And, is a return statement required in a method that returns the type void?
This is the sort of question where it would make sense to try it and so. The answer is no. You'd only use it to terminate execution based on a condition such as if (i <0) return;
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|