تفاعل المستخدم

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

أي من الخيارات التالية يمثل بشكل أفضل الغرض الرئيسي من التفاعل مع المستخدم في برمجة #C؟

  • عرض رسائل ثابتة للمستخدم دون السماح بأي إدخال أو تعديل.
  • السماح للمستخدم بإدخال البيانات والتأثير على العمليات داخل التطبيق. (correct)
  • تقييد وصول المستخدم إلى وظائف معينة في التطبيق.
  • تحسين أمان التطبيق عن طريق منع المستخدم من رؤية التعليمات البرمجية.

ما هي الخاصية في عنصر مربع النص (Textbox) التي تحدد ما إذا كان مربع النص سيقبل سطراً واحداً فقط من النص أم عدة أسطر؟

  • Scrollbars
  • MaxLength
  • PasswordChar
  • MultiLine (correct)

في برمجة #C، ما هو الغرض الأساسي من 'Method'؟

  • تنفيذ إجراء أو مهمة محددة على كائن. (correct)
  • تحديد مظهر وأسلوب عنصر واجهة المستخدم.
  • تحديد مجموعة من الخصائص.
  • تخزين البيانات المتعلقة بالكائن.

أي من الخصائص الآتية لمربع النص (Textbox) تُستخدم لإخفاء النص المدخل، وعرض رموزاً بدلاً منه (مثل النجوم)؟

<p>PasswordChar (D)</p> Signup and view all the answers

ما هو الأمر الذي يجب استخدامه لإنهاء تطبيق #C بالكامل؟

<p>Application.Exit() (B)</p> Signup and view all the answers

أي جزء من مربع الرسالة (MessageBox) يسمح لك بتعيين النص الذي يظهر في أعلى النافذة؟

<p>Title (C)</p> Signup and view all the answers

عند استخدام MessageBox.Show في #C، أي جزء من الأمر يحدد الأزرار التي ستظهر في مربع الرسالة؟

<p>Buttons (B)</p> Signup and view all the answers

أي جزء من الأمر ()MessageBox.Show يسمح لك بتعيين أيقونة معينة لتظهر على مربع الرسالة?

<p>Icons (D)</p> Signup and view all the answers

باستخدام خاصية Scrollbars في #C، ما هي القيمة التي يجب عليك تعيينها إذا كنت تريد أن يكون لديك أشرطة تمرير أفقية ورأسية؟

<p>Both (B)</p> Signup and view all the answers

في مربع نص #C، ما هي الخاصية التي تحدد الحد الأقصى لعدد الأحرف التي يمكن للمستخدم إدخالها؟

<p>MaxLength (D)</p> Signup and view all the answers

أي خاصية تُستخدم للحصول على النص الذي تم تحديده حالياً في مربع نص؟

<p>SelectedText (B)</p> Signup and view all the answers

عندما تريد تغيير اتجاه النص في مربع نص من اليسار إلى اليمين، أي خاصية يجب عليك تعديلها؟

<p>RightToLeft (D)</p> Signup and view all the answers

أي خاصية يجب استخدامها لتغيير حالة الأحرف في عنصر مربع النص؟

<p>CharacterCasing (D)</p> Signup and view all the answers

أي من الإجراءات التالية تمسح كل النص الموجود في مربع نص؟

<p>Clear() (A)</p> Signup and view all the answers

أي من الإجراءات التالية يجب استخدامه لتحديد كل النص الموجود في مربع نص؟

<p>SelectAll() (D)</p> Signup and view all the answers

ماذا يفعل الإجراء AppendText؟

<p>يضيف نصاً إلى نهاية النص الحالي. (C)</p> Signup and view all the answers

أي من الإجراءات التالية يضع نسخة من النص المحدد في مربع النص في الحافظة؟

<p>Copy() (C)</p> Signup and view all the answers

ماذا يفعل الإجراء Hide()؟

<p>يخفي مربع النص. (A)</p> Signup and view all the answers

الإجراء Show() يعرض كائناً تم إخفاؤه مسبقاً، ولكن كيف يتم إظهار مربع نص يسمى 'textBox1'؟

<p>textBox1.Show(); (A)</p> Signup and view all the answers

عند إضافة وظيفة إلى زر لحساب مجموع قيمتين، أين يجب أن يوضع هذا الكود؟

<p>في الإجراء Click الخاص بالكائن. (A)</p> Signup and view all the answers

الرمز (.) يستخدم للوصول إلى الخصائص والإجراءات، ولكن ماذا يمثل الرمز الموجود على يسار أسماء الكائنات في نافذة الكود؟

