I want use my tooltip text as string.
When i try this MessageBox.Show(chart1.Series["Series1"].LegendToolTip); ===> Output: #MIN-#MAX
MessageBox.Show(chart1.Series["Series1"].LegendToolTip.toString()); ===> Output: #MIN-#MAX
i want output string is "1-49".
MyChart Image
I don't think you can let the chart evaluate the ToolTip without the respective mouse actions.
But similar to Marton's suggestion you can evaluate the ToolTip formula yourself, maybe like this:
Series S1 = chart1.Series["Series1"];
string legendToolTip = S1.Points.FindMinByValue("Y1").YValues[0] +
" - " + S1.Points.FindMaxByValue("Y1").YValues[0] ;
MessageBox.Show(legendToolTip );
Related
I have text1 and text2, now i want to compare text1 and text2 and identify differences with highlighted color by which word are removed and which are added and display in text3, Red color will be removed color and green color will be added color.
I will display text3 in WebBrowser control so text3 display as htmlfile and look proper with color.
Example:
Below is my code but i have some problems in it.
In for loop oldt.Length is more newt[i] last index, so it gives error "Index was outside the bounds of the array."
From oldText last two word are removed "Category: javascript", but in my output result I want this two words in strike tag because this words are removed from oldtext.
string oldText = "Name: justin Parker Link: http://github.com/jparkerweb/htmldiff-example About: html diff poc Description: front-end lib to show what has changed between html blocks Category: javascript";
string newText = "Name: Justin Parker Link: http://github.com/jparkerweb/htmldiff-example About: HTML diff example Description: front-end lib to show differences between HTML blocks";
string result = "";
string[] oldt = oldText.Split(' ');
string[] newt = newText.Split(' ');
for (int i = 0; i < oldt.Length; i++)
{
if (oldt[i] == newt[i])
{
result += oldt[i].ToString() + " ";
}
else
{
result += "<strike><font color='red'>" + oldt[i].ToString() + "</font></strike>" + "<u><font color='Green'>" + newt[i].ToString() + "</font></u>" + " ";
}
}
Load both words of text1 and text2 to an array using Split and compare each array index for match. Do your logic on comparison while looping do determine if replaced, removed or added by moving to each index and checking the succeeding and preceding index values.
Good luck coding!!!
I have string label = 20. I have added label prefix as "Goal" .in between i added \n . Two lines are not coming instead one line only appearing.I need Expected Output.
Expected Output:
Goal
20
ActualOutput:
Goal20
I have tried below methods, its not working
string label = Goal;
string cReturns = System.Environment.NewLine + "\n" + "\r";
string[] words = label.Split(cReturns.ToCharArray());
label = words +20;
or
label = "Goal\n20";
CAN ANYONE SUGGEST ME CORRECT ANSWER
Thanks
You try
instead of \n:
label = "Goal
20";
If i add drawtext in customview its not working
You could strip the \n and then offset the Y to get your text on the next line.
For Example :
string lab = "Goal";
canvas.DrawText(lab, 100, 100, p);
canvas.DrawText("20", 100, 150, p);
Effect.
using System.Environment.NewLine will help.
for example:
await MainPage.DisplayAlert("Connection Problem!", "Can't
access backEnd at the moment Please try again later!"
+ System.Environment.NewLine + ex.Message,
"OK");
I want to show 2 text file on one richtextbox.for example a.txt(text direction : right to left)and b.txt(text direction :left to right)
I use these codes:
richTextBox1.LoadFile(Application.StartupPath + "\\database\\a.txt");
string x = richTextBox1.Text;
richTextBox1.AppendText(System.Environment.NewLine);
richTextBox1.LoadFile(Application.StartupPath + "\\database\\b.txt");
richTextBox1.AppendText(x);
richTextBox1.AppendText(System.Environment.NewLine);
richTextBox1.Focus();enter code here
but when run these codes,all lines direction in richtextbox are left to right.how can solve this problem?
You should work with RTF property of the RichTextBox.
First load the content of files a.txt and b.txt to YourFirstTextFileString and YourSecondTextFileString.
Second your code should be:
string rtfsource="{\rtf1\fbidis\ansi\ansicpg1256\deff0\deflang1025{\fonttbl{\f0\fnil\fcharset0 Calibri;}}";
rtfsource = rtfsource + "\\ltrpar "+YourFirstTextFileString
rtfsource = rtfsource + "\\par\\rtlpar "+YourSecondTextFileString +"\\par"
rtfsource = rtfsource + "}"
// Set the rtf format to the richtextbox.
richTextBox1.RTF = rtfsource;
Content of the YourFirstTextFileString will appear Left-To-Right and YourFirstTextFileString will appear Right-To-Left in the RichTextBox.
I'm using a Xceed.Wpf.Toolkit.RichTextBox that displays text saved in RTF. I've got a contextual menu that add some multi lines text at the caret position using this code
var text = "Line1" + Environment.NewLine + "Line2"
richTextBox.CaretPosition.InsertTextInRun(text);
It displays as I expect
Line1
Line2
When I save and reload the text (saved in RTF), it displays as this:
Line1Line2
When I look in the RTF code, it is saved without the CR and LF...
Why my CR/LF vanished? What is the solution to insert multi line text at the caret position?
I found how to do:
var text = "Line1" + Environment.NewLine + "Line2"
richTextBox.Control.Selection.Text = text;
Set RichTextBox.AcceptsReturn to True
http://social.msdn.microsoft.com/Forums/vstudio/en-US/f044f15b-48a4-485c-91c0-07a0828acb98/acceptsreturn-in-a-wpf-richtextbox
Hi i am doing a small project in C#, and i need to know what commands are comming from input source so i can do my work accordingly..
here is example...
textBox1.Text = "First line \nSecond line";
richTextBox1.Text = "First line \nSecond line";
Richtextbox shows this output:
First line
Second line
Textbox show this output:
First line Second line
please tell me how to show new line "\n" or return "\r" or similar input as a character output in text or richtextbox. so i can know that newline command is coming from input data.
for example text or richtext box will show this output.
First line \nSecond line
thankx in advance.
Lets say that i have a string which have new line :
string st = "my name is DK" + Environment.NewLine + "Also that means it's my name";
Now that i want to show that there is new line in my text there you go :
textBox1.Text = st.Replace(Environment.NewLine, "%");
This will show the newline chat with % sign
For winforms application set
this.textBox1.Multiline = true;
and use "\r\n" as
textBox1.Text = "First line \r\nSecond line";
You want to either prefix your string with # or you can use a double slash before each n (\n). Both of these are ways of escaping the \ so that it displays instead of being treated as part of a new line.
#"This will show verbatim\n";
"This will show verbatim\\n";
You can utilize this by performing a Replace on your incoming text
richTextBox1.Text = richTextBox1.Text.Replace("\n", "\n\\n");
richTextBox1.Text = richTextBox1.Text.Replace("\r\n", "\r\n\\n");
In the replace, I left the original linebreak so that it will be there, just followed by the displaying version. You can take those out if you dont want that. :)
Use the combination "\r\n" (or Environment.NewLine constant which contains just that).
Change Your text box property from single line to Multiline then it will change to new line
TextBox1.TextMode = TextBoxMode.MultiLine;
TextBox1.Text = "First line \n New line ";
TextBoxt1.Text ="FirstLine \r\n SecondLine";