|
Hi David,
thanks a lot for your fast answer.
I already use PIA, but the code is different in C# from VB6.
Since 2 days i try to "translate" this sample VB6-code to C# but i have no success.
I really become crazy with this problem.
Peter
|
|
|
|
|
ok. I think best you can do is to browse MSDN for examples...
You can post here result of you translation (if not long), maybe somebody can point out what's wrong or how to do it etc...
David
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
Here is a function to copy from a presentation all elements and make a new presentation of it.
For each element of a shape a new shape is generated.
But the problem is that it loses all its formatting for the text, background,...
Perhaps anybody has an idea.
Thanks a lot!
Code:
public PowerPoint.Presentation GetPresentation(PowerPoint.Presentation pOriginalPresWithAnimations) {
PowerPoint.Presentation pNewPresWithoutAnimations = __pPPT.Presentations.Add(Office.MsoTriState.msoTrue);
string sName = pOriginalPresWithAnimations.Name;
string sPPTCopyPath = "PresentationCopy";
string sPath = System.Windows.Forms.Application.ExecutablePath;
sPath = Path.GetDirectoryName(sPath);
sPPTCopyPath = Path.Combine(sPath, sPPTCopyPath);
string sSlidePathName = Path.Combine(sPPTCopyPath, sName);
if(!Directory.Exists(sPPTCopyPath))
Directory.CreateDirectory(sPPTCopyPath);
if (File.Exists(sSlidePathName))
File.Delete(sSlidePathName);
pNewPresWithoutAnimations.SaveAs(sSlidePathName, PowerPoint.PpSaveAsFileType.ppSaveAsPresentation, Office.MsoTriState.msoTrue);
foreach (PowerPoint.Slide pSlide in pOriginalPresWithAnimations.Slides) {
SlideInfo pSlideInfo = PresentationInfo.GetInfos(pSlide);
ArrayList pArrayFix = new ArrayList();
Hashtable pHashAnimiert = new Hashtable();
for (int i = 1; i <= pSlide.Shapes.Count; i++) {
__pShape = pSlide.Shapes.Item(i);
if (__pShape.AnimationSettings.Animate == Office.MsoTriState.msoFalse) {
pArrayFix.Add(__pShape);
}
else {
pHashAnimiert.Add(__pShape.AnimationSettings.AnimationOrder - 1, __pShape);
}
}
__pSlide = pNewPresWithoutAnimations.Slides.Add(__nFolienIndex, pSlide.Layout);
for (int j = 0; j < pArrayFix.Count; j++) {
__pShape = (PowerPoint.Shape)pArrayFix[j];
__pShape.Copy();
__pSlide.Shapes.Paste();
}
AddAllSlides(pSlideInfo, new SlideInfo());
for (int i = 0; i < pHashAnimiert.Count; i++) {
__pSlide = pNewPresWithoutAnimations.Slides.Add(__nFolienIndex, pSlide.Layout);
__pShape = (PowerPoint.Shape)pHashAnimiert[i];
__pShape.Copy();
__pSlide.Shapes.Paste();
if (i >= 1) {
for (int k = 0; k < i; k++) {
__pShape = (PowerPoint.Shape)pHashAnimiert[k];
__pShape.Copy();
__pSlide.Shapes.Paste();
}
}
AddAllSlides(pSlideInfo, new SlideInfo());
}
}
__nFolienIndex = 1;
return pNewPresWithoutAnimations;
|
|
|
|
|
Is there a c# equivalaent of the delphi WITH keyword? WITH allows you to set a scope for class variables in a function, so that the class need only be specified once then all variable names that match with variable names inside the class are deemed to be from the specified class. ie.
public class car
{
public int wheels;
public bool isSofttop;
}
public main
{
car Audi = new car;
WITH Audi do
{
wheels = 4;
isSofttop = false;
}
}
|
|
|
|
|
|
AFAIK no, there isn't equivalent to with . If you want to be 100% sure, google for ECMA-334(C# spec.) After quick glace into spec. there seems to be nothing similar to with statement.
Personally, I am happy about.
However you can use using to deal with namespaces. (which are often way much longer names)
David
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
The closest you can get to that is to use a temporary abbreviated variable:
public main
{
car Audi = new car;
car a = Audi;
a.wheels = 4;
a.isSofttop = false;
}
David Anton
Tangible Software Solutions
www.tangiblesoftwaresolutions.com
Home of the Instant C# VB.NET to C# Converter and the Instant VB C# to VB.NET Converter
|
|
|
|
|
Hi ,
I want to filter the selected color from the image.I had already done the filtering the whole image with grascalling and making contrasting whole image but now i want to filter the image with selected color,Now i want to know logic for filtering the selected image.
here i am using the logic for contrasting the image (means filtering the whole image),now can anybody say how to deduct or filter the selected R,G,B value from the whole looping.Here i am describing whole loop which i am using for contrasting the image.
public void MakeContrastUnsafeFaster(int nContrast)
{
//Getting the how much pixel Arrays do you want to retrives.
Point size = PixelSize;
//Locking the bitmap for getting great performance
LockBitmap();
for (int y = 0; y < size.Y; y++)
{
PixelData* pPixel = PixelAt(0, y);
for (int x = 0; x < size.X; x++)
{
byte value = (byte) ((pPixel->red + pPixel->green + pPixel->blue) / 3);
// perform contrast enhancement here:
value = (value < 150 ) ? byte.MinValue : byte.MaxValue;
pPixel->red = value;
pPixel->green = value;
pPixel->blue = value;
pPixel++;
}
}
//Now Unlocking the Bitmap and making it free.
UnlockBitmap();
}
Here i am setting the R,G,B value with minimum and maximum value which bifercare my image into only black and white,
Now my requirement is that what to do in this logic by which only selected color dropped out?
anybody help into that?
|
|
|
|
|
How can one define a class in multiple files?
Sometimes there are classes with huge amount of code that wouldn't have sufficient reason for a hierarchy of classes (as the main class of a web service) but still are difficult to maintain because of the large amount of code in one file and even more difficult to be used by multiple developers in the same time. So, is there a way to span a class over multiple files?
Cheers
Dani
|
|
|
|
|
.NET 2.0 is supporting multiple files for a single class using the partial keyword in C#. You can read more about this feature in this article.[^]
On the other hand, if a class grows that large, I'd consider a review on the design.
hth,
Matthias
I love deadlines. I like the whooshing sound they make as they fly by. [Douglas Adams]
|
|
|
|
|
|
How i can change system time in C#?
Nothing
|
|
|
|
|
|
I am building billing software in C#. I need to print bills at POS (Point Of Sale) and most of the time I am dealing with dot matrix printers like Epson LX 300.
Using normal c# printing procedures, after I am finished printing, printer automatically ejects the whole page. To save this, I have reduce paper size to few cm from printer page settings. In some cases, the associated driver like Epson LX 300+ doesn't let me set size smaller than 1 inch.
Is there any method in C# to print one line (or one char) at a time? For example - like when we print from command prompt
c:\>echo hello > prn
|
|
|
|
|
You'll need to skip the normal printing functions entirely. When using these functions, your not printing to the printer, but to a graphics object that represents the image of the page. When that graphics object is completely drawn (in your case, a single line of text), the image contained in the graphics object (the ENTIRE page) is then sent to the printer driver for print.
You can find an example of printing directly to the printer here[^] on MSDN.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks for the link. I guess I found what I been looking for. Now I am not at liberty to choose font of my choice except that is already present in the printer. But this solution is more important than selectable font/size.
|
|
|
|
|
Most printers DO have multipkle fonts built into them, along with Bold, Italics, Underline, different point sizes. All you have to do is consult the manual on the printer. It'll also give you the ESC codes to send to the printer to select those fonts. I haven't done it in about 10 years, but I know they're there.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi all
i am trying to validate a text box entry.
i want to enter hex data in the text box.
so in the keyDown event of the textbox if the user presses an invalid key i say e.Handled=true. but still the keypressed appears in the text box.
private void textBox1_KeyDown(object sender,System.Windows.Forms.KeyEventArgs e)
{
if(e.KeyValue==65)
{
e.Handled=true;
}
}
this was the sample code i was trying to disable typing of 'a'
can any one help me????
|
|
|
|
|
Key off of the KeyPress event rather than the KeyDown event.
Darryl Borden
Principal IT Analyst
dborden@eprod.com
|
|
|
|
|
what is the key off event?
|
|
|
|
|
There is no "key off" event.
Use the "KeyPress" event - not the "KeyDown" event
Darryl Borden
Principal IT Analyst
dborden@eprod.com
|
|
|
|
|
Hi,
I trying to run process with System.Diagnostics.Process object.
When defining the WorkingDirectory to be a virtual folder (Drive that has been created with subst). it throws an exception "The directory name is invalid".
Did anyone had such a problem?
Any solutions?
Thanks,
Ori.
BTW,
It works great on win2000
|
|
|
|
|
Hi everyone!
I need to manage local computer's network routing table (i.e., add/remove gateways) from a C# application. In other words, i need to perform, programmatically, operations equivalent do "ROUTE ADD", "ROUTE DELETE" and "ROUTE PRINT" DOS commands. As of right now, i simply launch instances of command prompt with these commands, but it is very cumbersome.
Anyone knows how can i do it using .NET framework or Windows API?
Thanks a bundle!
|
|
|
|
|
You'll need to check into the Routing Protocol Interface in the Platform SDK, here[^] on MSDN. There is nothing in the .NET Framework BCL that will do this for you, so you'll have to write your own library to P/Invoke that appropriate functions and parameters.
[EDIT]
Whoops! My bad! Check out the Routing Table Manager (Version 1[^] and Version 2[^]) for what you need. Still, there is nothing in the .NET BCL that does this for you.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
What is the best way to work with multiple db connections? I mean that I ahave an app with a TreeView on it and for each node(if he has some props)I want to use a diffrent db (MsAccess) connection, what i did is that when I press a node I verify the conditions and if they are OK I
[] conn=new OleDbConnection(strConnect); []is this the best way?
(o)(o)
|
|
|
|