Example #1
0
        public void InitializeBackgroundObject()
        {
            Size tempSize;

            if (DockSettings.Shape.Shape == "Ellipse")
            {
                tempSize = new Size((int)((float)DockSettings.EllipseParams.MinHeight * DockSettings.EllipseParams.AspectRatio),
                                    DockSettings.EllipseParams.MinHeight);
            }
            else //(DockSettings.Shape.Shape == "Circle")
            {
                tempSize = new Size(DockSettings.CircleParams.MinRadius * 2, DockSettings.CircleParams.MinRadius * 2);
            }
            BackgroundObject = new BaseDockObjects.BackgroundObject(this, LanguageWords, DockSettings, "Background", tempSize);

            // MainForm handles all the location and sizing of the objects
            BackgroundObject.Location = new Point(SystemInformation.VirtualScreen.Right / 2 - tempSize.Width / 2,
                                                  SystemInformation.VirtualScreen.Bottom / 2 - tempSize.Height / 2);
            BackgroundObject.DrawBitmapManaged(tempSize.Width, tempSize.Height, false, 0, 0, false, 0, 0, 0, 0, false, 0);

            Bitmap DrawBackground = new Bitmap(tempSize.Width, tempSize.Height);

            using (Graphics gr = Graphics.FromImage(DrawBackground))
            {
                gr.SmoothingMode      = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                gr.PixelOffsetMode    = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
                gr.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
                gr.InterpolationMode  = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;

                //gr.DrawImage(Bitmap, new Rectangle(0, 0, scaleWidth, scaleHeight), new Rectangle(0, 0, Bitmap.Width, Bitmap.Height), GraphicsUnit.Pixel);
                Bitmap textureimage    = new Bitmap(Application.StartupPath + @"\System\Background\Skins\Brushed\Brushed.png");
                Brush  texturebrush    = new TextureBrush(textureimage);
                Brush  texturepenbrush = Brushes.LightGray;

                float penWidth   = 5f;
                Pen   texturepen = new Pen(texturepenbrush, penWidth);

                gr.DrawEllipse(texturepen, penWidth, penWidth, (float)tempSize.Width - penWidth * 2, (float)tempSize.Height - penWidth * 2);
                //gr.FillEllipse(texturebrush, 0, 0, tempSize.Width, tempSize.Height);
                BackgroundObject.SetBitmapManaged(ref DrawBackground);
            }
            BackgroundObject.DrawBitmapManaged(tempSize.Width, tempSize.Height, false, 0, 0, false, 0, 0, 0, 0, false, 0);

            BackgroundObject.Show();
            BackgroundObject.BringToFront();
        }
Example #2
0
 public void ChildMoved(BaseDockObjects.BackgroundObject ChildObject)
 {
 }