|
Marc Clifton wrote:
Specifically, why are classes like Point and String sealed?
Jason mentioned something that got me to remember another reason for sealing classes. JIT optimizations when dealing with virtual methods
If you have a virtual method in a class and you seal one of its child classes the JIT can produce code to call the child class' implementation instead of going to a vtable approach that would otherwise be needed.
It still needs to rely on the vtable if the variable is of the parent class type, but when you specify the child class it isn't needed.
Sorry of that last paragraph didn't make sense, I couldn't think of a better way of describing it
James
"The elastic retreat rings the close of play as the last wave uncovers
the newfangled way.
But your new shoes are worn at the heels and
your suntan does rapidly peel and
your wise men don't know how it feels to be thick as a brick."
"Thick as a Brick" from Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
|
Can anybody tell how to call GetIPictureFromPicture(Image image) method using C#.
regards,
sns
|
|
|
|
|
using System;
namespace OffAutomation
{
///
/// Summary description for Class1.
///
public class ImageConverter: System.Windows.Forms.AxHost
{
public ImageConverter():base("59EE46BA-677D-4d20-BF10-8D8067CB8B33")
{
//
// TODO: Add constructor logic here
//
}
public static stdole.IPictureDisp ImageToIpicture(System.Drawing.Image image)
{
return (stdole.IPictureDisp)ImageConverter.GetIPictureDispFromPicture(image);
}
}
}
this is the way u have to write a class...
and call like this
Image img = System.Drawing.Image.FromFile(@"F:\yicon.ico");
stdole.IPictureDisp obj = OffAutomation.ImageConverter.ImageToIpicture(img);
|
|
|
|
|
Ok, I got that djgpp compiler set up. I think. Compiles the program,no errors,
but it don''t out put an exacutable (.exe). The docs only deal with basic instructions,
no trouble shooting tips at all. Trust me, if I could aford a real compiler,
I'd get one. How much $ for the stuff you folks are using ?
|
|
|
|
|
I don't know whqat djpp is, but I am assuming you are looking for a C# compiler, b/c this is a C# board. Nonetheless, you can download the .NET Platform SDK for free, which includes compilers for C#,VB.NET,MC++.
R.Bischoff | C++
.NET, Kommst du mit?
|
|
|
|
|
Thanks , I'll give it a try.
djgpp is a free compiler for C and one for C++, and assembler, with about half the
support needed.
|
|
|
|
|
Hello,
I am trying to pring a crystal report with parameters without previewing it first.
I succeeded to pring report without parameters with the ReportDocument object.
I succeeded also to print report with parameters (I inserted parameters to ParameterFields and put it in crystalReportViewer.ParameterFieldInfo) from the CrystalReportViewer but in this way the report is open in another window, and then I print it from the object.
But I want to print the report with the parameters without showing it on screen first, how can I do it?
Thank u for any help, sharon
|
|
|
|
|
ok I did it :
<br />
ReportDocument report = new ReportDocument();<br />
report.Load(@"G:\Rp3Receipt.rpt",OpenReportMethod.OpenReportByTempCopy);<br />
ParameterFieldDefinitions parametersColl = report.DataDefinition.ParameterFields;<br />
ParameterFieldDefinition paramName1 = parametersColl["prmNameInReport1"];<br />
ParameterFieldDefinition paramName2= parametersColl["prmNameInReport2"];<br />
<br />
ParameterValues values = new ParameterValues();<br />
ParameterDiscreteValue val = new ParameterDiscreteValue(); <br />
val.Value = paramValue1;
values.Add(val); <br />
paramName1.ApplyCurrentValues(values); <br />
values = new ParameterValues();<br />
val = new ParameterDiscreteValue();<br />
val.Value = paramValue2; values.Add(val); <br />
paramName2.ApplyCurrentValues(values); <br />
<br />
report.PrintOptions.PrinterName = @"\\...\HPLaserJ5";<br />
report.PrintToPrinter(1,false,1,1);<br />
|
|
|
|
|
Hi,
I have been trying to find a solution to compile the audio library to dll files or any other format to save my files from being used by any other programmer but no one yet got the naswer!!
If I have 3 audio files and want to compile it indivisualy to DLL (or any other format) then create Windows application and read it without decompile it temporary on the hard disk.
Don't you think it is possible to do it?
How?
Can I have trusted example?
Jassim Rahma
|
|
|
|
|
Since DirectX 9 has been releases you can use DirectSound, which will let you use .NET Stream objects (and MemoryStream objects) for playing the sound.
One of the samples (PlaySound) included with the SDK shows you how to play audio files from the hard drive. All you *should* have to do is change it so one object uses a constructor taking a System.IO.Stream instead of the filename used in the sample.
[Line 173 of main.cs in the sample
change
<small>ApplicationBuffer = new SecondaryBuffer(name, ApplicationDevice);</small>
to
ApplicationBuffer = new SecondaryBuffer(myStream, ApplicationDevice);
Where myStream is a Stream returned from GetManifestResourceStream in our prior conversation.]
In doing so you will require your users to have DirectX 9 installed, which isn't something most users will have until some popular games come out using it. IMHO, just playing sounds isn't a very good reason to require DirectX 9, but I don't know everything about your program so it may be deserved.
HTH,
James
"The elastic retreat rings the close of play as the last wave uncovers
the newfangled way.
But your new shoes are worn at the heels and
your suntan does rapidly peel and
your wise men don't know how it feels to be thick as a brick."
"Thick as a Brick" from Thick as a Brick, Jethro Tull 1972
|
|
|
|
|
I'm using the following code to send an output string to a printer but I need the printer to write it from Right to Left instead of Left to Right because otherwise it will be impossible to adjust specially with long text...
PrintFont = new Font("Tahoma", 10);
PrintDocument pd = new PrintDocument();
pd.DefaultPageSettings.PaperSize = pd.PrinterSettings.PaperSizes[(int)myRegistry.GetValue("Paper Size")];
pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
pd.Print();
Jassim
|
|
|
|
|
Is it possible to derive a class from RichEditBox and do my own painting? I've tried deriving from 'OnPaint' but the function never gets called, and theres no 'OwnerDrawPaint' or similar event. Is there anyway of doing my own painting?
Dave Kerr
focus_business@hotmail.com
www.focus.esmartweb.com
|
|
|
|
|
|
I'm trying to paint my own 'regions' over the text itself, so the RichTextBox would do it's own ordinary painting, and then I'd paint a few translucent rectangles on top of it, but there doesn't seem to be any way of doing custom drawing in a rich text box.
Dave Kerr
focus_business@hotmail.com
www.focus.esmartweb.com
|
|
|
|
|
|
and can u give an advice how to do that? I have tried your homepage, but 'Server not found'. I'd really appreciate how to do that.
--------
Dave
ps: and merry Christmas and happy New year....
|
|
|
|
|
I'm not sure what 'IOW' highlighting is, but basicly, every time the user types a character in the control, it tests for regions (any text between say '[' and ']') and then draws a transparent box over that part of the text.
Dave Kerr
focus_business@hotmail.com
www.focus.esmartweb.com
|
|
|
|
|
I'm not what IOW is too, but i need to draw normal rich box and then highlight sections od rich edit box, like section for input and another one output. And I need to know how to draw it.
--------
Dave
|
|
|
|
|
|
|
I've managed to get custom drawing in a RichTextBox by adding this line in the constructor (of the derived class):-
SetStyle(ControlStyles.UserPaint, true);
then overriding 'OnPaint'. However, it's really hard to make the control draw itself, the only way I can do it is like this:-
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
SetStyle(ControlStyles.UserPaint, false);
Refresh();
SetStyle(ControlStyles.UserPaint, true);
...custom painting here...
}
this code is the only way I've found of getting the text to be drawn, or the selection, and although you can then custom paint, it doesn't paint itself correctly, it uses the wrong font.
Any ideas anyone? By the way, neither Invalidate or Update cause the control to paint itself...
Dave Kerr
focus_business@hotmail.com
www.focus.esmartweb.com
|
|
|
|
|
I have read leppies' code briefly and I think it's much better way how to do that than "tricks" like
SetStyle(ControlStyles.UserPaint, false);
Refresh();
SetStyle(ControlStyles.UserPaint, true);
... although much more complicated.
--------
Dave
|
|
|
|
|
|
Well, just one thing is missing - finishing it
I need it for UI (at the end I want it look like Mathematica editor) of my symbolic math library and since I started writing the kernel couple days ago I guess there are other things to do than UI But I (generally) know how to do that, at least
--------
Dave
|
|
|
|