vb@rchiv
VB Classic
VB.NET
ADO.NET
VBA
C#
Schützen Sie Ihre Software vor Software-Piraterie - mit sevLock 1.0 DLL!  
 vb@rchiv Quick-Search: Suche startenErweiterte Suche starten   Impressum  | Datenschutz  | vb@rchiv CD Vol.6  | Shop Copyright ©2000-2024
 
zurück

 Sie sind aktuell nicht angemeldet.Funktionen: Einloggen  |  Neu registrieren  |  Suchen

VB.NET - Fortgeschrittene
Re: Subtraktive Farbmischung 
Autor: Manfred X
Datum: 23.08.16 18:46

Irgend so etwas vielleicht???
Public Class frmCMYK
 
    Dim WithEvents cyan As New TrackBar With _
        {.Parent = Me, .Minimum = 0, .Maximum = 100, _
         .Top = 10, .Height = 20, .Width = 300, .TickStyle = TickStyle.None}
 
    Dim WithEvents magenta As New TrackBar With _
        {.Parent = Me, .Minimum = 0, .Maximum = 100, _
         .Top = cyan.Top + 40, .Height = 20, .Width = 300, .TickStyle = _
         TickStyle.None}
 
    Dim WithEvents yellow As New TrackBar With _
        {.Parent = Me, .Minimum = 0, .Maximum = 100, _
         .Top = magenta.Top + 40, .Height = 20, .Width = 300, .TickStyle = _
         TickStyle.None}
 
    Dim WithEvents key As New TrackBar With _
        {.Parent = Me, .Minimum = 0, .Maximum = 100, _
         .Top = yellow.Top + 40, .Height = 20, .Width = 300, .TickStyle = _
         TickStyle.None}
 
    Dim WithEvents pb As New PictureBox _
        With {.Parent = Me, .Top = key.Top + 40, .Width = 300, .Height = 200}
 
 
    Dim WithEvents cyan2 As New TrackBar With _
        {.Parent = Me, .Minimum = 0, .Maximum = 100, _
         .Top = 10, .Height = 20, .Width = 300, .TickStyle = TickStyle.None, _
         .Left = 320}
 
    Dim WithEvents magenta2 As New TrackBar With _
        {.Parent = Me, .Minimum = 0, .Maximum = 100, _
         .Top = cyan.Top + 40, .Height = 20, .Width = 300, .TickStyle = _
         TickStyle.None, _
         .Left = 320}
 
    Dim WithEvents yellow2 As New TrackBar With _
        {.Parent = Me, .Minimum = 0, .Maximum = 100, _
         .Top = magenta.Top + 40, .Height = 20, .Width = 300, .TickStyle = _
         TickStyle.None, _
         .Left = 320}
 
    Dim WithEvents key2 As New TrackBar With _
        {.Parent = Me, .Minimum = 0, .Maximum = 100, _
         .Top = yellow.Top + 40, .Height = 20, .Width = 300, .TickStyle = _
         TickStyle.None, _
         .Left = 320}
 
    Dim WithEvents pb2 As New PictureBox _
        With {.Parent = Me, .Top = key.Top + 40, .Width = 300, .Height = 200, _
              .Left = 320}
 
    Dim lblMix As New Label With _
        {.Parent = Me, .Top = pb.top + pb.height + 10, .Width = 120, _
         .Text = "Mixfaktor Farbe1 (%):"}
 
    Dim WithEvents txtMix As New TextBox With _
        {.Parent = Me, .Top = pb.top + pb.height + 10, .Width = 100, .Left = _
        130}
    Dim WithEvents pbMix As New PictureBox With _
        {.Parent = Me, .Top = txtMix.top + txtMix.height + 10, _
         .Width = 600, .Height = 200}
 
 
    Private Sub frmCMYK_Load(sender As System.Object, _
        e As System.EventArgs) Handles MyBase.Load
        Me.Width = 660
        Me.Height = 700
    End Sub
 
    Private Sub cyan_ValueChanged(sender As Object, e As System.EventArgs) _
        Handles cyan.ValueChanged, magenta.ValueChanged, _             
                yellow.ValueChanged, key.ValueChanged, _
                cyan2.ValueChanged, magenta2.ValueChanged, _
                yellow2.ValueChanged, key2.ValueChanged
        pb.Invalidate()
        pb2.Invalidate()
        pbmix.invalidate()
    End Sub
 
    Private Sub pb_Paint(sender As Object, _
        e As System.Windows.Forms.PaintEventArgs) Handles pb.Paint, pb2.Paint
 
        Dim pb As PictureBox = DirectCast(sender, PictureBox)
 
        Dim r, g, b As Byte
 
        If pb.Left = 0 Then
            CMYK2RGB(cyan.Value / 100, magenta.Value / 100, _
                         yellow.Value / 100, key.Value / 100, _
                        r, g, b)
            e.Graphics.Clear(Color.FromArgb(r, g, b))
 
        Else
 
            CMYK2RGB(cyan2.Value / 100, magenta2.Value / 100, _
             yellow2.Value / 100, key2.Value / 100, _
            r, g, b)
            e.Graphics.Clear(Color.FromArgb(r, g, b))
 
        End If
 
    End Sub
 
 
    Private Sub pbMix_Paint(sender As Object, _
        e As System.Windows.Forms.PaintEventArgs) Handles pbMix.Paint
 
        Dim mix As Double
        If Not Double.TryParse(txtMix.Text, mix) OrElse (mix < 0 Or mix > _
          100) Then
            e.Graphics.Clear(Me.BackColor)
        Else
            Dim r, g, b As Byte
 
            Dim c As Double = _
            (mix * cyan.Value) / 10000 + (1 - mix / 100) * cyan2.Value / 100
            Dim m As Double = _
            (mix * magenta.Value) / 10000 + (1 - mix / 100) * magenta2.Value / _
            100
            Dim y As Double = _
            (mix * yellow.Value) / 10000 + (1 - mix / 100) * yellow2.Value / 100
            Dim k As Double = _
            (mix * key.Value) / 10000 + (1 - mix / 100) * key2.Value / 100
 
            CMYK2RGB(c, m, y, k, r, g, b)
 
            e.Graphics.Clear(Color.FromArgb(r, g, b))
        End If
    End Sub
 
 
    Private Sub txtMix_KeyDown(sender As Object, _
        e As System.Windows.Forms.KeyEventArgs) Handles txtMix.KeyDown
 
        If e.KeyCode = Keys.Return Then pbMix.Invalidate()
    End Sub
