I'm making a very simple text editor and I'd like to color the background of the whole selected line (left to right). And I'd like it to follow the cursor so if I go down two lines the background changes.
I'm looked a lot on here and google and found nothing interesting, it always colors the text instead of the background and it does not color the entire line, etc.
Any suggestions are welcome!
Thanks!
I am not sure you can easily color the full line where the caret is in the standard RichTextBox control, I think I mostly heard only the background of already entered text could be colored.
If you are not forced to stay with the standard RichText you can have a look at this:
ScintillaNET
this editor has an incredible amount of features, the only thing is that I am not sure if it supports many different fonts otr picture embedding, tables and so on.
if ScintillaNET is nout enough either I would then try with DevExpress components for Windows Forms, extremely feature rich and powerful, in theri demo they have basically made a text editor with tables, mailmerge and so many other things it looks almost like MS Word.
Related
Using VS2013, C#.NET 4.5, and WinForms. Migrating to WPF is not an option at this point.
The standard checkbox control handles 2-state and 3-state modes, but I need a 4-state checkbox. I can't find a 4-state checkbox library on the net anywhere, so I'm assuming I'll have to make one (if y'all know of one, that'd be great).
I have a set of four PNGs as draft images of the checkbox appearance, and I have played around with just painting those on a button and having the button_click event cycle through which image is displayed and update the data value. This doesn't seem to scale the image with the button well, though, and it feels kludgy to load static bitmaps instead of vector drawing the images so they're always to scale.
Is there a way to inherit from the checkbox control itself and add a fourth state?
If so, where do I go to override how the states are drawn? I need to do it "correctly" so that if the form is Scaled, the checkbox doesn't end up looking all bitmap-nasty.
I'm not even sure what keywords to use to search for how to do the actual drawing.
Background:
I'd generally consider this to be a nasty UI choice, but I'm making a program that saves, loads, and displays a "World of Darkness" character sheet of any arbitrary system, and the WoD games use a 4-state injury that's represented on the sheet by an empty box, a box with one slash across it, a box with an X across it, or a box with a 4-stroke asterix across it (optionally, a filled box).
For the moment I'm going with matching the original with high fidelity; later, as an option, I'll let the user switch to radio buttons to support my own preference.
This is my first real exploration of GUI programming beyond the basics, so I'm not sure quite how to proceed.
EDIT: I'm delving into a UserControl now, and my own draw methods. What fun. Found an MSDN tutorial on User-Drawn Controls, seems like a good starting place.
I'm working on a program using C# and WPF and I was curious about getting the text color of some text I have to change dynamically based on what the background image I set is.
The background images are loaded by random (I will have no control over what they are) and I need to maintain readability of the fonts depending on what it is.
As you can see here: http://i.gyazo.com/820c45dde9d767dcd7ab2a92bd1de898.png
With this background image set, there's no way to read what the text has to say. Meanwhile, it would look fine on a lighter background.
Basically what I think needs to happen is
Get the most used color in that image
Find out if it's a "light or dark color"
Change the text accordingly
How could I do this? Whether it's programmatically or in the WPF XAML (i'm still new to using WPF so bear with me there).
Thanks in advanced,
Mike
I would agree that trying to select a text colour dynamically isn't ideal. Even if you select a colour that makes some of the text visible there is no guarantee it won't pass through a portion of your images which hides it.
Personally I would use a label with a white background but reduce the background opacity to show some part of the image behind. That way your text will always sit on a lightened area and dark text will always work.
Andy.
I have no clue if this is possible or not as I'm new to C#. But is it possible to make a Windows Forms look like the picture? Where you have a
gradient at top
alternating color rows
change the default text color
change the default highlight color
change the way the scroll bar looks
If so, are there tutorials for these someone can point me to?
Gradient effects will take tedious paint task. You have some example here
Alternating Row Colors,
datagridview1.AlternatingRowsDefaultCellStyle.BackColor= Color.Blue;
Change Text Color
datagridview1.RowsDefaultCellStyle.ForeColor = Color.Red;
Change Highlight Color
`datagridview1.RowsDefaultCellStyle.SelectionBackColor = Color.Pink;
As far as I know scroll-bar will have the look of your current system theme and cant be change that easily unless you write your own code for it.
Regarding skinning (gradients, custom scroll bar): WinForms are a wrapper around Win32 native controls. They were not designed with visual appearance customization in mind. It is possible but will require an awful lot of work: There is nothing comparable to CSS in WinForms.
An arguably easier alternative would be WPF.
Of course, the most straightforward might be to look for a 3rd party component such as Krypton's DataGrid (free).
I'm attempting to create a program in C# that would allow dynamic wrapping across rich text box controls. For example, I begin typing in one available control, as soon as a horizontal scrollbar would appear and the rich text box wraps to the next line, it would instead create a new rich text box control underneath and place my cursor there. This method would also need to support moving text back and forth between controls in the case of deleting/changing existing text.
Why you ask? My church requires a program that will allow easily pasting text and it automatically going across as many slides as needed which supports different fonts, sizes, weights, colors, and undo and redo. All this would need to be done on the fly so the user does not need to use some sort of preview mode to go back and forth to accomplish what they're trying to do.
I assume this is for something like order of service, or words to hymns? The solution for that is to use the scrollbar or the PgDn button. In a Web Browser.
I agree with Chris Ballard. Really, this doesn't look like the right way to solve your problem.
In a richtextbox I see there's DetectURLs and an event to go along with that...
Is there a way to set up a word or series of words to act as a hyperlink even though they are not a hyperlink? My specific use is that I'm writing a ticker program that will scroll information across the bottom of the screen, I would like for some information to be clickable without putting the long, messy URL of the target. Anyway I can do this?
Links with arbitrary text in a RichTextBox
http://www.codeproject.com/Articles/9196/Links-with-arbitrary-text-in-a-RichTextBox