|
Put a picture box control in a panel and set its SizeMode property to AutoSize and then set AutoScroll property of Panel to True.
Now draw your chart on Picture box instead of Panel.
However the most important point is that, in this scenario you will need to reset the width of Picture box according to the increasing size of Graph. Therefore you will have to measure the width of the drawn area and reset width of Picture Box.
Following is a small code snippet which I used to test, it draws a long string on a Picturebox and Panel will show scroll bar as expected.-
------------------Code Start------------------------------------------------------
private void PictureBox1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Graphics g = e.Graphics;
string str = "JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmJJJJJJJJJJJ";
g.DrawString(str, new Font("Arial", 14, FontStyle.Bold, GraphicsUnit.Pixel), Brushes.Black, 50, 50);
this.PictureBox1.Width = g.MeasureString(str, new Font("Arial", 14, FontStyle.Bold, GraphicsUnit.Pixel)).Width + 4;
}
-------------Code End--------------------------------------
I hope this will help you in finding the exact resolution.
-Dave.
Dave Traister,
ComponentOne LLC.
www.componentone.com
|
|
|
|
|
Thank you! You saved my day and got my 5.
|
|
|
|
|
Hi,
I wish to run multiple exe's using the single object of System.Diagnostics.Process class. Is it possible?
Though the other way is to make a string array containing the file names and then loop through these filenames and pass the name in the ProcessStartInfo.
If anybody has a better solution, kindly let me know.
Thanks
-----Have A Nice Day-----
|
|
|
|
|
I am having a rather weird problem with the display of information in a standard combo box. The original problem was that there was a need to toggle between two different views for the items in the combo box (say, a long name and a mnemonic). So I added a check box to the form and configured it so that the contents of the combo box are cleared out and re-added in the selected state each time the check box's checked state changes.
Upon implementation, I noticed immediately that when toggling between the two states, the whole combo box control disappears from the form (not just goes empty) when the combo box is cleared and only reappears shortly after (presumably after the first item is re-added). Some trial and error pointed me to its AutoCompleteSource property which is set to ListItems. Changing this property to something else (say, HistoryList) avoids the disappearing combo box problem, the combo box merely becomes empty and is then filled up with the items that are re-added in (as is expected). Does anyone know a workaround for this (as I would like to keep AutoCompleteSource to ListItems)? I have tried changing the AutoCompleteSource before clearing the combo box and then resetting it after but that didn't work...
cheers!
|
|
|
|
|
Hi,
I'm trying to initialize a nullable object at runtime..for that i'm using
object childnullable = System.Runtime.Serialization.FormatterServices.GetSafeUninitializedObject(Type);
The above one works fine for a normal nullable object but when it is a nullable array object it's throwing exception ...Plz help me to initialize that...
Koushik
|
|
|
|
|
Spunky Coder wrote: when it is a nullable array object it's throwing exception
What kind of exception? Can you post whole exception message and stack trace?
[ My Blog] "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
Hi...
It's throwing - [System.ArgumentException] {"Value was invalid."}
StackTrace:
at System.Runtime.Serialization.FormatterServices.nativeGetSafeUninitializedObject(RuntimeType type)
at System.Runtime.Serialization.FormatterServices.GetSafeUninitializedObject(Type type)
The type fullname is shown as
System.Nullable`1[[System.SByte, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]][]<br />
Koushik
|
|
|
|
|
str.Replace(RegularExpression,str) method.
The replace method of string cant be used with a regular expression,and string cant be inherited.
so you can use Regex object to do this job
//
<code>string strSource = "william<william@hotmail.com>", strResult;
MatchCollection mc = Regex.Matches(strSource, @"\w+?@\w+?\.(com|net)");
strResult = mc[0].ToString();</code>
//strResult = william@hotmail.com
Hope this help!
|
|
|
|
|
william.zheng wrote: (com|net)
There are a great deal more TLD's than .net and .com
|
|
|
|
|
People only count if they have a com or net domain.
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
Hi, i suppose it's common question and one has been asked many times, but all answers whats i find
no convinet for me. Since what i wan't to ask you guys whats the best convinet way to validate current object in databinding before move to another(and if one not valid prohibit to move). There is exists CurrentChanged event and not CurrentChanging, how i can emulate CurrentChanging in my code. I use dataBindingNavigator for move throught records, and sets of control that linked to my DataBinding object (not datagrid so i can't use rowvalidating and cellvalidating events).
Thanks.
|
|
|
|
|
HI : The Given Code is to store the specifications of the controls which are added to a form database is access ,here global is a class , lsave,i are variables
there is no syntax error at runtime a error is coming i.e Syntax error in insert into statement i have checked many times the database format and the format of the values both are same still the error is comming i will be thankful for ur suggestions as i am struck at this point.
OleDbConnection connection = new OleDbConnection();
connection.ConnectionString = WindowsApplication1.Properties.Settings.Default.printsoftwareConnectionString;
connection.Open();
//loop for saving the positions of the labels
OleDbDataAdapter oda = new OleDbDataAdapter("select * from controlspecifications",connection);
OleDbCommandBuilder cmb1 = new OleDbCommandBuilder(oda);
DataSet ds1 = new DataSet("controlspecifications");
oda.Fill(ds1, "controlspecifications");
DataRow dr = ds1.Tables["controlspecifications"].NewRow();
for (lsave = 0; lsave <= i; lsave++)
{
dr[0] = global.projectname + "adsfsd";
dr[1] = lab[lsave].Name;
dr[2] = Convert.ToInt32(lab[lsave].Left);
dr[3] = Convert.ToInt32(lab[lsave].Top);
dr[4] = Convert.ToInt32(lab[lsave].Width);
dr[5] = Convert.ToInt32(lab[lsave].Height);
dr[6] = lab[lsave].Text;
dr[7] = lab[lsave].Font.FontFamily;
dr[8] = Convert.ToInt32(lab[lsave].Font.Size);
dr[9] = lab[lsave].ForeColor.ToString();
dr[10] = lab[lsave].BackColor.ToString();
if (lab[lsave].Font.Bold == true)
{
dr[11] = "bold";
}
else if (lab[lsave].Font.Italic == true)
{
dr[11] = "italic";
}
else if (lab[lsave].Font.Underline == true)
{
dr[11] = "underline";
}
else
{
dr[11] = "strikeout";
}
dr[12] = "dasfsad";
ds1.Tables["controlspecifications"].Rows.Add(dr);
oda.Update(ds1, "controlspecifications");
oda.Fill(ds1, "controlspecifications");
sindhu tiwari
|
|
|
|
|
Please don't post your questions in multiple forums. It's considered rude. Choose the most appropriate forum (in this case probably the SQL forum) and post there only.
Paul Marfleet
|
|
|
|
|
|
hi all! i have a string like:
str="samir < samir@hotmail.com >"
now i want to a regular expression to get the value samir@hotmail.com using
str.Replace(RegularExpression,str) method.
can any help me.
Thanks & Regards,
SAMir Nigam
|
|
|
|
|
Here you have regex that matches email adress [A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}
|
|
|
|
|
Nigam SAMir wrote: now i want to a regular expression to get the value samir@hotmail.com using
str.Replace(RegularExpression,str) method.
You can't do that.
Use the Regex.Replace method.
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
Hello every body
I need to copy data from my dataset to an sql 2000 table with keeping the values of the identity column, so that the values of the identy column of the dataset will be coppied as it is to the Sql table that has an identity(1000,1)
I'm using C# .net 2005
please I need a help soon...
|
|
|
|
|
Use the commands set identity_insert mytable off and set identity_insert mytable on to disable and enable an identity constraint respectively.
Paul Marfleet
|
|
|
|
|
thx for u reply
but I'm using this in a command in my C# code before and after I use the datadapter.update (myDasate) but it still not working ant the ID in the sql table are generated automaticly according to the increment seed of the table
|
|
|
|
|
Use the SET IDENTITY_INSERT mytable ON statement to insert explicit values into an IDENTITY column on a particular table.
Paul Marfleet
|
|
|
|
|
Ok I got a counter going for my tabs. I have it so when ever the user creates a new tab it will count the pages in a integer. Then that number will get placed in the name at the end of the of that rich text's name. So how can I retrieve the name of the rich text box when the user clicks on the it? Then will be placed in a string, so it can be reused when a user clicks a another rich text box.
private void OnClickOfRTB(object sender, EventArgs e)
{
string WorkingOn = newRtb[_pageNumber].Name;
}
private void Paste(object sender, EventArgs e)
{
newRtb.WorkingOn.ToString.Paste();
}
So all I am asking is how can I combine a winform name into a hole string so it can be used in things like paste then convert it the string like if it was a form object.
I know this mite not be the best way to handle it, but that is all I can think of.
So if you can please help or if you need to understand my question more please ask me. My Mind keeps going back and forth on this question on how this should work.
Thanks Aj.
-- modified at 3:19 Tuesday 23rd October, 2007
|
|
|
|
|
How can i check the compressed drive or folder programmitically
naveen
|
|
|
|
|
You have asked the very same question here yesterday permalink[^] and you have got the answer there too so don't double post
|
|
|
|
|
First you are posting same queries again, following is the link of your post made yesterday, which was replied by Guffa-
Previous Post[^]
Second-
You posted your issue and when one user asked you to clarify the point, you made another post, you should have replied on the same post, this is your First Post[^] which you made today about the same issue.
I can not understand why are you doing this.
-Dave.
Dave Traister,
ComponentOne LLC.
www.componentone.com
|
|
|
|