|
I'd imagine a sprite would be far more performant that using individual triangle strips. Sprites are meant for use in batches, so I'd imagine they'd fit your scenario pretty well from a performance perspective.
|
|
|
|
|
thanks
i use sprites but there was a problem
when ever i make a new sprite it took texture image from file which is very expensive in terms of performance
so i make a static texture and assign it to others it increases the performance considerably but using static variable is not a good idea in it self (however i make them null after use )
if you have a better solution please tell me
It is Good to be Important but!
it is more Important to be Good
[My Question]
|
|
|
|
|
You don't have to make the variable static to use it more than once.
---
b { font-weight: normal; }
|
|
|
|
|
how can i use it in multiple instances of multiple classes without making a instance of containing class every time (because it have to read from the file which results in increased cunsuption of cpu)
i have to finish my project in november itself so there is not much time for reading oop concepts in so detail (time require to find it) so please help me
thanks
It is Good to be Important but!
it is more Important to be Good
[My Question]
|
|
|
|
|
Just pass the variable into the class where you're going to use it:
class FirstClass
{
string someVariable = "hello";
...
SecondClass second = new SecondClass();
second.HereItIs(someVariable);
}
class SecondClass
{
public void HereItIs(string variable)
{
}
}
|
|
|
|
|
thanks
i hope it will work as things are not so simple
It is Good to be Important but!
it is more Important to be Good
[My Question]
|
|
|
|
|
Yeah. Typically if you need shared variables, you should initialize it in one place, then pass it down to all descendant classes by passing the variable down into the class constructors.
Alternately, you can make the variable static if you need only 1 instance, but this often leads to rigid designs; static is really meant for classes where the functions don't rely on any state and are completely independent of each other.
|
|
|
|
|
AGRH! its 9
i should leave for office
thank you very much this conversation is very useful to me
thanks again
It is Good to be Important but!
it is more Important to be Good
[My Question]
|
|
|
|
|
Hi, I have a container which inside as a container display certain forms, those forms i can move it inside the container. what i want to do is eather disable the forms to move, or disable the container that when i try to move a form outside the container do not appear an Scroll Bar. I already try to disable the Autoscroll property of the container but i still getting the scroll when i move a windows. how do i disable the scrolls to apprear in the container,so the forms does goes outside ther borders and the scroll bars appears.
La Light
|
|
|
|
|
try setting its dock property to Fill.
~~~ From Milano to The Hague, easy as it goes ~~~
|
|
|
|
|
a Container Does not have that property... So any other Suggestion?
-- modified at 16:49 Monday 20th November, 2006
La Light
|
|
|
|
|
I know this is an easy one but I can't find any examples. I have a xml file that I transform (via xslt) and I need to save it. How?
string ls_xml;
XmlDocument doc = new XmlDocument();
Xml output_xml = new Xml();
ls_xml = GetXMLString(); // returns xml string
doc.LoadXml(ls_xml);
output_xml.Document = doc;
output_xml.TransformSource = "menu.xslt";
I can look at the output_xml and it's exactly what I want but in a web.sitemap file. How do I save it without using a xmlwriter to parse through the entire xml file? That seems a little redundent since it's in the desired format already.
Thanks, Jessica
|
|
|
|
|
Hi Jessica
Does
doc.Save("myfile.xml");
fit the bill?
|
|
|
|
|
No. That will save the original xml document file. and I need to save the xml after the transformation. I want to save the output_xml (type xml, not xmldocument) without parsing through the entire xml.
Thanks, Jessica
|
|
|
|
|
Ok, now I think I understand.
You want to save output_xml to a file, is that right? If so, can you simply do
File.WriteAllText("myFile.xml", output_xml.DocumentContent); ?
|
|
|
|
|
OOhh... that gets me so much closer. But my DocumentContent is blank. I looked at other properties but Document.InnerXML contains the initial xml (not post transform).
I know the transform is happening because I can add an <asp:xml> control to the form and see the transform xml. I just don't know how to access it at run time to save to a file.
Thanks, Jessica
|
|
|
|
|
Sounds like you need to do the transform yourself on the initial XML. Can you either create a new transform or access the Xml.Transform property, then transform the initial XML using the XslTransform.Transform method?
|
|
|
|
|
I thought that was what I was doing in my initial code I posted.
string ls_xml;
XmlDocument doc = new XmlDocument();
Xml output_xml = new Xml();
ls_xml = GetXMLString(); // returns xml string
doc.LoadXml(ls_xml);
output_xml.Document = doc;
output_xml.TransformSource = "menu.xslt";
Thanks, Jessica
|
|
|
|
|
got it. Thanks for your help. I thought that would be easier but it wasn't.
doc.LoadXml(ls_xml);
string sitemapxslFile = MapPath("menu_sitemap.xslt");
string tempfile = MapPath("jte.sitemap");
StringBuilder sb = new StringBuilder();
TextWriter tw = new StringWriter(sb);
XslTransform xsl = new XslTransform();
xsl.Load(sitemapxslFile); //load xsl file
xsl.Transform(doc, null, tw, null); //does transformation
XmlDocument ret = new XmlDocument();
ret.LoadXml(sb.ToString());
ret.Save(tempfile);
Thanks, Jessica
|
|
|
|
|
Glad you got it working. Too bad there doesn't seem to be an easier way. I'm not familiar with the Xml web control as I don't do web development, so FWIW, there may be an easier way I'm just not familiar with. If you really do need an easier way, you might want to post this question in the ASP.NET forum.
|
|
|
|
|
Firstly, let me set up the semi-complicated setup on my form. Inside the form, I have a tab control. In each tab page, I have placed a separate user control. Inside the user control in question, there are three group boxes that each contain a data-bound datagridview.
Upon entering any of the dgvs, the usercontrol scrolls such that the top of the datagrid occupies the top of the tabpage (except for the bottom one, then it scrolls down so the bottom of that datagrid is at the bottom of the usercontrol). From what I gather, the form is attempting to ensure that the selected datagrid is completely in view to the user. This is confusing the end-user, and I'm looking for a way to have the scrolling of the usercontrol not happen automatically.
Can anyone point me in the right direction, or give me some advice on how I should handle this?
|
|
|
|
|
Hello, I’m hoping some of you can help me.
I’ve created a C# Windows Service project whose service main function instantiates a class library that spawns a new thread to create a new process with which to launch osk.exe (the Windows on-screen keyboard). The purpose for creating this service is to have the on-screen keyboard appear immediately after startup (before the login screen) on a system that will have no keyboard hardware.
I had first built a test program (C# console application) to call the class library and test its functionality and it worked fine. Then I created the Service Project including its installer classes and installed the service with installutil. [Incidentally, all three projects—the class library that launches the osk in a new thread, the test console application, and the windows service—are in the same solution.]
Each time I manually start the service (using the MMC snap-in) I get the following message:
" The service <name> on Local Computer started and then stopped. Some services stop automatically if they have no work to do…"
I don’t understand what this means. The class library contains the necessary start and stop methods, and I copied the same code from the test program to the OnStart () method of the service class. Can anyone please help?
|
|
|
|
|
Is your stop method being called? If so, where is it called from?
|
|
|
|
|
Judah, Thanks for responding.
In the OnStop() method of my ServiceBase derived class (which I call OSKStarterService) there is a call to the Stop method of the class library (which I call OSKStarter) that was instantiated. But at this point it's not being called since it's not getting past a successful start.
I'm finding this message in the event log:
Service cannot be started. System.IO.FileNotFoundException: Could not load file or assembly 'OSKStarter, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'OSKStarter, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
at MyNamespace..OSKStarterService.OnStart(String[] args)
at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
What could this mean? In my service project I had created a project reference from Visual Studio 2005 to the project containing the class library that starts the new thread and osk process, and this automatically created a project dependency. I tried using ildasm to look at the assembly manifest for my service executable but it's telling me: ERROR: Failed to open meta data. Any ideas?
|
|
|
|
|
So it sounds like OSKStarter library isn't found on the system. As a temporary diagnostic, what happens if you add the OSKStarter dll to the .NET global assembly cache (GAC)?
|
|
|
|