|
ArtiGujare wrote: Confusion-A) The designer of MyClass1 opens fine even if 1) or 2) is used.
That's good.
ArtiGujare wrote: Confusion-B) assuming I use method 2)
OK, I am not sure but this is what I expect is happening:
- the line private Class2 _obj=null; does not do much: it reserves a 4 (or 8) byte
reference which is defaulted to zero; it does not need to know what Class2 actually is,
so the compiler will insist on knowing Class2, but at run-time Class2 is not needed,
since there is no code corresponding to this line.
- the line _obj=null; in the constructor is assigning to a variable of type Class2; at
run-time this is the first time Class2 is referenced, so the JIT will try to load and
compile it (although the statement does not require any knowledge of Class2, by definition
this is when Class2 needs to get initialized). Now at design time (which also runs the
constructor), it will fail to find the dll containing Class2 since it searches relative
to the location of Visual itself, not your project. This I guess is the issue you must
solve, but no I do not know how.
Hope this helps.
|
|
|
|
|
Hi,
Im trying to trim a peice of text, the below code is how i do it:
StringFormat stringFormat = new StringFormat();<br />
stringFormat.Trimming = StringTrimming.EllipsisCharacter;<br />
Font font = new Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold, GraphicsUnit.Pixel);<br />
RectangleF rect = new RectangleF((float)Layout.X + 25, (float)Layout.Y + 10, (float)Layout.Width - 25, (float)Layout.Height - 10);<br />
<br />
g.DrawString(nodeTag.NodeName, font, Brushes.Black, rect, stringFormat);
Layout is the rect values of a node i draw, i then draw the text on top, and if its to big, trim it. The problem im having is that instead of trimming the text and replacing the charactors with "...", it puts the affect text on a new line which i dont want to happen.
Any ideas?
Regards,
Gareth.
|
|
|
|
|
Hi Gareth,
I guess your rect is too high; I expect DrawString to trim only if the text does not fit
the given rect.
Remedy: reduce rect.Height or add StringFormat.NoWrap to your StringFormat.
|
|
|
|
|
Hi Luc,
As you suggested, StringFormatFlags.NoWrap fixed my problem.
Thanks,
Gareth.
|
|
|
|
|
Hi there.
I have the following XML file:
resource identifier="6B3B1BD6_FB84_4B23_8B50_29E6EAA07429" width="380" height="280" type="image/jpeg">
uri>img012.jpg");
}
}
|
|
|
|
|
hi
i want to extend the standard DataGridView in vs 2005 mySelf, and i want to add footer to DataGridView,this is my code to override paint method :
public partial class ExGridView : DataGridView<br />
{<br />
private int _footerHeight;<br />
public ExGridView()<br />
{<br />
InitializeComponent();<br />
_footerHeight = 20;<br />
}<br />
<br />
public int FooterHeight<br />
{<br />
get<br />
{<br />
return _footerHeight;<br />
}<br />
set<br />
{<br />
if (_footerHeight != value)<br />
{<br />
_footerHeight = value;<br />
Invalidate();<br />
}<br />
}<br />
}<br />
<br />
protected override void OnPaint(PaintEventArgs e)<br />
{<br />
base.OnPaint(e);<br />
Rectangle rOrginal = this.ClientRectangle;<br />
Rectangle rFooter = new Rectangle(0, this.Height, this.Width, _footerHeight);<br />
e.ClipRectangle.Offset(0, _footerHeight);<br />
e.Graphics.DrawRectangle(Pens.Black, rFooter);<br />
e.Graphics.DrawString("Test", this.Font, Brushes.Black, new PointF((float)rFooter.X + 10, (float)rFooter.Y + 5)); <br />
}<br />
}
but when compile my app and add myControl (ExGridView) to my form, nothing occured, where does problem and how to solve it ?
|
|
|
|
|
Hello,
I am adding a bunch of usercontrols to a flow layout panel, but it takes a very long time for the controls to show up in the flowpanel. Is there a way to speed up the process? There are almost 600 controls that are added to the flowpanel.
Thank you
|
|
|
|
|
Are you creating the controls individually and then adding them to the panel by calling panel.Controls.Add ?
You might want to create your controls and add them to an array or List<Control> . Once all of the controls have been created, add them to the panel by calling panel.Controls.AddRange .
This should provide some noticeable speed improvements. Also, be sure to call SuspendLayout before you start adding controls and then
ResumeLayout<code> when you are done. <br />
<br />
<div class="ForumSig">-----------------------------<br />
In just two days, tomorrow will be yesterday.</div>
|
|
|
|
|
i need to make a pdf and zip file in my code,but it makes error !
at first it was because of vjslib and vjscore dlls ,but i call to the host ,and they add these dll to .net framework,now it cause new error
"Exception of type java.lang.ExceptionInInitializerError was thrown"
how could i solve it?
please help me.
|
|
|
|
|
Hello again every buddy,
I'm trying to use a few shortcut keys in my Windows Form I'm using C# 2.0 and I wanted to makea functionality such that the control goes to a toolStripTTextBox after the user presses the combination of CTRL+G.
thanks in advance
Rocky
|
|
|
|
|
Hi,
I see two ways of achieving this:
- use keyboard events to detect G key and check for simultaneous CTRL key
(with Control.ModifierKeys)
- or use a MenuItem in some Menu, and give it the right Shortcut.
Finally, in the relevant handler call myCcontrol.Focus().
|
|
|
|
|
I would like to serialize a Data Class to an XML File. I know this was possible with Enterprise Library 2006 Jan version using 2 or 3 lines of Code. Any info if this is possible in System.Configuration of .NET 2.0 or Enterprise Library 3.0 version?
Example class:
Public partial class Employee
{
public int ID;
public string Name;
public Address empAddress;
}
public partial class Address
{
public string firstLine;
public string secondLine;
}
I would like to serialize the Employee Class to a Config file. (let's say EmpData.config)
Appreciate a quick response on this.
-- modified at 8:42 Tuesday 12th June, 2007
|
|
|
|
|
You don't need the EntLib to serialize your class. Use XmlSerializer
XmlWriter writer = XmlWriter.Create("EmpData.config");<br />
XmlSerializer serializer = new XmlSerializer(typeof(Employee));<br />
serializer.Serialze(writer, employee);
only two letters away from being an asset
|
|
|
|
|
Thanks for your input.
I don't want to use XMLSerializer. Is this possible using EntLib or System.Configuration?
I remember something was there in EntLib 1.1 - Configuration.Write(FileName, Object);
Something similar in EntLib or in C# 2.0?
|
|
|
|
|
Is there something wrong with XmlSerializer? I'll give you a hint, Configuration.Write does the same thing, uses XmlSerializer.
only two letters away from being an asset
|
|
|
|
|
No issue... Just wanted to understand if there is any equivalent in EntLib 3.0 or C# 2.0 ?
No idea why the same thing is removed in new version of EntLib.
|
|
|
|
|
I have currency values in a dropdownlist that are formatting to look like $50, $100 etc using {0:C0}
I need to remove the $ symbol before converting the string to an Int32
I tried using LoanAmount.Replace("$", ""); but this doesnt work.
What should I be doing ?
|
|
|
|
|
digsy_ wrote: I tried using LoanAmount.Replace("$", ""); but this doesnt work.
Well, how did you used it? Assuming LoadAmount is string, you must do LoadAmount = LoadAmount.Replace("$", "") or use another string variable because strings are immutable types, original string CANNOT change.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
string s="$400";
s=s.substring(1,3);
int amnt=Convert.toInt32(s);
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Would work fine if the amounts were all three digits. What happens with $50 or $4000?
only two letters away from being an asset
|
|
|
|
|
I was merely explaining the principle, the code can be modified to handle the full length of the string.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Thomas Stockwell wrote: string s="$400";
s=s.substring(1,3);
int amnt=Convert.toInt32(s);
What if it's $4000
s=s.substring(1,s.Length);
int amnt=Convert.toInt32(s);
There are 10 types of people in the world, those who understand binary and those who dont.
|
|
|
|
|
digsy_ wrote: I tried using LoanAmount.Replace("$", ""); but this doesnt work.
This will work: string temp=LoanAmount.Replace("$", "");
|
|
|
|
|
Assuming you are using .NET Framework v2.0 or later, you can use the Int32.TryParse(String, NumberStyles, IFormatProvider, Int32) method[^].
For the NumberStyles parameter, you probably want to use NumberStyles.Currency .
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
Hey
I created one windows service and created the set and deployment project for that
I installed this service successfully at the client machine
now I want to see each step of the installation process on the client machine
Is byy default windows installer creating the install.log file or we have to create it?
if it is by default whats the location of the file?
or if we have to create how can it be?
please guide me...
Thanks in advance
|
|
|
|