|
Hello,
I'm using a picturebox control on my form which displays a bitmap object that's created programmatically. The problem is that when I go to save the bitmap (using bitmap.Save) it's saved with transparency enabled. How can I disable transparencies on my bitmap object?
I've searched the MSDN but all I've managed to find is bitmap.MakeTransparent(). I'm quite surprised that there isn't a bitmap.MakeNotTransparent() function to go along with that, seems rather useless to have a clear and concise way of turning something on but then having to tear your hair out trying to find out how to shut it off
Thanks a lot,
Joseph LeBlanc
|
|
|
|
|
Hi!
My real name is Antoine Dubuc, and I'm screwed!
I have an xml document with his sidekick schema, and they're both doing fine.
There's this textbox that would like to be filled with data from our trusty XML file.
So being ignominously screwed in attempting to muster some sense from F1
( who writes this anyway!???) I am here to ask you some advice.
How can I open my xml file, search it to find the right element, say 'First Name',
and have it displayed inside the textbox?
I know, you are probably thinking ... ...
I'm a beginner in XML, hence this qustion from which I'd be grateful
to receive some specific code example
Thank you!
Antoine
Orchus Technologies
Coding is a family business
|
|
|
|
|
Use the .NET Xml* classes to load the XML file, then you can search through the resultant XML tree to find the right element, then (I assume you're doing this within the Page_Load event of an ASP.NET page) set the text of the appropriate text input element in your ASP.NET page by setting the TextBox.Text property as the value of the element in the XML tree.
cheers,
Chris Maunder
|
|
|
|
|
The project for this is a Windows Form project.
What classes ?! I mean, I'm a beginner, I tried XmlDataDocument and I load the xml file
into it. Ok. Now, what do I use to search the right node and output the element to the textbox?
Thank you
Antoine
Coding is a family business
|
|
|
|
|
Hi,
The following code loads the text in the tag "/root/firstname" of the file "c:\xmlfile.xml" into a textbox named "FirstNametextbox".
System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
xmlDoc.Load(@"c:\xmlfile.xml");
XmlNode node = xmlDoc.SelectSingleNode(@"/root/firstname");
FirstNametextbox.Text=node.InnerText;
HTH,
J Dunlap
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
Thank you very much!
Antoine
Coding is a family business
|
|
|
|
|
Try this:
http://www.codeproject.com/csharp/app_config.asp
=====================
http://wasp.elcat.kg
|
|
|
|
|
Add the using System.Xml; line of code to the top of your project. This will allow you to use most of the xml .Net classes. The XmlDocument, XmlNode, XmlNodeList, XmlElement, and XmlAttribute classes are the ones you'll use the most.
|
|
|
|
|
Hi,
I have a simple question. If I have a CAD/CAM Application using OpenGL and programmed with C++ is it possible to still used it with a C# GUI? or do I have to transform all my C++ code in C# code?
I answer the question because I would like to use to power of C# unstead of MFC to build my GUI
Thanks
Everything's beautiful if you look at it long enough...
|
|
|
|
|
Just take your working code into a COM object or a DLL and use it under your C# application! So you don't have to rewrite the code under C#.
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
Hi all,
If I have an image on a toolbar button and I disable the button the image disappears. Anyone know how to fix this?
Thanks in advance.
- monrobot13
|
|
|
|
|
Hi all,
I'm trying to create a bitmap from a file on disk. I've added the file to my solution, but where does it go? I'm trying to create the bitmap like this:
Bitmap img = new Bitmap (GetType (), "img.bmp"); The problem is that I don't know what class I should be calling the GetType method on. I tried just using GetType , but the debugger tells me it can't find the resource in that class. Where does the resouce get added to?
As well, I tried just using the filename (it's in the same dir as my source files) to create the bitmap:
Bitmap img = new Bitmap ("img.bmp"); Doing this I get an ArgumentException with additional info that says "invalid parameter used". If I use the full path it works. Why does it say it's an invalid parameter when I just use the filename?
Thanks in advance.
- monrobot13
|
|
|
|
|
monrobot13 wrote:
Bitmap img = new Bitmap (GetType (), "img.bmp");
You use this constructor when you are dealing with embedded resources[^]. The type you pass in needs to have a couple of things in it set just right so that the resource can be found. The Assembly the type is in, must be the assembly containing the resource. The Namespace of the type must be the first part of the fullname of the resource. The string you pass in completes the name of the resource. See my article for more information.
monrobot13 wrote:
Doing this I get an ArgumentException with additional info that says "invalid parameter used".
I think this is because the argument (the filename) doesn't specify a file that exists. Remember that under VS.NET your code is being run under the ./bin/Debug or ./bin/Release, so the bitmap would have to be there to be found. If you didn't place the bitmap under those directories that would explain the exception.
IMHO, you should be using embedded resources for any images that should be part of your application. This helps prevent the user from modifying or moving the images.
James
"I despise the city and much prefer being where a traffic jam means a line-up at McDonald's"
Me when telling a friend why I wouldn't want to live with him
|
|
|
|
|
Wrong forum Centrum....although there doesn't appear to be a forum for plain old vanilla C (like we ALL learned on). The Visual C++ might be the best forum to get an answer. Hope that leads you in the write direction.
There are only 10 types of people in this world....those that understand binary, and those that do not.
|
|
|
|
|
vs.net 2003,
.NET svr
I don’t seem to be able to create Web Services using my machine name in place of localhost in vs, fair enough. But I also can browse to them, once deployed, in ie (replacing localhost with the machine name).
This is causing me no end of grief as I wish to consume a currently local service using a smart client app running on the vm / emulator. I have manually changed the url in the wsdl etc, it just cant find the service.
I must have something wrong at iis level. Does anyone have any insight?
note iis 6, if it makes a differance. (localhost access works fine).
tia
Rob
gadgetfbi@hotmail.com
|
|
|
|
|
It might be a security setting with the application you are trying to use to consume them, that is it might be accessing with a different set of credentials. Try setting the security settings for the web services in IIS to "Everyone" and see if you can access them.
Rocky Moore <><
|
|
|
|
|
Hi all,
i've developed a c# windows application that envolves file I/O. Up to now all development has been on my own machine running win2k pro and i am logged in as an administrator. I recently tried running the code on another machine on which i installed the .net redistributable and as soon as the app tried to access the file system (i.e when opening a file dialog) it through an exception of the type System.Security.FileIOPermissions.
I've looked into it a bit and discovered how the clr assigns permissions to different assemblies at runtime etc.
What i'd like to know is, is there a way for me to configure my code so that it can always access the file system on other machines... i don't want the user to have to manually increase the trust level using the .net config tool as that would be very messy!!
any help is appreciated
Thanks
Paul
Paul Griffin
|
|
|
|
|
NET security was design for apps not to have blind access to resources in user's computers. So the default behaviour is for your program to be able to do only what the user machine allows. Consequently, when designing your programs you have two options:
1.Use declarative security syntax (for running your program requires...so if that permission is not there the program will not run. You may add a messagebox informing the user why.)
2.Use isolated storage. Isolated storage enables partially trusted apps to store data in a way that is controlled by the computer's security policy.
Altering the previleges yourself would be against NET's security framework, which is based on the premiss that it is the user that decides what permissions are given to what programs.
|
|
|
|
|
Does this mean that at best all i could do is inform the user that the need to run the .net config tool and increase the trust level of the app??
or can i programmtically config my app so that it can access tyhe file system if i give it the correct permissions
Paul Griffin
|
|
|
|
|
You do not give security permissions in NET code. You ask the user's computer for a specific permission. If the answer is negative you have the following options:
1. Continue to run the program with limited functionality.
2. Stop the program.
3. Use isolated storage as a workaround (like i said in my last post isolated enables partially trusted apps (i.e, apps that do not have all the permissions) to store data in a way that is controlled by the computer's security policy)
|
|
|
|
|
Thanks for the info, i'll take a look into isolated storage then!!
Paul Griffin
|
|
|
|
|
is it possible to use the common file dialog boxes (SaveFileDialog, OpenFileDialog etc) with the IsolatedStorageFileStream???
Paul Griffin
|
|
|
|
|
What I have found in my development is that if the application is installed locally on the user's machine, it works fine (can access the file system). It's only when they try to run the program from a network share that they get the security error.
Josh
Find a penny, pick it up, and all day long you'll have a back-ache...
|
|
|
|
|
Hi
Maybe somebody can tell me how i can set text on some textbox or status bar in other apllication??
I use Process to get Handle to this application but i don't know how to find cocnrete control and how to set text. Another application is not writen in C# and is started before my program
Greetings
S_W
P.S.
Sorry for my english
|
|
|
|
|
Why don't you start with Visual Studio's own tools like Spy++ for discovering what controls other running applications have?
|
|
|
|