|
IIRC you have to use the SelectionColor to do this. For instance:
int pos = RichTextBox1.Text.Length;
RichTextBox1.SelectionStart = pos;
RichTextBox1.SelectionColor = Color.Red;
RichTextBox1.Text += "try red";
pos = RichTextBox1.Text.Length;
RichTextBox1.SelectionStart = pos;
RichTextBox1.SelectionColor = Color.Green;
RichTextBox1.Text += " try green";
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Sorry
Not working,
THNKS,
Have Fun
Never forget it
|
|
|
|
|
Try this:
int pos = rtb.Text.Length;
rtb.Font = new Font(rtb.Font.FontFamily, rtb.Font.Size);
rtb.Text += "Hello";
rtb.SelectionStart = pos;
rtb.SelectionLength = 5;
rtb.SelectionColor = Color.Red;
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Wow, It Works
THNKS A million
Have Fun
Never forget it
|
|
|
|
|
Hi,
I am beginner in C#. I have a problem while coding in C#. The problem is somewhere in the application, i need to change the color of a Title bar of a window. Yes, title bar is where system menu, minimize,maximize buttons are located. Can anybody help me in doing this in C#? Pls help me ASAP... Thanks in advance
Regards,
Jitin
|
|
|
|
|
coder_help wrote: title bar is where system
Jus tas u said, i'ts System based
Change Yuor Compuetr Theme and u'll see That i'ts Changes also
I never Heard That U can Do This
Have Fun
Never forget it
|
|
|
|
|
if this is really a critical requirement , you can make the form
borderless and create your own title bar
(3 buttons a label and change the color of the label)
When you get mad...THINK twice that the only advice
Tamimi - Code
|
|
|
|
|
I want to this in C#. as per your suggestion, if i carry on then i need to handle lot of functionality for the title bar... what do u think for alternative functionality? pls reply me..
|
|
|
|
|
Is there any simple alternative ?
|
|
|
|
|
no. you have to do it all yourself. a lot of effort for a small result.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I just did this and wondered the same thing. For the Title Bar, you have to create a bool (for example, mouseIsDown to false), picturebox, and three buttons. Then, for that picturebox, look for the MouseDown, MouseMove, and MouseUp events. THen, in MouseDown, have the bool set true. In mouseMove:
blah blah event<br />
{<br />
if (mouseIsDown == true)<br />
(change the form location to reach the mouses)<br />
}
Then, in MouseUp, set mouseIsDown to false.
There's more to it, but I hope it gives you the idea.
Good luck
- "Achieving all knowledge does not mean achieving all wisdom."
- "What's THIS button do... ... ... ?"
|
|
|
|
|
some skins may do that,but i forgot its' name
CSharper
|
|
|
|
|
Dear all,
I have this scenario:
I want to have a chart on which i plot 4 lines .. i.e. 4 line graphs. This means that somehow I have to use more than I series.
Any idea on how to create an appropriate data source for this. I already have a class named coordinate which has an x value and a y value. The thing i am missing is how to put multiples of these in order to have 4 serieses.
Thanks a lot,
Chris
|
|
|
|
|
ChrisFarrugia wrote: I already have a class named coordinate
ChrisFarrugia wrote: how to put multiples of these in order
Maybe a collection?
|
|
|
|
|
Thanks a lot for your reply but I think I did not manage to explain well what i meant.
What I want is a way to have 4 coordinates collections each of which representing a line graph on the same axis.
I hope I made myself clearer.
Thanks Chris
|
|
|
|
|
ChrisFarrugia wrote: I want is a way to have 4 coordinates collections
So if you can have a collection of coordinates can't you have a collection of coordinate collections? You have not provided any specific problem definition. It seems you just don't know how to use collections.
|
|
|
|
|
Hello
I have currently made a small colorpicker application.
I want to know if it is possible to change the global cursor when I press a button in my application, the reason is I want to see the crooshair cursor outside my application too.
I have searched the internet and the best thing I could find was to use the "user32.dll" with the function SetSystemCursor, however I have no clue if this is the right thing to do.
the SetSystemCursor needs an 'IntPtr hcur, uint id' but I do not know how to get the correct values for them.
I searched the msdn from my vs05 and it said the id could must be some constants which needs to be defined before loading the windows.h header.
To help people help me, the link for pinvoke.net is here: pinvoke.net
and the link for the info I used on msdn: msdn
I hope someone can help me
regards
QzRz
|
|
|
|
|
Well, this works for me:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace WindowsCursorTest
{
public partial class Form1 : Form
{
private const int OCR_NORMAL = 32512;
[DllImport("user32.dll")]
static extern bool SetSystemCursor(IntPtr hcur, uint id);
[DllImport("user32.dll")]
static extern bool DestroyCursor(IntPtr hcur);
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
IntPtr cursor = Cursors.Cross.CopyHandle();
SetSystemCursor(cursor, OCR_NORMAL);
DestroyCursor(cursor);
}
}
}
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
It works for me too, thanks
I just have 2 questions now.
Where did you find the number for ORC_NORMAL?
and how to chance the cursor back to normal again?
I will assume what you need to do is add another const int with another value which?
|
|
|
|
|
Well, the normal way to do this is to copy the old cursor (using CopyCursor) and then reinstate it when you need to.
QzRz wrote: Where did you find the number for ORC_NORMAL?
I googled OCR_NORMAL to find the value. BTW - the value for OCR_CROSS is 32515.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I got it to work now, thanks
|
|
|
|
|
No problem. Glad to help.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi, I have an unbound DataGridView which I have added two columns to (in the designer): one DataGridViewTextBoxColumn and one DataGridViewCheckBoxColumn. Now I want to add rows to the DataGridView and be able to check and uncheck the cells under the DataGridViewCheckBoxColumn. I use the following code to add a new row but I can't get it to work.
int rowIndex = myDataGridView.Rows.Add();
DataGridViewRow row = myDataGridView.Rows[rowIndex];
row.Cells["columnText"].Value = "some text";
row.Cells["columnCheckBox"].Value = true;
Anyone knows how I can get this to work?
/thanks
|
|
|
|
|
First Of all
thay "Nice" to add rows or handle them :
Object[] Row = { false };<br />
dataGridView1.Rows.Add(Row);<br />
Just Set the Propery of Enable Editing
Adn Thats it
Have Fun
Never forget it
|
|
|
|
|
Sorry but I don't get it..
|
|
|
|