<p>يشير إلى نوع الكائن. (C)</p> Signup and view all the answers

عند إضافة الإجراء Text.ToUpper() إلى مربع النص، فما هو الغرض من إضافة الخاصية Text؟

<p>لتطبيق الإجراء على النص الذي يتم عرضه بدلاً من الكائن نفسه. (B)</p> Signup and view all the answers

إذا كنت تريد أن يكون برنامج #C قادراً على تنفيذ الإجراءات المناسبة بناءً على الأزرار التي ينقر عليها المستخدم في مربع الرسالة، فماذا تحتاج إلى كتابة؟

<p>مجموعة من الأوامر. (C)</p> Signup and view all the answers

أي من الخصائص التالية تعرض محتوى الرسالة في مربع الرسالة؟

<p>Prompt (B)</p> Signup and view all the answers

ما هي الطريقة لتضمين الأزرار Yes و No و Cancel في مربع رسالة؟

<p>MessageBoxButtons.YesNoCancel (C)</p> Signup and view all the answers

إذا كنت تريد أن يظهر مربع الرسالة رمز الاستفهام، فأي رمز يجب استخدامه?

<p>Question (C)</p> Signup and view all the answers

ما هو الغرض من خاصية RightToLeft في مربع النص?

<p>لعرض النص من اليمين إلى اليسار أو العكس. (A)</p> Signup and view all the answers

في Squarespace، كيف يمكن إضافة نموذج اتصال إلى موقعك؟

<p>باستخدام كتلة النموذج. (D)</p> Signup and view all the answers

لتطوير برنامج يحتوي على مربعين نص، كيف يتم نسخ المحتوى من المربع الأول للصق في المربع الثاني عند الضغط على زر؟

<p>textBox2.Text = textBox1.Text; (C)</p> Signup and view all the answers

إذا كنت ترغب في مطالبة تطبيق #C بإنهاء عملية معينة، فما هو الاستخدام المحدد للأزرار الثلاثة: Abort و Retry و Ignore؟

<p>في حالات حدوث خطأ طارئ وتريد عرض الاختيارات الثلاثة للتعامل معه. (A)</p> Signup and view all the answers

ما هو الأمر الذي يجب أن تكتبه لكي يظهر مربع رسالة يحوي عنواناً ونصّاً مختلفين؟

<p>MessageBox.Show (MessageText, TitleMessage); (A)</p> Signup and view all the answers

أي من الخيارات الآتية هو الكود الصحيح لجعل النص المدخل في TextBox1 يظهر بأحرف صغيرة؟

<p>textBox1.Text = textBox1.Text.ToLower(); (C)</p> Signup and view all the answers

تقوم الخاصية ()SelectedText بإرجاع النص الذي تم تحديده في مربع النص. إذا لم يتم تحديد أي نص فماذا ترجع هذه الخاصية؟

<p>&quot;&quot;. (D)</p> Signup and view all the answers

ما النتيجة التي ستحصل عليها إذا كانت الكلمة المفتاحية 'This' موجودة في الكود؟

<p>تشير إلى النسخة الحالية من الفئة. (A)</p> Signup and view all the answers

في مربع الرسالة، ماذا يجب عليك فعله لعرض أزرار مثل نعم، ولا، وإلغاء الأمر؟

<p>MessageBoxButtons.YesNoCancel() (D)</p> Signup and view all the answers

اختر الأمر الصحيح للخروج من البرنامج?

<p>Application.Exit() (C)</p> Signup and view all the answers

ماذا تعني خاصية RightToLeft؟

<p>اتجاه النص يجب أن يكون من اليمين لليسار. (C)</p> Signup and view all the answers

Flashcards

التفاعل مع المستخدم

يتيح للمستخدم إدخال البيانات أو إظهار الرسائل.

أداة الكتابة (Textbox)

يستخدم لإدخال أو عرض البيانات للمستخدم.

الخاصية RightToLeft

تحديد اتجاه الكتابة من اليمين أو اليسار.

الخاصية CharacterCasing

تحديد إذا كانت الأحرف كبيرة أو صغيرة أو طبيعية.

Signup and view all the flashcards

الخاصية Font

تحديد نوع وحجم وتنسيق الخط.

Signup and view all the flashcards

الخاصية MaxLength

تحديد أقصى عدد من الحروف يمكن إدخالها.

Signup and view all the flashcards

الخاصية MultiLine

تحديد إذا كان مربع النص سطر واحد أو متعدد الأسطر.

