|
Is there no additional overhead, in terms of MSIL code, to pull this off?
What about the alternative of creating an additional function that had the "shared" code that both constructors could use?
In your opinion, wouldn't this produce cleaner code?
Cheers,
Simon
"Every good work of software starts by scratching a developer's personal itch.", Eric S. Raymond
|
|
|
|
|
Again, its personal preference. In overhead terms, there really is nothing to pull off; the initial constructor does generate a call to the target constructor. If you were going to supply a common private initialization member, it may accomplish the same thing with or without parameter passing. If your initialization member is parameterized, I would venture a guess that it carries the same amount of overhead.
Regards
|
|
|
|
|
In terms of cleaner code, if the class carries a significant amount of initialization that is common across all constructors, yes a shared initialization member can be cleaner.
I have also seen cases where these initialization members also become a reset mechanism for the class. Not that this is a bad thing, but in large projects and/or as time goes on and maintenance coding kicks in, it may be easier for a member of your team to forget what the primary purpose of the member was and start calling virtual members within it, which is a bad thing.
My two cents.
Regards
|
|
|
|
|
When I owner-draw my ListBox with this code:
private void listBox1_DrawItem(object sender, DrawItemEventArgs e)
{
e.DrawBackground();
ListBox listBox = (ListBox)sender;
bool selected = ((e.State & DrawItemState.Selected) == DrawItemState.Selected) ? true : false;
string displayText = listBox.Items[e.Index].ToString();
if(displayText.IndexOf("Sökresultat:") != -1)
{
if(selected == true)
{
e.Graphics.DrawString(displayText, new Font(this.Font, FontStyle.Bold), Brushes.White, e.Bounds);
}
else
{
e.Graphics.DrawString(displayText, new Font(this.Font, FontStyle.Bold), Brushes.Black, e.Bounds);
}
}
else
{
if(selected == true)
{
e.Graphics.DrawString(displayText, this.Font, Brushes.White, e.Bounds);
}
else
{
e.Graphics.DrawString(displayText, this.Font, Brushes.Black, e.Bounds);
}
}
}
When I add an item with a button the first item in the LisyBox will not be painted, when I click on it, it appears!"#?=`?=
What is wrong!!
Rickard Andersson@Suza Computing
ICQ#: 50302279 (Add me!)
E-mail: nikado@pc.nu
I'm from the winter country SWEDEN!
|
|
|
|
|
Hi Friends
I wrote a C# ADO.NET Application and deployed it in a another Machine,
I installed the .Net Framework and ado 2.7,C# client app is working but the Ado is not working. Error says it can't find the ADODB.DLL Assembly.
How to setup the ADO.Net?
Thanks
Gaurika..
Gaurika Wijeratne. // www.gaurika.com
|
|
|
|
|
Maybe you did it in the wrong order!
Install MDAC 2.7 first.
Then install the .NET redistributable.
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Dear Nish.
I did it , but still it's not working , any idea ?
Thanks.
Gaurika.
Gaurika Wijeratne. // www.gaurika.com
|
|
|
|
|
Gaurika,
Are you deploying your app manually or with a 3rd party P&D type product?
Cheers,
Simon
"Every good work of software starts by scratching a developer's personal itch.", Eric S. Raymond
|
|
|
|
|
Dear Simon
I am deploying it manually , I installed the frame work and ado from the .Net Installatoin cd's
Gaurika.
Gaurika Wijeratne. // www.gaurika.com
|
|
|
|
|
I declare a export class in dll project in vc6 project.
How can i import it into c#?
I know we can use DllImport to make use of dll such as win32 api.
But have no idea of importing a class.
Any suggestion?
|
|
|
|
|
I don’t believe you can Interop with a class defined this way directly. You will either have to COM’ify the class, or build a managed wrapper around it in MC++, or rebuild it under VS.NET as a managed class.
Regards
|
|
|
|
|
I wrote a class library and named its namesapce "Mazdak.WebModule.Module1" and there is a class in it with "DBObject".Now in ANOTHER project I want to write another class and inherit it from my first class and name it "User" class.Now how can I import my first namespace and declare second class?
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
In your second project add a reference to the first (if they are in the same project use the Project's tab, else reference the dll created in the first project).
Now in your second project extend it like you would any other class, ie
using Mazdak.WebModule.Module1;<br />
public class User : DBObject .
Good Luck,
James
Simplicity Rules!
|
|
|
|
|
Thank you James.It was very simple.I don't know why I forgot it.
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
How to set bold style on a specific item?
Rickard Andersson@Suza Computing
ICQ#: 50302279 (Add me!)
E-mail: nikado@pc.nu
I'm from the winter country SWEDEN!
|
|
|
|
|
well I found an example here:
http://samples.gotdotnet.com/quickstart/howto/doc/WinForms/WinFormsOwnerDrawListBox.aspx
Rickard Andersson@Suza Computing
ICQ#: 50302279 (Add me!)
E-mail: nikado@pc.nu
I'm from the winter country SWEDEN!
|
|
|
|
|
Thanks good. Next time maybe you should mention that it is a List Box item you were trying to set
--
David Wengier
Sonork ID: 100.14177 - Ch00k
|
|
|
|
|
But I have problems with the code!
I don't know how to get the text from the item to be drawn in the dra item method!!
Can you help me!?
Rickard Andersson@Suza Computing
ICQ#: 50302279 (Add me!)
E-mail: nikado@pc.nu
I'm from the winter country SWEDEN!
|
|
|
|
|
Rickard Andersson wrote:
don't know how to get the text from the item to be drawn in the dra item method!!
If it is an owner drawn listbox, you could just access the Item array for the item you are drawing.
Items[e.Index].ToString()
Where 'e.Index' is the DrawItemEventArgs item passed into the DrawItem.
Rocky Moore
|
|
|
|
|
Aah!
Just what I were looking for!
Than you!
Rickard Andersson@Suza Computing
ICQ#: 50302279 (Add me!)
E-mail: nikado@pc.nu
I'm from the winter country SWEDEN!
|
|
|
|
|
hi all,
I am using MSFLexGrid in in one of our projects which is being implemented in C#. I am trying to dock a ComboBox in one of the MSFlexGrid cells. The problem is that the CellWidth, CellTop, CellLeft and CellHeight properties are all returned in values which are not of the same coordinate system type as the container which holds MSFLexgrid and the combobox. So to position the combobox properly over the flexgrid i need the conversion factor between the four properties mentioned above.
e.g. CellWidth property set in my case is 845, where as the entire FLexGrid Width is somewhere around 136. Obviously a small cell of the grid cannot have width larger then the containing flexgrid. So you can see that the Flexgrid width is in terms of the space occupied by the flexgrid on the container form whereas the internal CellWidth is in terms of some other unit of measurement. How do it find a conversion factor?
regards,
vivek
|
|
|
|
|
Is this happening to anyone else? How can I fix it?
Cathy
Life's uncertain, have dessert first!
|
|
|
|
|
Cathy wrote:
Is this happening to anyone else? How can I fix it?
What are you running?
beta 1? beta 2? final release?
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
The final release.
BTW I saw Monsoon Wedding last night. It was very good! (It did make me cry though. I even went out to smoke a cigarette to make it stop but not even that worked.) So I know people asked you this question before but I forgot your answer. Was it an accurate portrayal of life there?
Cathy
Life's uncertain, have dessert first!
|
|
|
|
|
Cathy wrote:
BTW I saw Monsoon Wedding last night.
I never saw the movie, Cathy. What's it about? Is it based in India?
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|