|
Not in an easy way me thinks
Ed
|
|
|
|
|
Hi
You can do this by deriving a class from PrintController .
When the dialog "prints" to generate the preview, save the metafiles produced. Then when the dialog "prints" to the printer, just return the saved images.
----------------------------
Be excellent to each other
EasiReports[^] My free reporting component for WinForms.
|
|
|
|
|
Can you supply me with a pice of code pls ...
Currently I have no ideea how to achive that ...
BTW, thank you for your answer
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
Nicholas wrote an article on how to get the meta files of the preview and store them as images. You can find it here[^]. You will have to redirect the meta files into a new print job.
Note that you nevertheless need another PrintDocument.Print cycle but you won't have to regenerate the output.
|
|
|
|
|
Thanks, exactly what I had to read before implementing an dirty method for obtaining the PageInfo from the preview control (reflection way). Didn't see the GetPreviewPageInfo() procedure.
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
If this is the case, (print preview is fine, print is not) then chances are you have some variables not reset somewhere, or set to the wrong value. I would suggest trying to figure out exactly what the problem is before "masking" the problem with another solution.
Aaron
|
|
|
|
|
The problem was simple, I was doing a heavy print job, each page lasted for 1 sec to generate and there wore at least 10 pages. The request from the client was to be able to preview what is due to be printed. The solution I approched was this : into the print document I did a lot of heavy work ( the preview looked ok ) and in an inharited printPreviewDialog, on a print request, using reflection, I printed what was in the cache of the dialog (with out calling the document.Print() method again.
I think that the dialog I designed can be usefull, so I intend to create an article based on it, but not now, currently I am time pressed.
PS: thank you for your answer.
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
Hi all,
I would like to get a list of Windows Desktop Shortcut's so I can build a list (with associated icons). How can I do this and display the icon and trigger the app when the link is selected?
Thanks in advance.
Stephen
|
|
|
|
|
Probably you should get list of *.lnk files in desktop directory:
DirectoryInfo di = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.Desktop));
FileInfo[] fi = di.GetFiles("*.lnk");
Keep in mind, that system links (My computer, My Documents) has no lnk file.
Then, for each lnk file you should call shell function CreateShortcut:
IWshRuntimeLibrary.WshShellClass ws = new IWshRuntimeLibrary.WshShellClass();
IWshRuntimeLibrary.IWshShortcut sc;
for (int i = 0; i < fi.Length; i++) {
sc = (IWshRuntimeLibrary.IWshShortcut)ws.CreateShortcut(fi[i].FullName);
}
Don't forget to add reference to %system32%\wshom.ocx.
sc object will hold all information about link:
sc.TargetPath - link target
sc.Arguments - launch arguments
sc.IconLocation - string, that could be used to get icon.
These two articles could be helpful for icon extraction:
Win32
.NET
Hope it helps.
____________________________________________
Robin Panther http://www.robinland.com
|
|
|
|
|
Hi
How can I add a child to a node which I know the index of? the only examples I can find are using the "selectednode" property.
cheers
|
|
|
|
|
try treeView.Nodes[index]
Ed
|
|
|
|
|
Thanks. Now that I've selected the node how will i be able to add a child?
cheers
-- modified at 4:10 Saturday 1st April, 2006
|
|
|
|
|
1) You don't need to select it to add nodes
2) treeView.Nodes[index].Nodes.Add(new TreeViewNode)
Ed
|
|
|
|
|
|
Hey
Basically I have a project with several forms which each need to access teh same instance of the Prog class. Where should I define this instance to make it visible to all forms?
Cheers
|
|
|
|
|
Hi
I create a Glob class ( Global is a keyword ), then create public static properties for global variables.
internal class Glob
{
private Glob() { }
private static Prog _Prog = null;
public static Prog Prog { get { return _Prog; } set { _Prog = value; } }
}
Some people say that global variables are a bad thing, but like any construct, they are sometimes useful
----------------------------
Be excellent to each other
EasiReports[^] My free reporting component for WinForms.
|
|
|
|
|
|
hey guys I have two questions ( sorry if they are stupid ones ...)
1- I have two forms in one i declare a variable
public int number;
Then i assign a number to it and i want to use it in my second forms
firstform ff = new firstform();<br />
messagebox.show(ff.number.tostring());
I don't get the correct number ?!
2- I have a Combo Box, the list comes from a table called StateDB
State_cb.DataSource = StateDS.Tables["StateDB"];<br />
State_cb.DisplayMember = "StateName";
and it works but i also want to bind it with another table meaning that in my second table called University i have a list of people that are from diffrent universities when my form is loaded I want to have the correct state for that person already selected but it doeasn't work out that way.
State_cb.DataBindings.Add("SelectedItem", myDS.Tables["UniversityDB"], "UniState", true);
Is it possible to do so ??!!
sorry it got so long
Tnaks
-- modified at 2:51 Saturday 1st April, 2006
|
|
|
|
|
mrkeivan wrote:
I don't get the correct number ?!
What do you mean by this?
I'm taking a guess in the dark here but:
You've already got a form which contains a number and you want to get that number from it. The statement:
mrkeivan wrote: firstform ff = new firstform();
will create a new instance of the class and have a "new copy" of the variable. If you want to access the other instance of the form then you'll have to create a property or field that's accesible to both routines so that you are getting it from the correct instance.
Ed
|
|
|
|
|
ok let me light you up , I have to forms, in form one I have a variable called Number
public int User;
in the process this variable recieves a number.
In the second form I need this number for another process, but all i get is either Zero or nothing.
how about the second problem about the combo box can you help me out with that one too ?
Thanx alot
Mr.K
|
|
|
|
|
I still think that it's because you're creating two instances of the form, i.e. you're retrieving the number from a new copy of the form. (Based on your new firstform statment).
mrkeivan wrote: Zero or nothing.
Eh? For an int zero is nothing
mrkeivan wrote: how about the second problem about the combo box can you help me out with that one too ?
I don't do that much databinding so can't think of the top of my head and don't have the time to mess around trying things out. Sorry.
Ed
|
|
|
|
|
I also think the same, that the problem goes back to creating two instances of the form, so how can i do that, is there any way i can call that form with out creating an instant of it ?
I was thinking about creating a class to hold the data but again i gotta creat a new instant of that clas:(s !?!
|
|
|
|
|
mrkeivan wrote: I also think the same, that the problem goes back to creating two instances of the form
Why didn't you say you were creating two instance of the form, it's a guarantee that this is the problem
mrkeivan wrote: is there any way i can call that form with out creating an instant of it
Yes, multiple ways, the easiest would be in the form which creates the secondary form, create a public field / property which is accessible to all the method ("processes") which you require. They can then reference the form through them.
Ed
|
|
|
|
|
Thanks man, thats was very helpful
Mr.K
|
|
|
|
|
Hi all,
Could any one tell or send me the differences between HTML and XML :->
Thanks alot
Hamody
|
|
|
|