Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > .NET Languages
You last visited: Today at 13:14

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[C#]Farbcode in einem Pixel

Discussion on [C#]Farbcode in einem Pixel within the .NET Languages forum part of the Coders Den category.

Closed Thread
 
Old   #1
 
BlendedMed's Avatar
 
elite*gold: 212
Join Date: Apr 2010
Posts: 2,777
Received Thanks: 1,353
[C#]Farbcode in einem Pixel

hey ich möchte den farbcode in einem pixel bekommen und habe folgendes versucht:

Code:
[...]
using System.Threading;

namespace WindowsFormsApplication41
{
    public partial class Form1 : Form
    {
        public int Yreihe = 0;

        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //Thread.Sleep(4000);
            Bitmap bmp = new Bitmap(System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width,
                                    System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height);
            Yreihe = MousePosition.Y;

            for (int i = 400; i < 900; i++)
            {
                Color pixelColor = bmp.GetPixel(i, Yreihe);
                if (pixelColor.ToString() != "Color [A=0, R=0, G=0, B=0]")
                {
                    MessageBox.Show(pixelColor.ToString());
                }
            }
        }
    }
}
jedoch finde ich auf diese methode keine farben in der reihe pixel.
gibt es nicht ein befehl wo man auf den bitmap verzichten könnte?

mfg
sixkay
BlendedMed is offline  
Old 01/01/2012, 20:32   #2
 
elite*gold: 42
Join Date: Jun 2008
Posts: 5,425
Received Thanks: 1,888
Dir ist aber schon bewußt, dass jeder Pixel in bmp die Farbe (0,0,0) hat, oder? ;o
MoepMeep is offline  
Thanks
1 User
Old 01/01/2012, 20:37   #3
 
BlendedMed's Avatar
 
elite*gold: 212
Join Date: Apr 2010
Posts: 2,777
Received Thanks: 1,353
Quote:
Originally Posted by MoepMeep View Post
Dir ist aber schon bewußt, dass jeder Pixel in bmp die Farbe (0,0,0) hat, oder? ;o
ah mist
kenn mich mit pixelsearch noch nicht aus aber wie soll ich es dann schreiben?
BlendedMed is offline  
Old 01/01/2012, 20:42   #4
 
elite*gold: 42
Join Date: Jun 2008
Posts: 5,425
Received Thanks: 1,888
Wenn du schon so einen pixelseach **** machen willst, dann mach halt einen Screenshot und lad ihn in bmp.
MoepMeep is offline  
Old 01/01/2012, 20:44   #5
 
BlendedMed's Avatar
 
elite*gold: 212
Join Date: Apr 2010
Posts: 2,777
Received Thanks: 1,353
Quote:
Originally Posted by MoepMeep View Post
Wenn du schon so einen pixelseach **** machen willst, dann mach halt einen Screenshot und lad ihn in bmp.
ne ist für game da soll eine bestimmte reihe von pixeln nach einer bestimmten farbe abgesucht werden.
BlendedMed is offline  
Old 01/01/2012, 20:47   #6
 
elite*gold: 42
Join Date: Jun 2008
Posts: 5,425
Received Thanks: 1,888
Quote:
Originally Posted by Sixkay View Post
ne ist für game da soll eine bestimmte reihe von pixeln nach einer bestimmten farbe abgesucht werden.
Und? Verfahren ist das gleiche, lol.
MoepMeep is offline  
Old 01/01/2012, 20:49   #7
 
BlendedMed's Avatar
 
elite*gold: 212
Join Date: Apr 2010
Posts: 2,777
Received Thanks: 1,353
Quote:
Originally Posted by MoepMeep View Post
Und? Verfahren ist das gleiche, lol.
jede milli sec ein bild zu machen und ein pixel suchen ist nicht das wahre
BlendedMed is offline  
Old 01/01/2012, 20:51   #8
 
elite*gold: 42
Join Date: Jun 2008
Posts: 5,425
Received Thanks: 1,888
Quote:
Originally Posted by Sixkay View Post
jede milli sec ein bild zu machen und ein pixel suchen ist nicht das wahre
Und wieso willst du dann unbedingt pixelsearch nutzen? :>
MoepMeep is offline  
Old 01/01/2012, 20:54   #9
 
BlendedMed's Avatar
 
elite*gold: 212
Join Date: Apr 2010
Posts: 2,777
Received Thanks: 1,353
Quote:
Originally Posted by MoepMeep View Post
Und wieso willst du dann unbedingt pixelsearch nutzen? :>
weil man nicht umbedingt ein bild absuchen muss sondern auch den bildschirm nach einer farbe überprüfen kann
BlendedMed is offline  
Old 01/01/2012, 20:56   #10
 
elite*gold: 42
Join Date: Jun 2008
Posts: 5,425
Received Thanks: 1,888
Quote:
Originally Posted by Sixkay View Post
weil man nicht umbedingt ein bild absuchen muss sondern auch den bildschirm nach einer farbe überprüfen kann
Wenn du doch weißt wie es geht, wieso fragst du dann?
MoepMeep is offline  
Old 01/01/2012, 20:59   #11
 
BlendedMed's Avatar
 
elite*gold: 212
Join Date: Apr 2010
Posts: 2,777
Received Thanks: 1,353
Quote:
Originally Posted by MoepMeep View Post
Wenn du doch weißt wie es geht, wieso fragst du dann?
ich kenne die nötigen befehle leider nicht
ich danke dir trozdem
BlendedMed is offline  
Old 01/01/2012, 21:01   #12
 
elite*gold: 42
Join Date: Jun 2008
Posts: 5,425
Received Thanks: 1,888
Na, dann sag das doch.
MoepMeep is offline  
Old 01/01/2012, 21:33   #13
 
BlendedMed's Avatar
 
elite*gold: 212
Join Date: Apr 2010
Posts: 2,777
Received Thanks: 1,353
habs raus

für leute die später auch das prob haben und hier rein schauen:
Code:
  using System.Runtime.InteropServices;

  sealed class Win32
  {
      [DllImport("user32.dll")]
      static extern IntPtr GetDC(IntPtr hwnd);

      [DllImport("user32.dll")]
      static extern Int32 ReleaseDC(IntPtr hwnd, IntPtr hdc);

      [DllImport("gdi32.dll")]
      static extern uint GetPixel(IntPtr hdc, int nXPos, int nYPos);

      static public System.Drawing.Color GetPixelColor(int x, int y)
      {
       IntPtr hdc = GetDC(IntPtr.Zero);
       uint pixel = GetPixel(hdc, x, y);
       ReleaseDC(IntPtr.Zero, hdc);
       Color color = Color.FromArgb((int)(pixel & 0x000000FF),
                    (int)(pixel & 0x0000FF00) >> 8,
                    (int)(pixel & 0x00FF0000) >> 16);
       return color;
      }
von:

#close pls
BlendedMed is offline  
Closed Thread


Similar Threads Similar Threads
FarbCode wiedergabe
07/16/2011 - AutoIt - 17 Replies
Hallo Jungs leider finde ich den Fehler nicht. Die Var $Read3 ist richtig aber $Farbe ist null warum und wie löse ich das Problem. Func _Pruefen() $Read1 = GUICtrlRead($Input1,1) $Read2 = GUICtrlRead($Input2,1) $Read3 = GUICtrlRead($Input3,1) $Farbe = StringFormat("%d\t", $Read3)
Wie finde ich den Farbcode?
06/09/2010 - General Coding - 3 Replies
Hey Liebe Community, Mein Freund ist bei einem Script so einem Farbcode begegnet. 0x0080C0 Solch einen Farbcode brauch ich für diese Farbe http://s1.directupload.net/images/100609/temp/wrx 9kn4u.jpg
Farbcode Grüner items gesucht
08/09/2005 - World of Warcraft - 12 Replies
genau. also zum beispil nen... scharlachroter helm des falken oder so, die farbe der überschrift. von dem grün brauch ich nen hexadezimalen code. danke sehr!



All times are GMT +1. The time now is 13:15.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.