Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Create a Better looking panel?

Create a Better looking panel?

Scheduled Pinned Locked Moved C#
graphicshelpquestion
2 Posts 2 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Carlos Adriano Portes
    wrote on last edited by
    #1

    Hi My UserControl does not look properly, I would like very much someone to help me adjusting it, it only paints well when it is a perfect rectangle otherwise it does not! I would like a panel with this look but when resized displays perfect as well Here is the code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Text; using System.Windows.Forms; using System.Drawing.Drawing2D; using System.Drawing.Extended; namespace Teste17 { public partial class UserControl5 : UserControl { public UserControl5() { InitializeComponent(); } private void UserControl5_Paint(object sender, PaintEventArgs e) { LinearGradientBrush linearGradientBrush = new LinearGradientBrush(this.ClientRectangle, Color.Black, Color.Black, 45, false); ColorBlend colorBlend = new ColorBlend(); colorBlend.Positions = new float[4]; colorBlend.Positions[0] = 0.00f; colorBlend.Positions[1] = 0.49f; colorBlend.Positions[2] = 0.51f; colorBlend.Positions[3] = 1.00f; colorBlend.Colors = new Color[4]; colorBlend.Colors[0] = Color.FromKnownColor(KnownColor.Window); colorBlend.Colors[1] = Color.FromKnownColor(KnownColor.Window); colorBlend.Colors[2] = Color.FromKnownColor(KnownColor.ControlDark); colorBlend.Colors[3] = Color.FromKnownColor(KnownColor.ControlDark); linearGradientBrush.InterpolationColors = colorBlend; e.Graphics.SmoothingMode = SmoothingMode.HighQuality; ExtendedGraphics extendedGraphics = new ExtendedGraphics(e.Graphics); Pen pen = new Pen(linearGradientBrush); extendedGraphics.DrawRoundRectangle(pen, 0, 0, this.Width - 1, this.Height - 1, 5); } } } The code of using System.Drawing.Extended; is from a friend here in codeproject which name I cannot remenber at the moment...

    P 1 Reply Last reply
    0
    • C Carlos Adriano Portes

      Hi My UserControl does not look properly, I would like very much someone to help me adjusting it, it only paints well when it is a perfect rectangle otherwise it does not! I would like a panel with this look but when resized displays perfect as well Here is the code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Text; using System.Windows.Forms; using System.Drawing.Drawing2D; using System.Drawing.Extended; namespace Teste17 { public partial class UserControl5 : UserControl { public UserControl5() { InitializeComponent(); } private void UserControl5_Paint(object sender, PaintEventArgs e) { LinearGradientBrush linearGradientBrush = new LinearGradientBrush(this.ClientRectangle, Color.Black, Color.Black, 45, false); ColorBlend colorBlend = new ColorBlend(); colorBlend.Positions = new float[4]; colorBlend.Positions[0] = 0.00f; colorBlend.Positions[1] = 0.49f; colorBlend.Positions[2] = 0.51f; colorBlend.Positions[3] = 1.00f; colorBlend.Colors = new Color[4]; colorBlend.Colors[0] = Color.FromKnownColor(KnownColor.Window); colorBlend.Colors[1] = Color.FromKnownColor(KnownColor.Window); colorBlend.Colors[2] = Color.FromKnownColor(KnownColor.ControlDark); colorBlend.Colors[3] = Color.FromKnownColor(KnownColor.ControlDark); linearGradientBrush.InterpolationColors = colorBlend; e.Graphics.SmoothingMode = SmoothingMode.HighQuality; ExtendedGraphics extendedGraphics = new ExtendedGraphics(e.Graphics); Pen pen = new Pen(linearGradientBrush); extendedGraphics.DrawRoundRectangle(pen, 0, 0, this.Width - 1, this.Height - 1, 5); } } } The code of using System.Drawing.Extended; is from a friend here in codeproject which name I cannot remenber at the moment...

      P Offline
      P Offline
      Patrick Etc
      wrote on last edited by
      #2

      I suggest you abandon System.Drawing.Extended; it has some problems that are fundamental and honestly it's not that flexible. If you're willing to download a larger framework, the most beautiful extended Panel I have ever seen comes from the Ascend.Net project: http://www.codeplex.com/ASCENDNET[^] Absolutely beautiful set of controls.

      ------------ Cheers, Patrick

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups