Visual Basic Online Course - Graphics Part 2

بسم الله الرحمن الرحيم
اليوم بمشيئة الله تعالى نتحدث عن الألون فى الفيجوال بيزك 6



الألــــــــــوان فى الفيجوال بيزك 6 - Colors

لاحظ أن كل طرق الرسم Graphics تستخدم الألون Colors , و اذا لم يحدد لون معين فان اللون المحدد بخاصية الـ Foreground هو الذى يسود أو يستخدم.
اللون فى حد ذاته هو رقم سداسى عشرى HexaDecimal نوعه (Long Integer) و النظام السداسى عشر هو نظام للعد مثل النظام الثنائى Binary و النظام الثمانى Octal و النظام العشرى Decimal و معنى الـ HexaDecimal أن كل خانه رقم تحتمل 16 احتمال مرتبة كالاتى (0 1 2 3  4 5 6 7 8 9 A B C D E F) و هذا ليس موضوعنا الان و لكن لنتعرف أكثر على مكون كود الألوان المستخدمه فى الـ Visual Basic و ايضا تستخدم فى Adobe PhotoShop .
و هناك بعض الاختصارات الرمزية للألوان فى الفيجوال بيزك حيث يقدم 8 اختصارات ثابته لبعض الألوان الاساسيه المستخدمه فى الـ Graphics وهى :


Constant         Value               Color


   vbBlack            0x0                    Black
vbRed               0xFF                 Red
   vbGreen           0xFF00            Green
     vbYellow          0xFFFF            Yellow
vbBlue              0xFF0000       Blue
        vbMagenta      0xFF00FF       Magenta
  vbCyan            0xFFFF00       Cyan
    vbWhite            0xFFFFFF       White



دالة الـ QBColor :
و الـ QBasic هو نسخه قديمة من الفيجوال بيزك 6 حيث تم تطوير لغة الـ BasicA الاولى الى GW Basic ثم QBasic و كانت تستخدم 16 لون تم اعادة استخدامهم فى دالة داخل الفيجوال بيزك باسم QBasic+رقم اللون  من الجدول التالى :



Index           Color              Index              Color

    0                Black                 8                   Gray

    1                Blue                   9                   Light blue
    2                Green                10                 Light green
    3                Cyan                 11                  Light cyan
    4                Red                   12                  Light red
    5                Magenta           13                  Light magenta
    6                Brown              14                  Yellow
    7                White                 15                  Light (bright) white

دالة الـ RGB :
حيث الـ R هى Red و الـ G هى الـ Green والـ B هى الـ Blue و تستخدم الدالة فى توليد اكثر من 16 مليون لون و كود هذه الداله هو :
RGB(RED , GREEN , BLUE)

حيث كلا من الـ Red و الـ Green و الـ Blue هى ارقام تمثل كثافة اللون المستخدم لأن المفروض اللون الناتج عباره عن مزيج من الـ 3 ألوان السابقه و نسبة دخول كل لون من الألوان الثلاثه السابقه يحدد بمقياس يبدأ من (0) أقل كثافة أو حضور للون الى (255) اكبر كثافه أو حضور للون فاذا اردنا انتاج لون أسمر Black فان المزيج سيكون (0, 0, 0) و فى حالة لون أبيض سيكون (FF , FF , FF) حيث F هى أعلى سطوع و فى حالة لون أخضر سيكون كالتالى :
نسبة الأحمر Red = 0
نسبة الأخضر Green = F
نسبة الازرق Blue = 0
و مثال سريع على الألوان و استخدامها فى الفيجوال بيزك انشأ Form عليها Label و PictureBox و فى الحدث Form_Load اكتب الكود :
Form1.BackColor = vbGreen
Picture1.BackColor = QBColor(3)
Label1.BackColor = RGB (100 ,100, 100)

و لاحظ النتيجه .... قم بتطبيق المثال السابق !

و الى هنا نكون قد انتهينا من دروس الرسم Graphics فى الفيجوال بيزك 6 .
أرجو من الله أن أكون أفدت و لم أكتم علم .
أى سؤال يكون على شكل تعليق أو فى الصفحه على الفيسبوك Visual Basic Language

Comments

  1. Fantastic goods from you, man. I have understand your stuff previous to
    and you're just extremely excellent. I really like what you've acquired here, certainly like what you're saying and the way
    in which you say it. You make it enjoyable and you still care
    for to keep it smart. I can not wait to read far more from you.

    This is really a wonderful site.

    Also visit my page :: CammieUHinde

    ReplyDelete
  2. Fabulous, what a web site it is! This web site gives useful
    data to us, keep it up.

    my site :: BryonPFranzone

    ReplyDelete
  3. Hi there I am so grateful I found your blog, I really
    found you by mistake, while I was browsing on Aol for
    something else, Nonetheless I am here now and would just like to
    say thanks for a fantastic post and a all round entertaining blog (I also
    love the theme/design), I don’t have time to read it all at the minute but I have book-marked it and also added
    in your RSS feeds, so when I have time I will be back to read
    much more, Please do keep up the great work.

    Look at my webpage :: DarellPSechang

    ReplyDelete
  4. I really like your blog.. very nice colors & theme. Did you make this website yourself or did you
    hire someone to do it for you? Plz reply as I'm looking to design my own blog and would like to find
    out where u got this from. cheers

    Visit my blog post - EvelynISchumucker

    ReplyDelete
  5. Hey there, I think your website might be having browser
    compatibility issues. When I look at your blog in Firefox, it looks fine
    but when opening in Internet Explorer, it has some overlapping.

    I just wanted to give you a quick heads up! Other then that, awesome blog!


    My blog - BridgettOBras

    ReplyDelete
  6. Hi! I just want to offer you a huge thumbs up for your excellent information you have here
    on this post. I am returning to your site for more soon.

    Visit my site :: DebbraYPanowicz

    ReplyDelete

Post a Comment

visual basic 6 source code says (Hi)

VB6 Popular Posts

Visual Basic Online Course - Function Keys (F1 to F12)

VB 0.6 - Save Files Using DialogBox Control

Free download Visual Basic 6 Documentation MSDN