Signup and view all the flashcards

الخاصية PasswordChar

جعل المدخلات تظهر كرموز بدلاً من الحروف المدخلة.

Signup and view all the flashcards

الخاصية ReadOnly

جعل محتويات مربع النص للقراءة فقط.

Signup and view all the flashcards

الخاصية Scrollbars

التحكم في ظهور أشرطة التمرير.

Signup and view all the flashcards

الخاصية SelectedText

معرفة النص الذي تم تحديده في مربع النص.

Signup and view all the flashcards

الخاصية Text

لوضع محتويات مربع النص أو لمعرفة محتوياته.

Signup and view all the flashcards

الخاصية TextAlign

لضبط محاذاة محتويات مربع النص.

Signup and view all the flashcards

الخاصية TextLength

لمعرفة عدد أحرف النص الذي تم إدخاله.

Signup and view all the flashcards

الإجراءات (Methods)

وظائف وأفعال يمكن تنفيذها على الكائن.

Signup and view all the flashcards

الإجراء Hide

إخفاء الكائن.

Signup and view all the flashcards

الإجراء Show

إظهار الكائن.

Signup and view all the flashcards

الإجراء AppendText

إضافة نص إلى النص الموجود في مربع النص.

Signup and view all the flashcards

الإجراء Clear

محو محتويات مربع النص.

Signup and view all the flashcards

الإجراء Copy

إرسال نسخة من الجزء المحدد في مربع النص إلى الحافظة.

Signup and view all the flashcards

الإجراء Cut

إرسال الجزء المحدد في مربع النص إلى الحافظة وحذفه.

Signup and view all the flashcards

الإجراء Paste

وضع نسخة من محتويات الحافظة في مربع النص.

Signup and view all the flashcards

الإجراء SelectAll

لتحديد النص الموجود في مربع النص بالكامل.

Signup and view all the flashcards

الإجراء Undo

إلغاء آخر وظيفة تم إجراؤها على النص الموجود في مربع النص.

Signup and view all the flashcards

مربع الرسالة

لعرض رسالة للمستخدم.

Signup and view all the flashcards

Prompt

نص الرسالة التي ستظهر في المربّع للمستخدم.

Signup and view all the flashcards

Title

نص العنوان الذي سيظهر في شريط عنوان نافذة الرسالة.

Signup and view all the flashcards

Buttons

تحديد الأزرار المطلوب عرضها في المربع.

Signup and view all the flashcards

Icons

لتحديد الأيقونات التي يتم عرضها.

Signup and view all the flashcards

Study Notes

  • This chapter introduces the concept of user interaction, which involves users entering data or receiving messages.

Objectives

  • Explain the meaning of user interaction.
  • List five common properties of the TextBox control.
  • Explain the meaning of a Method.
  • Apply a Method to a desired object.
  • Use the method to end the application.
  • Explain the meaning of a message box.
  • Show a message box to the user.
  • Adjust the text that appears in the message box and the text in its title bar.
  • Control the buttons that appear on the message box.
  • Control the icons that appear on the message box.

User Interaction

  • No application (program) exists without interacting with the user, whether by allowing them to enter data or by displaying messages such as alerts and warnings.
  • Texts are among the most important inputs to the computer and their form can be controlled
  • Texts also have operations that can be performed on them, as learned in Windows programs, such as copying, cutting, or pasting part of the text elsewhere.

Textbox Tool

  • This tool was used in previous lessons.
  • Used to allow the user to enter data through it, or it can be used to display data.
  • Every tool (or object) has a set of properties, events, and methods that define its appearance, behavior, and functions

Properties

  • After placing the TextBox tool on the Form, its shape and format can be controlled through properties such as whether it is a single-line or multi-line box
  • It can be used for entering a password or the font that appears during writing.
  • These properties can be adjusted during design through the properties box, or they can be adjusted from the code window using commands.

