Form newFormWithBkgd1 = Create_Form_Background.Paint(this); Form newFormWithBkgd2 = Create_Form_Background.Paint(form2); Form newFormWithBkgd3 = Create_Form_Background.Paint(form3Etc); newFormWithBkgd1.Show(); newFormWithBkgd2.Show(); newFormWithBkgd3.Show();
My Objective: Simply to make an opaque form (which I can adjust) without
causing all of the child controls to be made opaque as well.
I "thought" I could create a new transparent form beneath it.
I figured if it was the same size, and moved as it moved all would be well.
This is a very simple idea I've made way too complicated.
Can anyone please point me in the right direction, even if it means
scrapping the code beneath. I'm willing to get to the bottom of this anyway
possible.
I just need a way to make the form opaque,
without changing the appearance of it's controls.
Note:
// this does help me for what I'm trying to do, the opacity is always 100% this.TransparencyKey = ... // also.. this does not help because parent "this" control doesn't support background colors this.BackColor = Color.FromArgb(20, 0, 70, 173);
Anyway, here is my code.
using System.Drawing;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public class Create_Form_Background
{
private static Form Foreground { get; set; }
private static Form Background { get; set; }
private static int BorderWidth { get; set; }
private static int BorderHeight { get; set; }
private static Color PaintedColor { get; set; }
private static double Opaqueness { get; set; }
public Form Paint(Form paintForeground,
string backgroundColor = "Black",
double opacity = 0.25,
int borderWidth = 25,
int borderHeight = 25)
{
Foreground = paintForeground;
PaintedColor = Color.FromName(backgroundColor);
Opaqueness = opacity;
BorderWidth = borderWidth;
BorderHeight = borderHeight;
Background = new Form();
CreateForm();
return Background;
}
private void CreateForm()
{
SetSize();
// I was going to use a simple EventHanlder for the location
SetLocation(); // Background.Location = Foreground.Location
SetBackColor();
SetOpaqueness();
SetFormBorderStyle();
SetWindowAttributes();
}
}
}

New Topic/Question
Reply




MultiQuote





|