Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best Practice for drawing lines
Message
De
26/02/2006 10:09:42
 
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Divers
Thread ID:
01099235
Message ID:
01099258
Vues:
15
This message has been marked as the solution to the initial question of the thread.
Chad,

The color looks fine to me (the inset line looks just like the line around a GroupBox), but if you want to use SystemColors, you can do that too (SystemColors.ControlDark and SystemColors.Window seems to be the same as what you used with Gray & White).

As far as being a best practice ... I don't know why it wouldn't be. Although the Graphics class has a lot of different methods for drawing all kinds of shapes, but if all you're drawing is lines, then this sure seems good enough to me. The other method for doing this might be DrawLines() which uses an array of Points.

Now, I've not used any of this in "real life", just played with it a little just now, so take my replies with a grain of salt. <g> Perhaps someone with more experience with Graphics may chime in here, but I did want to at least mention the bit about the colors.

~~Bonnie




>Hi all,
>
>I can do some code like this in a form:
>
>using (Graphics g = this.CreateGraphics())
>{
>    using (Pen p = new Pen(Color.Gray),
>        s = new Pen(Color.White))
>    {
>        g.DrawLine(p, 200, 200, 600, 200);
>        g.DrawLine(s, 200, 201, 600, 201);
>    }
>}
>
>This gives me an inset line. But, the color doesn't exactly match that of those types of lines found elsewhere in the OS and other apps like the IDE itself. And even at that, this doesn't really seem like it is the right/best way to do this. Hopefully you can tell what kind of line I'm after, so what is the right/best way to do this? And if this method is right, how do I find the right color? It would seem to me that it should be a system color or variation of a system color.
>
>TIA,
>Chad
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform