Weird text in RichTextBox c# - c#

I need to do something like paint, the only differ, you can draw on screen. When user click on a tool (pen, line, rect, text etc.) I take screenshot of the screen and put it as background image for a second full screen form. Then by handling mouse events draw on it. Im trying to follow MS Paint and draw text using third form with a RichTextBox inside it. This form must be transparent, and after I'll take new screenshot and load as background of second form.
This is code for third form which is transparent.
this.FormBorderStyle = FormBorderStyle.None;
this.TransparencyKey = Color.Turquoise;
this.BackColor = Color.Turquoise;
richTextBox1.BackColor = this.BackColor;
As you can see, text is being light blue. This is my problem.

I did not find a way how to fix that, and I decided to use label instead. By handling key press event and making label back color transparent I got expected result.
enter image description here

Related

I have a picture box with an image without background but it only takes the color of the form as background

I'm doing the table game battleship, by moving pictures boxes with the mouse, the problem is that all the picture boxes that I have contain an image without background, but i have the problem that when I move it through different points, it shows a default background instead of showing the background of the "map". This messes the aspect of the game table.
I've tried this code in my program ,but it makes the ships default position is in the panel(which I do not want) and it doesn't solve the problem I described earlier (when you move ships over the others spaces)
Barco1.Parent = panel1;
Barco1.BackColor = Color.Transparent;
An example of one of the ships
As you can see in the picture, there are:
Form with a BackgroundImage,
Panel with BackColor = Color.Transparent and BackgroundImage = some-image and
PictureBox with BackColor = Color.Transparent and an image as its Image property.
It should work for you.
It looks like You are setting the Image background as Transparent but You are adding that Image into another Panel!
Barco1.Parent = panel1;
So, Set the Background Color of the Panel1 as Transparent:
panel1.BackgroundColor=Color.Transparent;

Overlaying some picturebox on VisualStudio with C#

Good afternoon!
I have several user controls, each one with a picture box containing an image. A user control represents the backgroud and the other two are elements that must be overlayed.
pictureBox_background.BackColor = Color.Black;
pictureBox_A.BackColor = Color.Transparent;
pictureBox_background.Controls.Add(pictureBox_A);
pictureBox_background.Controls.Add(pictureBox_B);
pictureBox_B.SendToBack();
pictureBox_A.BringToFront();
With this code I get the picturebox A is over picturebox B, but I can not make the background of the element A is the image of the picturebox B. The pictureBox A reaches the background picturebox, and it's background is the black color of the background picturebox.
That is, the transparency of picturebox_A don't shows the picturebox_B, shows the black background, without showing the image of the medium (picturebox_B).
It's a little hard to explain. I hope it was understood.
Thanks in advance!

Make Form Transparent

I am trying to make a transparent form that will be shown on the bottom right corner of the screen. In that form, I have an image as a background that I am rotating. The issue is, when I use the following code to make the form transparent, I am getting outlines on the image that is equivalent to the color I set for the transparency key/background. Is this because of the image, or is there a way to fix this programmatically?
CODE:
this.TransparencyKey = Color.Orange;
this.BackColor = Color.Orange;
This gives me an orange outline around my image.
You can't make the border transparent but you can get rid of it altogether.
To get rid of the border you would use this.
FormBorderStyle = FormBorderStyle.None;

Transparent controls in .NET

I have a problem with:
BackColor = Color.Transparent;
It's not working correctly. I have a form with a blue background, and a picturebox with a picture loaded in it. It's not actually taking what's in the picture, but rather - the form's background color. Please tell me there's a simple way to go around this?
What you see in the following screenshot is a custom usercontrol with it's backColor set to transparent, on top of a picture, in a form with a blue background.
I need the usercontrol to display what's UNDER it, as real transparency, it should be showing the gradient and part of the image.
Try setting the picture box to be the parent of the custom user control.
myControl.Parent = this.myPictureBox;
Try calling "SetStyle(ControlStyles.SupportsTransparentBackColor, true);" on your user control constructor.
more details at: http://msdn.microsoft.com/en-us/library/wk5b13s4(v=vs.90).aspx

WinForms draw a non transparent string into a transparent form

I'm building an app in which I have to show a semitransparent form. I need to draw some text on that form too, to let the user know some info.
However, the strings I draw are also semitransparent and are difficult to read. I was wondering if there is a way to draw a non transparent string into a semitransparent form.
I'm using .NET 4.0, C# and WinForms technology.
For the moment I use the DrawString method on the Graphics form, but using a Label had no effect at all tho.
Browsing StackOverflow I found this How do I make my form transparent, but what I draw on it not? but it refers to WPF, and I'm using plain old WinForms.
Cheers.
This might help you - it will give you a fully transparent form with non-transparent text:
in InitializeComponent:
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
TransparencyKey = BackColor;
ShowInTaskbar = false;
FormBorderStyle = FormBorderStyle.None;
in OnPaint override:
g.DrawString(...) // Use some SolidBrush.
However, if you don't want fully transparent form (this won't sound nice but should work), then you can use TWO forms: One with semi transparent background, no text. Other one (on top of the previous one) with fully transparent background and non-transparent text. You can bind location, size and visibility of one form to another to keep them in synch.

Categories

Resources