End Class
alle Nachrichten anzeigenGesamtübersicht  |  Zum Thema  |  Suchen

 ThemaViews  AutorDatum
Subtraktive Farbmischung3.367Dilbert22.08.16 22:05
Re: Subtraktive Farbmischung1.923Manfred X22.08.16 22:55
Re: Subtraktive Farbmischung1.909Dilbert22.08.16 23:03
Re: Subtraktive Farbmischung1.975Manfred X22.08.16 23:13
Re: Subtraktive Farbmischung2.160Dilbert22.08.16 23:21
Re: Subtraktive Farbmischung1.885Manfred X23.08.16 08:52
Re: Subtraktive Farbmischung1.889Dilbert23.08.16 18:14
Re: Subtraktive Farbmischung1.987Manfred X23.08.16 18:46
Re: Subtraktive Farbmischung1.935Dilbert23.08.16 19:41
Re: Subtraktive Farbmischung2.038Manfred X23.08.16 19:47
Re: Subtraktive Farbmischung1.856Dilbert24.08.16 20:13
Re: Subtraktive Farbmischung1.955Dilbert26.08.16 17:02
CMY-Farbmischung - RGB-Farbmischung - CMY nach RGB - RGB nac...2.005visualfx26.08.16 19:47
Update: CMY-Farbmischung - RGB-Farbmischung - CMY nach RGB -...1.921visualfx26.08.16 22:10
Re: Subtraktive Farbmischung1.938Dilbert26.08.16 22:27
Re: Subtraktive Farbmischung1.884Dilbert26.08.16 22:49
Re: Subtraktive Farbmischung1.893visualfx26.08.16 23:05
=== Nachtrag ===2.018visualfx27.08.16 00:24
Wikipedia: Subtraktive Farmischung !!!1.938visualfx27.08.16 11:04
Re: Subtraktive Farbmischung1.842Dilbert27.08.16 14:27
Additive / Subtraktive / Mittelwert-Farbmischung2.049visualfx27.08.16 15:04
Re: Subtraktive Farbmischung2.040Dilbert27.08.16 15:13
Re: Subtraktive Farbmischung1.904visualfx27.08.16 15:25
Re: Subtraktive Farbmischung2.046Kuno6020.10.16 08:01
Re: Subtraktive Farbmischung1.848Dilbert20.10.16 17:37

Sie sind nicht angemeldet!
Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.

Einloggen  |  Neu registrieren

Funktionen:  Zum Thema  |  GesamtübersichtSuchen 

nach obenzurück
 
   

Copyright ©2000-2024 vb@rchiv Dieter Otter
Alle Rechte vorbehalten.
Microsoft, Windows und Visual Basic sind entweder eingetragene Marken oder Marken der Microsoft Corporation in den USA und/oder anderen Ländern. Weitere auf dieser Homepage aufgeführten Produkt- und Firmennamen können geschützte Marken ihrer jeweiligen Inhaber sein.

Diese Seiten wurden optimiert für eine Bildschirmauflösung von mind. 1280x1024 Pixel