IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VB.NET Discussion :

rectangle Multiple couleur


Sujet :

VB.NET

  1. #1
    Membre éprouvé
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2018
    Messages
    323
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2018
    Messages : 323
    Par défaut rectangle Multiple couleur
    Bonjour,

    je suis entrain de créer plusieurs class progressbar. je voudrais savoir si c'est possible avoir un rectangle avec 4 coté de couleur.

    voici en image mon rectangle avec DrawLine :
    Nom : progressbarrectanglecolor.png
Affichages : 145
Taille : 680 octets

    avez-vous une autre solution pour avoir un rectangle sens DrawLine?

  2. #2
    Membre éprouvé
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2018
    Messages
    323
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2018
    Messages : 323
    Par défaut
    Bonjour,

    est-il possible dans drawline avec startPoint et EndPoint un angle à 45 degré?

    voici en image :
    Nom : rectangle.png
Affichages : 106
Taille : 396 octets

    mon code :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    Private Sub Form1_Paint(sender As System.Object, e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
            Dim rect As New Rectangle(50, 50, 200, 50)
            Dim pointTopLeft As Point = New Point(rect.Height - 1, 10)
            Dim pointBottomLeft As Point = New Point(rect.Height - 1, rect.Height - 1)
            Dim pointTopRight As Point = New Point(rect.Width - 1, 10)
            Dim pointBottomRight As Point = New Point(rect.Width - 1, rect.Height - 1)
            e.Graphics.DrawLine(New Pen(Brushes.Red, 5), pointTopLeft, pointBottomLeft)
            e.Graphics.DrawLine(New Pen(Brushes.Green, 5), pointTopLeft, pointTopRight)
            e.Graphics.DrawLine(New Pen(Brushes.Blue, 5), pointBottomRight, pointTopRight)
            e.Graphics.DrawLine(New Pen(Brushes.Pink, 5), pointBottomLeft, pointBottomRight)
        End Sub

  3. #3
    Membre extrêmement actif
    Inscrit en
    Avril 2008
    Messages
    2 573
    Détails du profil
    Informations personnelles :
    Âge : 65

    Informations forums :
    Inscription : Avril 2008
    Messages : 2 573
    Par défaut
    bonjour
    Oui ,peut etre comme ceci :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
     
     
    Public Class ControlMiska
        Inherits UserControl
        Private Sub Miska_Paint(sender As System.Object, e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
            Dim thePen As New Pen(Brushes.Red, 10)
            thePen.Alignment = Drawing2D.PenAlignment.Center
            thePen.LineJoin = Drawing2D.LineJoin.Bevel
            thePen.SetLineCap(Drawing2D.LineCap.AnchorMask, Drawing2D.LineCap.AnchorMask, Drawing2D.DashCap.Triangle)
     
            Dim rect As New Rectangle(50, 50, 300, 150)
            Dim pointTopLeft As Point = New Point(rect.Height - 1, 10)
            Dim pointBottomLeft As Point = New Point(rect.Height - 1, rect.Height - 1)
            Dim pointTopRight As Point = New Point(rect.Width - 1, 10)
            Dim pointBottomRight As Point = New Point(rect.Width - 1, rect.Height - 1)
     
            e.Graphics.DrawLine(thePen, pointTopLeft, pointBottomLeft)
            thePen.Brush = Brushes.Green
            e.Graphics.DrawLine(thePen, pointTopLeft, pointTopRight)
            thePen.Brush = Brushes.Yellow
            e.Graphics.DrawLine(thePen, pointBottomRight, pointTopRight)
            thePen.Brush = Brushes.Pink
            e.Graphics.DrawLine(thePen, pointBottomLeft, pointBottomRight)
        End Sub
    End Class
    bon code....

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Liste multiple / couleur de cellule conditionnelle
    Par gisclace dans le forum Excel
    Réponses: 5
    Dernier message: 02/10/2020, 10h17
  2. recherche de rectangle de couleur avec Canevas
    Par helenahelena dans le forum Tkinter
    Réponses: 1
    Dernier message: 23/10/2019, 22h33
  3. Rectangles multiples Jpanel
    Par abdelilah dans le forum Débuter
    Réponses: 12
    Dernier message: 16/05/2010, 22h28
  4. Afficher un rectangle de couleur sur l'écran
    Par darkwall_37 dans le forum SDL
    Réponses: 5
    Dernier message: 11/02/2008, 14h33
  5. [VB6] RichTextBox : Multiples couleurs
    Par Jihnn dans le forum VB 6 et antérieur
    Réponses: 1
    Dernier message: 28/07/2006, 18h36

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo