|
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
|
|
|
|
|
Hi,
I want to implement a preview area which i want it to have a proportional size to the display resolution.
I have a workspace which is a form which is docked fill to my main window.
This is my panel size adjust function:
private void AdjustLayoutEditorSizeToDisplay(int width, int height)<br />
{<br />
int panelHeight;<br />
<br />
Console.WriteLine("Display size: " + width + " x " + height);<br />
Console.WriteLine("tpLayout size: " + this.Size.Width + "x" + this.Size.Height);<br />
Console.WriteLine("regionPanel initial size: " + regionsPanel.Size.Width + "x" + regionsPanel.Size.Height);<br />
int percent = Utility.PixelsToPercent(this.Size.Width, width);<br />
Console.WriteLine("The provided width is " + percent + "% of the maximum percentage.");<br />
<br />
if (percent > 100)<br />
{<br />
int diff = percent - 100;<br />
panelHeight = Utility.PercentToPixels(height, 100 - diff);<br />
Console.WriteLine("The height calculated based on the percentage is " + panelHeight + ".");<br />
}<br />
else<br />
{<br />
panelHeight = Utility.PercentToPixels(height, percent);<br />
Console.WriteLine("The height calculated based on the percentage is " + panelHeight + ".");<br />
}<br />
regionsPanel.Size = new Size(this.Size.Width, panelHeight);<br />
Console.WriteLine("regionPanel final size: " + regionsPanel.Size.Width + "x" + regionsPanel.Size.Height);<br />
}
I provide the resolution and suposly it will make the panel adjust its width to the workspace width and the height propotional to that.
But i found a problem, when docked, a panel seems to keep its original Size property and so it will not give me a correct proportion and it will not adjust its width to the workspace width.
WEll.. can somebody tell me if there is a turn around for this?
Thx,
Nuno
|
|
|
|
|
I am using C# and SQL 2005
for Web application How can I use TextChange event to the textbox to find the given data is exist in data base or not? Please give me an example.
please help me.
Laxmi
laxmi
|
|
|
|
|
You're asking a very top level question. The answer is, you handle the event, postback on it ( which is nasty ) and make a database call. If you can't conceptualise it on a level that's closer to the problem than that, then you shouldn't be undertaking this task.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thru AJAX you can achive this without postback
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
Thank you very much for your mail. Some of the sites having this feature.
I dont know what is the code inside. But in my project i want to implement that type of code. Please give me an example by using postback. I dont know much about ajax.
Thank you
Laxmi R
laxmi
|
|
|
|