Common Textbox Properties

  • RightToLeft: Determines the writing direction. Setting it to Yes makes the direction from right to left, and setting it to No makes it from left to right, which is the default.
  • CharacterCasing: The default is Normal, meaning the letters appear in the same case as they are typed. If you want the letters to appear in uppercase, set the property to Upper, and to display them in lowercase, set it to Lower.
  • Font: Used to adjust the font type, size, and formatting
  • MaxLength: Used to set the maximum number of characters that the user can enter in the text box.
  • MultiLine: To determine if the text box is a single line, set the property to False (the default). For multiple lines, set it to True.
  • PasswordChar: Used to make the text box input appear as a password, i.e., symbols appear instead of the entered letters.
  • ReadOnly: The default is False. To make the contents of the text box non-editable and only for reading, set this property to True.
  • Scrollbars: Used to control the appearance of scrollbars
    • None: Means no scrollbars (default)
    • Horizontal: To display a horizontal scrollbar
    • Vertical: To display a vertical scrollbar
    • Both: To display a vertical and horizontal scrollbar.
  • SelectedText: This property is not set, but rather used to find out the text that has been selected in the text box. This property is not available in the properties box, but can only be used by using the code.
  • Text: To place the contents of the text box or to know its contents.
  • TextAlign: To adjust the alignment of the contents of the text box.
    • This property can be set to Left, Right, or Center.
  • TextLength: This property is also not available in the properties box, but rather used from the code. This property is used to find out the number of characters entered in the text.

Methods

  • Control the shape of the tool or object
  • There is a set of functions and actions that can be implemented on the Object and called Methods.
  • Methods are used by writing code, not a special window like in properties.
  • Methods are implemented during program execution, not at design time.
  • General form of the code for using a method: ObjectName.Method;

Example

  • ObjectName: name of the object
  • Method: name of the method to be implemented on this object
  • The Hide procedure hides the object, while the Show procedure displays it.
  • Once you start typing in the code window, a box will appear showing a list of various elements such as properties and the names of the objects on the Form.
  • To select the object directly from the list instead of typing it, press the Tab key from the keyboard (note the symbol that appears to the left of the names of the existing objects).
  • After writing the name of the entity, and as soon as you write the dot (.) to start writing the name of the property or the procedure required, a list will appear with the names of the entity's properties and procedures that you can apply to it.

Common Methods

  • AppendText: Used to add text to the text that already exists in the text box
  • Clear: It clears the contents of the text box, For example Textbox1.Clear clears contents.
  • Copy: Sends a copy of the part that has been selected in the text box.
  • Cut: Sends the part.

Example

  • Two previous actions are implemented on the object.
  • For example you want to implement an action on the text inside a text box, convert it to uppercase.
  • You are not dealing with a text-box object.
  • You are dealing with the text, so apply the action to the text, and the text is the property of the text box: ObjectName.PropertyName.Method;
  • Properties can be considered entities that have their special procedure.
  • In the previous Textbox example, to convert the existing lowercase letters to uppercase, we use the ToUpper procedure, and the command form will be as follows, where we added the name of the Text property because this procedure is specific to the text entities: textBox1.Text.ToUpper();

Exercise

  • Write a C#.NET program that contains two text boxes: one single-line and the other multi-line (Multiline).
  • The program window also contains seven buttons to perform the required commands:
    • Append Text Button
    • Clear Button
    • Copy Button
    • Paste Button
    • Select All Button

Understanding Code

  • The Copy button will not perform its function of copying the selected part to the Clipboard unless the special command for this is written in the button's Event Handler
  • When writing the function, double click on copy to open the function
  • Button (Copy) to perform the function of copying : txtFirstBox.Copy();

btnCopy click action

  • The Click event is triggered when the item is first selected

btnCut click action

  • Pastes the copied text to the second text box
    • txtSecondBox.Paste();

btnClear click action

  • clear is to clear all the test
    • txtFirstBox.Clear(); txtSecondBox.Clear();

btnUpper click action

  • Make all letters Capital letters
    • txtFirstBox.Text = txtFirstBox.Text.ToUpper();

btnLower click action

  • Display the the contents of the txtFirstBox in lowercase letters
    • txtFirstBox.Text = txtFirstBox.Text.ToLower();

btnExit click action

  • The command Application.Exit() can work on any class

Message Box

  • Often appears in various applications
  • Displays text and options such as (Yes/No)
  • (Message box) show information about errors and prompts the user to complete a task

Common Command

  • MessageBox.Show(Prompt , [Title] , [Buttons], [Icons])
    • Prompt : Text that is displayed to users
    • Title : Message box title
    • Buttons : Numbers/Text to represent

MessageBoxButtons

  • Ok-Cancel, YesNo, and YesNoCancel

Message box icon

  • Displays an icon in the message with a set format

Symbols (Message Box)

  • Asterisk / Information
  • Question
  • Error
  • Exclamation / Warning
  • Hand / Stop

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

C# User Interaction Guide

More Like This

User Interaction in Mobile Apps
5 questions
Web 2.0 User Interaction and Tagging
5 questions
User Interaction Design and Support Systems
24 questions
Use Quizgecko on...
Browser
Browser