منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب
مشروع يتيح للمستخدم استخراج الألوان من الصور - نسخة قابلة للطباعة

+- منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب (http://vb4arb.com/vb)
+-- قسم : قسم لغة السي شارب C#.NET (http://vb4arb.com/vb/forumdisplay.php?fid=175)
+--- قسم : قسم امثلة ومشاريع C#.NET (http://vb4arb.com/vb/forumdisplay.php?fid=179)
+--- الموضوع : مشروع يتيح للمستخدم استخراج الألوان من الصور (/showthread.php?tid=49039)



مشروع يتيح للمستخدم استخراج الألوان من الصور - العتيق - 08-06-24

الهدف:

هدف المشروع هو إنشاء تطبيق يتيح للمستخدم استخراج الألوان من الصور.

المكونات الرئيسية:
PictureBox (صندوق الصورة): يُستخدم لعرض الصورة المحددة من قبل المستخدم.
TextBox (مربع النص): يُستخدم لعرض مسار الصورة المحددة.
Button (زر التصفح): يُستخدم لتحميل الصورة من ملف.
ListBox (قائمة الألوان): تُستخدم لعرض الألوان المستخرجة من الصورة.
Label (التسمية): يُستخدم لعرض تفاصيل اللون المحدد.
كيف يعمل؟
يقوم المستخدم بالنقر على زر "تصفح" لاختيار صورة من ملفه الشخصي.
بعد تحميل الصورة، يمكن للمستخدم النقر على أي نقطة في الصورة.
عند النقر، يتم استخراج لون البكسل المحدد وعرضه في Label بالإضافة إلى عرض اسم اللون إن وجد في ListBox.
الأشياء التي يمكن تحسينها:
إضافة مزيد من التفاصيل لكيفية استخراج الألوان مثل قيمة الألفا والمزيد.
إضافة ميزات إضافية مثل حفظ الألوان المستخرجة في ملف أو تحديد الألوان المشابهة.
تحسين واجهة المستخدم وتوفير خيارات أكثر لتخصيص العرض والوظائف.


RE: مشروع يتيح للمستخدم استخراج الألوان من الصور - Taha Okla - 08-06-24

مشروع جيد وبسيط .. بارك الله فيك.

--
لدي تعديل بسيط على المشروع : لتجاوز أخطاء منطقة التحديد في حال الصور الصغيرة، ومن أجل عرض الصور الكبيرة،
نبدل الكود الموجود في نافذة كود التصميم (Designer) بالكود التالي :

كود :
namespace ColorSnap
{
   partial class Form1
   {
       /// <summary>
       /// Required designer variable.
       /// </summary>
       private System.ComponentModel.IContainer components = null;

       /// <summary>
       /// Clean up any resources being used.
       /// </summary>
       /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
       protected override void Dispose(bool disposing)
       {
           if (disposing && (components != null))
           {
               components.Dispose();
           }
           base.Dispose(disposing);
       }

       #region Windows Form Designer generated code

       /// <summary>
       /// Required method for Designer support - do not modify
       /// the contents of this method with the code editor.
       /// </summary>
       private void InitializeComponent()
       {
           this.txtFilePath = new System.Windows.Forms.TextBox();
           this.btnBrowse = new System.Windows.Forms.Button();
           this.lblColor = new System.Windows.Forms.Label();
           this.pictureBox = new System.Windows.Forms.PictureBox();
           this.listBoxColors = new System.Windows.Forms.ListBox();
           this.panel1 = new System.Windows.Forms.Panel();
           ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
           this.panel1.SuspendLayout();
           this.SuspendLayout();
           //
           // txtFilePath
           //
           this.txtFilePath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
           | System.Windows.Forms.AnchorStyles.Right)));
           this.txtFilePath.Location = new System.Drawing.Point(9, 17);
           this.txtFilePath.Name = "txtFilePath";
           this.txtFilePath.Size = new System.Drawing.Size(548, 20);
           this.txtFilePath.TabIndex = 0;
           //
           // btnBrowse
           //
           this.btnBrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
           this.btnBrowse.Location = new System.Drawing.Point(563, 15);
           this.btnBrowse.Name = "btnBrowse";
           this.btnBrowse.Size = new System.Drawing.Size(75, 23);
           this.btnBrowse.TabIndex = 1;
           this.btnBrowse.Text = "Browse";
           this.btnBrowse.UseVisualStyleBackColor = true;
           this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click);
           //
           // lblColor
           //
           this.lblColor.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
           this.lblColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
           this.lblColor.Location = new System.Drawing.Point(644, 15);
           this.lblColor.Name = "lblColor";
           this.lblColor.Size = new System.Drawing.Size(165, 23);
           this.lblColor.TabIndex = 4;
           this.lblColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
           //
           // pictureBox
           //
           this.pictureBox.Location = new System.Drawing.Point(3, 3);
           this.pictureBox.Name = "pictureBox";
           this.pictureBox.Size = new System.Drawing.Size(318, 283);
           this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
           this.pictureBox.TabIndex = 3;
           this.pictureBox.TabStop = false;
           this.pictureBox.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pictureBox_MouseClick_1);
           //
           // listBoxColors
           //
           this.listBoxColors.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
           | System.Windows.Forms.AnchorStyles.Right)));
           this.listBoxColors.FormattingEnabled = true;
           this.listBoxColors.Location = new System.Drawing.Point(644, 44);
           this.listBoxColors.Name = "listBoxColors";
           this.listBoxColors.Size = new System.Drawing.Size(165, 394);
           this.listBoxColors.TabIndex = 4;
           //
           // panel1
           //
           this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
           | System.Windows.Forms.AnchorStyles.Left)
           | System.Windows.Forms.AnchorStyles.Right)));
           this.panel1.AutoScroll = true;
           this.panel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
           this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
           this.panel1.Controls.Add(this.pictureBox);
           this.panel1.Location = new System.Drawing.Point(9, 43);
           this.panel1.Name = "panel1";
           this.panel1.Size = new System.Drawing.Size(629, 395);
           this.panel1.TabIndex = 5;
           //
           // Form1
           //
           this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
           this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
           this.BackColor = System.Drawing.Color.White;
           this.ClientSize = new System.Drawing.Size(822, 450);
           this.Controls.Add(this.panel1);
           this.Controls.Add(this.listBoxColors);
           this.Controls.Add(this.lblColor);
           this.Controls.Add(this.btnBrowse);
           this.Controls.Add(this.txtFilePath);
           this.Name = "Form1";
           this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
           this.Text = "التقاط الألوان";
           this.Load += new System.EventHandler(this.Form1_Load);
           ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
           this.panel1.ResumeLayout(false);
           this.panel1.PerformLayout();
           this.ResumeLayout(false);
           this.PerformLayout();

       }

       #endregion

       private System.Windows.Forms.TextBox txtFilePath;
       private System.Windows.Forms.Button btnBrowse;
       private System.Windows.Forms.Label lblColor;
       private System.Windows.Forms.PictureBox pictureBox;
       private System.Windows.Forms.ListBox listBoxColors;
       private System.Windows.Forms.Panel panel1;
   }
}
ثم نغلق نافذة عرض التصميم[Design]، ثم نعرضها من جديد ليتم عليها التعديل..