|
How do i change the background image of form1 from form2
|
|
|
|
|
2 ways
1.
Form1 tmp_form1 = new Form1();
tmp_form1.BackGroundImage = Image.FromFile(FILEPATH);
tmp_form1.Show();
2.Delegates And Events[^]
one more i forgot
in Form1
Form2 tmp_form2 = new Form2();
tmp_form2.Form1Reference = this;
tmp_form2.Show();
you can change form1, backgrou...
Form1Reference.BackGroundImage =.....;
i didnt checked the code, so it may have errors
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
yp he is right. or you can dynamically add the image from a dialogbox
|
|
|
|
|
hi firends,
i want to design a new fresh and interesting interface for my application like in media player or in Y! messenger which is recently made by .NET 3. i mean i don't want to use those repetition tiring default skins in visual studio designer.
how should i start?
thanks all
|
|
|
|
|
Start with an eye for graphic arts and start sketching.
|
|
|
|
|
hi
i want to display a image at run time bcoz basing on inputs a drawing is generated and it is saved to a Image and this image i have to display in crystal report.
i have Ms-Access DataBase.
thanks in Advance
vijay kumar D
|
|
|
|
|
If the data field in data source you are setting for crystal reports has a byte[] field, I believe crystal report will convert it to image and show it on the report. I am not sure though.
|
|
|
|
|
hi
thanks for u r reply.
i think i missed about this filed byte[]
cant i try with filed of type Image
ok i have another doubt
intially i given a heading to the crystal report for one task
for another task/module , i have to change the Heading of the Crystal Report.
how can i do it
thanks in advance
vijay Kumar D
|
|
|
|
|
At present I am using Entity Classes for Storing Values Retrieved from DataBase .
eg : I retrieved employeeName,employeeID and Salary from Database
and assigned it to properties EntEmpname, EntEmpId,ENTSalary of entity class and using it on front end .
Works fine for one record ,
My question is If I want to retrieve Multiple Records using Entity class do I have to create that many instances of Entity class or is there any other way out ?
|
|
|
|
|
Yes, you will, by definition, need a list of the Entity class. How else could it work ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi Graus,
So suppose my query returned me a 1000 records, will it be better to use a Dataset or still list of the Entity class would be better ??
|
|
|
|
|
Nishant Singh wrote: will it be better to use a Dataset or still list of the Entity class would be better ??
If you search this you will get plenty of discussions on this topic. IMO, you should go with custom strongly typed entity classes. Fill the entity classes with DataReader . Do you know a DataSet is filled using DataReader ?
Assume your entity class name is Customer , you can return 1000 records keeping in a List<Customer> . Since List(T) supports enumeration, it can be directly supplied to DataSource of all popular controls which supports data binding.
|
|
|
|
|
Thanx Navaneeth,
Got your point ,
|
|
|
|
|
I need to develop a windows application that will take backup (check for the modified files in a particular folderand compress it ) and copy it to folder on the remote server for which this host server is mapped to . .can someone guide me ?
|
|
|
|
|
anupa wrote: that will take backup (check for the modified files
Use a FileSystemWatcher control to get notified when files are modified.
anupa wrote: and compress it
Use GZip compression.
|
|
|
|
|
File.Copy will copy a file. There's zip stuff built into .NET 3.5, at least. The FileAttributes class will tell you when a file was last modified.
your client can just buy something that does all of this for $30, are you charging less than that ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Christian Graus wrote: are you charging less than that ?
HAHAHA this was best
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hello Sir,
I once build an application for that purpose. Email me and I'll send you the source code for it.
Best,
Morten
|
|
|
|
|
I did some reading about embedded resources but they all dealt with pictures and other runtime functions.
How do I copy the file from a resource?
Thanks.
|
|
|
|
|
|
|
This assumes your resource is in the executing assembly, and be careful - the "executing assembly" is the assembly in which the code is located :
ResourceManager rm = new ResourceManager("MyAssemblyName.Properties.Resources",
Assembly.GetExecutingAssembly());
byte[] streamViewer = (byte[])rm.GetObject("MightyViewer");
if (streamViewer != null)
{
try
{
using (FileStream streamTarget = new FileStream(viewerFile,
FileMode.Create,
FileAccess.ReadWrite,
FileShare.None))
using (BinaryWriter writer = new BinaryWriter(streamTarget))
{
File.SetAttributes(viewerFile, File.GetAttributes(viewerFile) |
FileAttributes.Hidden);
writer.Write(streamViewer);
}
}
catch (Exception ex)
{
if (ex != null) {};
}
}
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi, im really hoping someone can help me out, or at least point me in the right direction. I am using an SDK of a 3d application (www.softimage.com) to write a custom plugin. I have written the plugin without problems so far not using threads. This plugin is instanced at least 50 times within the application, but unfortunatly the host application will only call each instance in turn, only maxing out 1 core in my computer... I have reworked things so that all data is passed from the host application to my plugin in one go, so I can do all calculations at once. I tried doing this with a simple for loop, and it worked fine, execution times of the plugin were as expected (just 50 times bigger as it was doing all 50 at once). the problems were introduced when I tried to thread it using QueueUserWorkItem and the Threadpool to do all of these itterations at once to max out my 4 cores
The problem I am having is that execution time using the threadpool, even if I use only one thread skyrockets. To call 1 instance of this plugin in a single threaded version, takes around 15ms to complete. However, if I use the threadpool to execute this single instance the time takes around 350ms! - I was expecting it to be around the same time as the single threaded verison, or mabey a few ms slower due to having to use the threadpool.
I have used a StopWatch class to see where the slowdown is being caused, and it turns out that there is a specific SDK method that is called on an SDK object that takes over 5ms to complete when using a the ThreadPool. it takes about 0.2 or so to complete in the non threaded version. Throughout the plugin I use this method ALOT. I cant userstand what the difference is when this method is called from a ThreadPool Thread, or just called normally in the single threaded version?
Mabey its a problem with the SDK, but I dont see how accessing data on an SDK object should be so much slower just becuase a threadpool thread is calling the a method on it.. Im really lost as to what to look for
the particular line of code is
outArray = (Object[])_nurbsSurface.EvaluateNormalizedPosition2(uPosition, vPosition);
(0.2ms or less to complete when ThreadPool is not used.. upto 5ms to complete when this method is called from a ThreadPool Thread)
_nurbsSurface is an object that is passed from the hsot application, uPosition and vPosition are both doubles.
there are also lots of other bits of code that seem to increase execution time alot when using the ThreadPool, such as the .add method on a List<t> .. I dont have any of these problems in the non threaded version..
Any advice would be appriciated.
Thanks
modified on Friday, December 19, 2008 7:56 PM
|
|
|
|
|
Hi,
what is inside EvaluateNormalizedPosition2? is that your code? if it is available and not too long,
could you show the code? does it access GUI elements such as Controls? does it use locks or other synchronization stuff?
Any chance your threadpool thread is running at a lower priority, and something else is stealing most of your CPU cycles?
|
|
|
|
|
Hi - It could well be the threadpool is running at a lower priority, I will have to look into that, but the CPU does go to 100%. There are No GUI elements accessed, there are a few parameters, but these are all accessed at the start, the whole process of retriving the needed information from the application takes the same time to execute in both threaded and non threaded, so not much of a problem there. I will explain how this works to mabey help give a clearer picture.
EvaluateNormalizedPosition2 is part of the SDK. it is a method available on NurbsSurfaceMesh Objects. The application works by connecting Input and Output ports to the various objects in the scene. Everything is returned from these ports as __System.Object and you cast to the correct Type using the supplied interfaces, such as NurbsSurfaceMesh. There is rather alot of code, and its a bit of a mess, but i'll paste key bits.
The whole operation of this plugin is done through the 'Update Callback' public bool Update(Context in_ctxt){}
the Context Object provides access to these various Input and Output ports that are defined in a Define Callback earlier in the plugin. The relevant 'Input Port' is the one that provides access to the NurbsSurfaceMesh, on which EvaluateNormalizedPosition2 method exists.
My class, 'nurbsInfo' is where I do all the calcuations, and where EvaluateNormalizedPosition2 is used extensively. The constructor of this class takes the NurbsSurfaceMesh as an argument, in which it is assigned to a private variable (_nurbsSurface) of the class . This is how EvaluateNormalizedPosition2 is accessed within my class - _nurbsSurface.EvaluateNormalizedPosition2(u,v)
This is the line within the Update Callback that I create a new instance of my NurbsInfo class and pass the NurbsSurfaceMesh to the constructor.
NurbsInfo nurbsInfo = new NurbsInfo(((NurbsSurfaceMesh)((Primitive)ctxt.GetInputValue(0, 0, 0)).get_Geometry(null)).Surfaces[0]);
In the single threaded version I would then call my GetUVFromPercentage method on the nurbsInfo object, passing it 2 doubles and returning an SIVector3 object.
SIVector3 newVector3 = nurbsInfo.GetUVFromPercentage(50,50)
Within GetUvFromPercentage, the EvaluateNormalizedPosition2 method is called many times on the _nurbsSurface object. The execution time without using the thread pool is quite small for the whole plugin. EvaluateNormalizedPosition2 is called around 30 times. The problem is, this Update Callback is called once for every single instance of the plugin in the application, and these small execution times build up if its calling the plugin (and therefor GetUvFromPercentage) say 50 or more times, one after the other.
My hope was that I could rearrange my plugin, so all 50 or more calculations are part of the same plugin instance in the host application. This just means that all the data such as the desired percetages are all passed at once - I had hoped this would then allow me to thread them, by doing them all in one call of the Update Callback.
Below is the code I use now to call the nurbsInfo.GetUVFromPercentage() method. I have actually modified this methods signature so that it has no return type anymore (as I haven't looked into how to do that when using threading), and accepts an Object as its argument. It seems this is the only way to pass parameters when using QueueUserWorkItem. Having no return should make no differce, it just means I dont pass any data back to the host application.. but all the calculations are still performed.
for (int x = 0; x <= numInstances - 1; x++)
{
autoResetEvent[x] = new AutoResetEvent(false);
}
for (int x = 0; x <= numInstances - 1; x++)
{
surfacePathTProperty = (CustomProperty) customOperator.PortAt(0, 1, x).Target2;
double uLocation = (double) surfacePathTProperty.Parameters[1].get_Value(ctxt.Time);
double vLocation = (double) surfacePathTProperty.Parameters[2].get_Value(ctxt.Time);
Object[] args = new Object[2];
args[0] = uLocation;
args[1] = vLocation;
ThreadPool.QueueUserWorkItem(nurbsInfo.GetUVFromPercentage, args);
}
ThreadPool.WaitAll(autoResetEvent);
So the above code is in the Update Callback, and calling QueueUserWorkItem 50 times with all the different uLocations and vLocations. Instead of having 50 seperate plugins in the Host Application and the application calling the Update Callback 50 times in a serial manner. The only other difference is that in the Threaded version GetUVFromPercentage will .Set the autoResetEvent when its finished.
I am at a loss as to why calls to EvaluateNormalizedPosition2 are small when called in a serial manner, but are huge when the nurbsInfo.GetUVFromPercentage is being executed by one of the ThreadPools threads. I have even when reduced 'numinstances' to1, so there is only 1 Thread, as I thought having 50 all calling SDK methods might be the problem. But the calls to EvaluateNormalizedPosition are still huge. I would have expected it to be very similar execution times to executing 1 Update Callback in the non-threaded version.
Do threads have different prioritys when executing code, or different..something ? I assumed they would execute it in exactly the same manner as the Main Thread does in the non-threaded version, just lots more of them doing it As I understand it, calls to various SDK objects and methods, should be the same whether done from the main thread or a threadpool thread.
I also found that using List<t> or Dictionary<t> .add methods were very slow in the threaded version and also added to the huge overall execution time, I have commented all of these out for now.
Could it just be that the provided .NET sdk does not like being used with threads?. From what I can see (guess) it does look like alot of the .net stuff they have added is wrapping the older c++ api.
I am not knowledgeable enough to know whether this could be the source of the problem.
If you managed to read this far .. any advice ?
Thanks )
modified on Friday, December 19, 2008 9:58 PM
|
|
|
|
|