Este artigo foi traduzido por máquina. Coloque o ponteiro do mouse sobre as frases do artigo para ver o texto original. Mais informações.
Tradução
Original
Este tópico ainda não foi avaliado como - Avalie este tópico

Enumeração MouseButtons

Especifica as constantes que definem qual botão do mouse foi pressionado.

Esta enumeração tem um atributo FlagsAttribute que permite uma combinação bit a bit de seus valores de membro.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (em System.Windows.Forms.dll)
[FlagsAttribute]
[ComVisibleAttribute(true)]
public enum MouseButtons
Nome do membro Descrição
Compatível com o .NET Compact Framework Left botão do mouse esquerdo do mouse foi pressionado.
Compatível com o .NET Compact Framework None Nenhum botão do mouse foi pressionado.
Compatível com o .NET Compact Framework Right botão do mouse direito do mouse foi pressionado.
Compatível com o .NET Compact Framework Middle botão do mouse do meio foi pressionado.
XButton1 A primeira XButton foi pressionado.

Com o Windows 2000, a Microsoft está apresentando o suporte para o Microsoft IntelliMouse Explorer, que é um mouse com cinco botões. Dois novos botões do mouse (XBUTTON1 e XBUTTON2) oferecem uma navegação para trás/encaminhar.

XButton2 O segundo XButton foi pressionado.

Com o Windows 2000, a Microsoft está apresentando o suporte para o Microsoft IntelliMouse Explorer, que é um mouse com cinco botões. Dois novos botões do mouse (XBUTTON1 e XBUTTON2) oferecem uma navegação para trás/encaminhar.

Essa enumeração é usada por muitas classes, incluindo AxHost, Control, DataGrid, Form, RadioButton, Splitter, StatusBar, e UpDownBase.

O exemplo a seguir demonstra como usar o GetCharFromPosition método para obter um caractere de Sumário de um RichTextBox dadas suas coordenadas de controle. O código de exemplo usa coordenadas localizadas no MouseEventArgs objeto passado sistema autônomo um parâmetro para o manipulador de eventos para determinar o local no controle para obter o caractere. O caractere, em seguida, é exibido em um MessageBox Se não for um caractere de espaço. Este exemplo assume que um RichTextBox controle de chamada richTextBox1 foi criada e que o código de exemplo está conectado à MouseDown evento da RichTextBox.

privatevoid richTextBox1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
		{
			// Determine which mouse button is clicked.if(e.Button == MouseButtons.Left)
			{
				// Obtain the character at which the mouse cursor was clicked at.char tempChar = richTextBox1.GetCharFromPosition(new Point(e.X, e.Y));
				// Determine whether the character is an empty space.if (tempChar.ToString() != " ")
					// Display the character in a message box.
					MessageBox.Show("The character at the specified position is " + tempChar + ".");

			}
		}


private void richTextBox1_MouseDown(Object sender, System.Windows.
    Forms.MouseEventArgs e)
{
    // Determine which mouse button is clicked.
    if (e.get_Button().Equals(get_MouseButtons().Left)) {
        // Obtain the character at which the mouse cursor was clicked at.
        char tempChar = richTextBox1.GetCharFromPosition(new Point(e.
             get_X(), e.get_Y()));
        // Determine whether the character is an empty space.
        if (!(((System.Char)tempChar).ToString().Equals(" "))) {
            // Display the character in a message box.
            MessageBox.Show("The character at the specified position is " 
                + tempChar + ".");
        }
    }
} //richTextBox1_MouseDown 


O exemplo a seguir demonstra o uso de eventos de mouse diferente para desenhar o caminho do mouse em um Panel. Um segmento de linha é adicionado ao GraphicsPath para cada MouseMove e MouseDown eventos que ocorrem. Para atualizar os elementos gráficos, a Invalidate método é chamado para o Panel em cada MouseDown e MouseUp evento. Além disso, o caminho do elemento gráfico será rolado para cima ou para baixo quando o MouseWheel evento ocorre. Eventos de mouse adicionais, sistema autônomo MouseHover, são identificados na tela bem. Também é exibido na tela estão informações adicionais sobre o mouse do SystemInformation classe.

using System;
using System.Drawing;
using System.Windows.Forms;

namespace MouseEvent
{
    publicclass Form1 : System.Windows.Forms.Form
    {
        private System.Windows.Forms.Panel panel1;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.Label label5;
        private System.Windows.Forms.Label label6;
        private System.Windows.Forms.Label label7;
        private System.Windows.Forms.Label label8;
        private System.Windows.Forms.Label label9;
        private System.Windows.Forms.Button clearButton;
        private System.Drawing.Drawing2D.GraphicsPath mousePath;
        private System.Windows.Forms.GroupBox groupBox1;

        privateint fontSize = 20;        

        [STAThread]
        staticvoid Main() 
        {
            Application.Run(new Form1());
        }

        public Form1()
        {            
            mousePath = new System.Drawing.Drawing2D.GraphicsPath();

            this.panel1 = new System.Windows.Forms.Panel();
            this.label1 = new System.Windows.Forms.Label();
            this.clearButton = new System.Windows.Forms.Button();
            this.label2 = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            this.label5 = new System.Windows.Forms.Label();
            this.label6 = new System.Windows.Forms.Label();
            this.label7 = new System.Windows.Forms.Label();
            this.label8 = new System.Windows.Forms.Label();
            this.label9 = new System.Windows.Forms.Label();
            this.groupBox1 = new System.Windows.Forms.GroupBox();

            // Mouse Events Labelthis.label1.Location = new System.Drawing.Point(24, 504);
            this.label1.Size = new System.Drawing.Size(392, 23);
            // DoubleClickSize Labelthis.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(24, 48);
            this.label2.Size = new System.Drawing.Size(35, 13);
            // DoubleClickTime Labelthis.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(24, 72);
            this.label3.Size = new System.Drawing.Size(35, 13);
            // MousePresent Labelthis.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(24, 96);
            this.label4.Size = new System.Drawing.Size(35, 13);
            // MouseButtons Labelthis.label5.AutoSize = true;
            this.label5.Location = new System.Drawing.Point(24, 120);
            this.label5.Size = new System.Drawing.Size(35, 13);
            // MouseButtonsSwapped Labelthis.label6.AutoSize = true;
            this.label6.Location = new System.Drawing.Point(320, 48);
            this.label6.Size = new System.Drawing.Size(35, 13);
            // MouseWheelPresent Labelthis.label7.AutoSize = true;
            this.label7.Location = new System.Drawing.Point(320, 72);
            this.label7.Size = new System.Drawing.Size(35, 13);
            // MouseWheelScrollLines Labelthis.label8.AutoSize = true;
            this.label8.Location = new System.Drawing.Point(320, 96);
            this.label8.Size = new System.Drawing.Size(35, 13);
            // NativeMouseWheelSupport Labelthis.label9.AutoSize = true;
            this.label9.Location = new System.Drawing.Point(320, 120);
            this.label9.Size = new System.Drawing.Size(35, 13);

            // Mouse Panelthis.panel1.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
                | System.Windows.Forms.AnchorStyles.Right);
            this.panel1.BackColor = System.Drawing.SystemColors.ControlDark;
            this.panel1.Location = new System.Drawing.Point(16, 160);
            this.panel1.Size = new System.Drawing.Size(664, 320);
            this.panel1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseUp);
            this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint);
            this.panel1.MouseEnter += new System.EventHandler(this.panel1_MouseEnter);
            this.panel1.MouseHover += new System.EventHandler(this.panel1_MouseHover);
            this.panel1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseMove);
            this.panel1.MouseLeave += new System.EventHandler(this.panel1_MouseLeave);
            this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown);
            this.panel1.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseWheel);

            // Clear Buttonthis.clearButton.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
            this.clearButton.Location = new System.Drawing.Point(592, 504);
            this.clearButton.TabIndex = 1;
            this.clearButton.Text = "Clear";
            this.clearButton.Click += new System.EventHandler(this.clearButton_Click);

            // GroupBoxthis.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
                | System.Windows.Forms.AnchorStyles.Right);
            this.groupBox1.Location = new System.Drawing.Point(16, 24);
            this.groupBox1.Size = new System.Drawing.Size(664, 128);
            this.groupBox1.Text = "System.Windows.Forms.SystemInformation";

            // Set up how the form should be displayed and add the controls to the form.this.ClientSize = new System.Drawing.Size(696, 534);
            this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                        this.label9,this.label8,this.label7,this.label6,
                                        this.label5,this.label4,this.label3,this.label2,
                                        this.clearButton,this.panel1,this.label1,this.groupBox1});
            this.Text = "Mouse Event Example";

            // Displays information about the system mouse.
            label2.Text = "SystemInformation.DoubleClickSize: " + SystemInformation.DoubleClickSize.ToString();
            label3.Text = "SystemInformation.DoubleClickTime: " + SystemInformation.DoubleClickTime.ToString();
            label4.Text = "SystemInformation.MousePresent: " + SystemInformation.MousePresent.ToString();
            label5.Text = "SystemInformation.MouseButtons: " + SystemInformation.MouseButtons.ToString();
            label6.Text = "SystemInformation.MouseButtonsSwapped: " + SystemInformation.MouseButtonsSwapped.ToString();
            label7.Text = "SystemInformation.MouseWheelPresent: " + SystemInformation.MouseWheelPresent.ToString();
            label8.Text = "SystemInformation.MouseWheelScrollLines: " + SystemInformation.MouseWheelScrollLines.ToString();
            label9.Text = "SystemInformation.NativeMouseWheelSupport: " + SystemInformation.NativeMouseWheelSupport.ToString();

        }

        privatevoid panel1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) 
        {
            // Update the mouse path with the mouse information
            Point mouseDownLocation = new Point(e.X, e.Y);

            string eventString = null;
            switch (e.Button) {
                case MouseButtons.Left:
                    eventString = "L";
                    break;
                case MouseButtons.Right:
                    eventString = "R";
                    break;
                case MouseButtons.Middle:
                    eventString = "M";
                    break;
                case MouseButtons.XButton1:
                    eventString = "X1";
                    break;
                case MouseButtons.XButton2:
                    eventString = "X2";
                    break;
                case MouseButtons.None:
                default:
                    break;
            }

            if (eventString != null) 
            {
                mousePath.AddString(eventString, FontFamily.GenericSerif, (int)FontStyle.Bold, fontSize, mouseDownLocation, StringFormat.GenericDefault);
            }
            else 
            {
                mousePath.AddLine(mouseDownLocation,mouseDownLocation);
            }
            panel1.Focus();
            panel1.Invalidate();
        }

        privatevoid panel1_MouseEnter(object sender, System.EventArgs e) 
        {
            // Update the mouse event label to indicate the MouseEnter event occurred.
            label1.Text = sender.GetType().ToString() + ": MouseEnter";
        }

        privatevoid panel1_MouseHover(object sender, System.EventArgs e) 
        {
            // Update the mouse event label to indicate the MouseHover event occurred.
            label1.Text = sender.GetType().ToString() + ": MouseHover";
        }

        privatevoid panel1_MouseLeave(object sender, System.EventArgs e) 
        {
            // Update the mouse event label to indicate the MouseLeave event occurred.
            label1.Text = sender.GetType().ToString() + ": MouseLeave";
        }

        privatevoid panel1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            // Update the mouse path that is drawn onto the Panel.int mouseX = e.X;
            int mouseY = e.Y;

            mousePath.AddLine(mouseX,mouseY,mouseX,mouseY);
        }

        privatevoid panel1_MouseWheel(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            // Update the drawing based upon the mouse wheel scrolling.int numberOfTextLinesToMove = e.Delta * SystemInformation.MouseWheelScrollLines / 120;
            int numberOfPixelsToMove = numberOfTextLinesToMove * fontSize;

            if (numberOfPixelsToMove != 0) {
                System.Drawing.Drawing2D.Matrix translateMatrix = new  System.Drawing.Drawing2D.Matrix();
                translateMatrix.Translate(0, numberOfPixelsToMove);
                mousePath.Transform(translateMatrix);
            }
            panel1.Invalidate();
        }
        privatevoid panel1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) 
        {
            Point mouseUpLocation = new System.Drawing.Point(e.X, e.Y);

            // Show the number of clicks in the path graphic.int numberOfClicks = e.Clicks;
            mousePath.AddString("    " + numberOfClicks.ToString(), 
                        FontFamily.GenericSerif, (int)FontStyle.Bold, 
                        fontSize, mouseUpLocation, StringFormat.GenericDefault);

            panel1.Invalidate();
        }

        privatevoid panel1_Paint(object sender, System.Windows.Forms.PaintEventArgs e) 
        {    
            // Perform the painting of the Panel.
            e.Graphics.DrawPath(System.Drawing.Pens.DarkRed, mousePath);
        }

        privatevoid clearButton_Click(object sender, System.EventArgs e)
        {
            // Clear the Panel display.
            mousePath.Dispose();
            mousePath = new System.Drawing.Drawing2D.GraphicsPath();
            panel1.Invalidate();
        }
    }
}


package MouseEvent;
import System.*;
import System.Drawing.*;
import System.Windows.Forms.*;

public class Form1 extends System.Windows.Forms.Form
{
    private System.Windows.Forms.Panel panel1;
    private System.Windows.Forms.Label label1;
    private System.Windows.Forms.Label label2;
    private System.Windows.Forms.Label label3;
    private System.Windows.Forms.Label label4;
    private System.Windows.Forms.Label label5;
    private System.Windows.Forms.Label label6;
    private System.Windows.Forms.Label label7;
    private System.Windows.Forms.Label label8;
    private System.Windows.Forms.Label label9;
    private System.Windows.Forms.Button clearButton;
    private System.Drawing.Drawing2D.GraphicsPath mousePath;
    private System.Windows.Forms.GroupBox groupBox1;
    private int fontSize = 20;

    /** @attribute STAThread()
     */
    public static void main(String[] args)
    {
        Application.Run(new Form1());
    } //main

    public Form1()
    {
        mousePath = new System.Drawing.Drawing2D.GraphicsPath();

        this.panel1 = new System.Windows.Forms.Panel();
        this.label1 = new System.Windows.Forms.Label();
        this.clearButton = new System.Windows.Forms.Button();
        this.label2 = new System.Windows.Forms.Label();
        this.label3 = new System.Windows.Forms.Label();
        this.label4 = new System.Windows.Forms.Label();
        this.label5 = new System.Windows.Forms.Label();
        this.label6 = new System.Windows.Forms.Label();
        this.label7 = new System.Windows.Forms.Label();
        this.label8 = new System.Windows.Forms.Label();
        this.label9 = new System.Windows.Forms.Label();
        this.groupBox1 = new System.Windows.Forms.GroupBox();
        // Mouse Events Label
        this.label1.set_Location(new System.Drawing.Point(24, 504));
        this.label1.set_Size(new System.Drawing.Size(392, 23));
        // DoubleClickSize Label
        this.label2.set_AutoSize(true);
        this.label2.set_Location(new System.Drawing.Point(24, 48));
        this.label2.set_Size(new System.Drawing.Size(35, 13));
        // DoubleClickTime Label
        this.label3.set_AutoSize(true);
        this.label3.set_Location(new System.Drawing.Point(24, 72));
        this.label3.set_Size(new System.Drawing.Size(35, 13));
        // MousePresent Label
        this.label4.set_AutoSize(true);
        this.label4.set_Location(new System.Drawing.Point(24, 96));
        this.label4.set_Size(new System.Drawing.Size(35, 13));
        // MouseButtons Label
        this.label5.set_AutoSize(true);
        this.label5.set_Location(new System.Drawing.Point(24, 120));
        this.label5.set_Size(new System.Drawing.Size(35, 13));
        // MouseButtonsSwapped Label
        this.label6.set_AutoSize(true);
        this.label6.set_Location(new System.Drawing.Point(320, 48));
        this.label6.set_Size(new System.Drawing.Size(35, 13));
        // MouseWheelPresent Label
        this.label7.set_AutoSize(true);
        this.label7.set_Location(new System.Drawing.Point(320, 72));
        this.label7.set_Size(new System.Drawing.Size(35, 13));
        // MouseWheelScrollLines Label
        this.label8.set_AutoSize(true);
        this.label8.set_Location(new System.Drawing.Point(320, 96));
        this.label8.set_Size(new System.Drawing.Size(35, 13));
        // NativeMouseWheelSupport Label
        this.label9.set_AutoSize(true);
        this.label9.set_Location(new System.Drawing.Point(320, 120));
        this.label9.set_Size(new System.Drawing.Size(35, 13));
        // Mouse Panel
        this.panel1.set_Anchor(System.Windows.Forms.AnchorStyles.Top
            | System.Windows.Forms.AnchorStyles.Left
            | System.Windows.Forms.AnchorStyles.Right);
        this.panel1.set_BackColor(System.Drawing.SystemColors.get_ControlDark());
        this.panel1.set_Location(new System.Drawing.Point(16, 160));
        this.panel1.set_Size(new System.Drawing.Size(664, 320));
        this.panel1.add_MouseUp(
            new System.Windows.Forms.MouseEventHandler(this.panel1_MouseUp));
        this.panel1.add_Paint(new System.Windows.Forms.PaintEventHandler(
            this.panel1_Paint));
        this.panel1.add_MouseEnter(new System.EventHandler(
            this.panel1_MouseEnter));
        this.panel1.add_MouseHover(new System.EventHandler(
            this.panel1_MouseHover));
        this.panel1.add_MouseMove(
            new System.Windows.Forms.MouseEventHandler(this.panel1_MouseMove));
        this.panel1.add_MouseLeave(
            new System.EventHandler(this.panel1_MouseLeave));
        this.panel1.add_MouseDown(
            new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown));
        this.panel1.add_MouseWheel(
            new System.Windows.Forms.MouseEventHandler(this.panel1_MouseWheel));
        // Clear Button
        this.clearButton.set_Anchor(System.Windows.Forms.AnchorStyles.Top
            | System.Windows.Forms.AnchorStyles.Right);
        this.clearButton.set_Location(new System.Drawing.Point(592, 504));
        this.clearButton.set_TabIndex(1);
        this.clearButton.set_Text("Clear");
        this.clearButton.add_Click(new System.EventHandler(
            this.clearButton_Click));
        // GroupBox
        this.groupBox1.set_Anchor(System.Windows.Forms.AnchorStyles.Top
            | System.Windows.Forms.AnchorStyles.Left
            | System.Windows.Forms.AnchorStyles.Right);
        this.groupBox1.set_Location(new System.Drawing.Point(16, 24));
        this.groupBox1.set_Size(new System.Drawing.Size(664, 128));
        this.groupBox1.set_Text("System.Windows.Forms.SystemInformation");
        // Set up how the form should be displayed and add the controls
        // to the form.
        this.set_ClientSize(new System.Drawing.Size(696, 534));
        this.get_Controls().AddRange(new System.Windows.Forms.Control[] {
            this.label9, this.label8, this.label7, this.label6, this.label5,
            this.label4, this.label3, this.label2, this.clearButton,
            this.panel1, this.label1, this.groupBox1 });
        this.set_Text("Mouse Event Example");
        // Displays information about the system mouse.
        label2.set_Text("SystemInformation.DoubleClickSize: "
            + SystemInformation.get_DoubleClickSize().ToString());
        label3.set_Text("SystemInformation.DoubleClickTime: "
            + ((Int32)SystemInformation.get_DoubleClickTime()).ToString());
        label4.set_Text("SystemInformation.MousePresent: "
            + ((System.Boolean)SystemInformation.get_MousePresent()).ToString());
        label5.set_Text("SystemInformation.MouseButtons: "
            + ((Int32)SystemInformation.get_MouseButtons()).ToString());
        label6.set_Text("SystemInformation.MouseButtonsSwapped: "
            + ((System.Boolean)SystemInformation.get_MouseButtonsSwapped()).
            ToString());
        label7.set_Text("SystemInformation.MouseWheelPresent: "
            + ((System.Boolean)SystemInformation.get_MouseWheelPresent()).
            ToString());
        label8.set_Text("SystemInformation.MouseWheelScrollLines: "
            + ((Int32)SystemInformation.get_MouseWheelScrollLines()).
            ToString());
        label9.set_Text("SystemInformation.NativeMouseWheelSupport: "
            + ((System.Boolean)SystemInformation.
            get_NativeMouseWheelSupport()).ToString());
    } //Form1

    private void panel1_MouseDown(Object sender,
        System.Windows.Forms.MouseEventArgs e)
    {
        // Update the mouse path with the mouse information
        Point mouseDownLocation = new Point(e.get_X(), e.get_Y());

        String eventString = null;
        switch (e.get_Button()) {
            case MouseButtons.Left:
                eventString = "L";
                break;
            case MouseButtons.Right:
                eventString = "R";
                break;
            case MouseButtons.Middle:
                eventString = "M";
                break;
            case MouseButtons.XButton1:
                eventString = "X1";
                break;
            case MouseButtons.XButton2:
                eventString = "X2";
                break;
            case MouseButtons.None:
            default:
                break;
        }

        if (eventString != null) {
            mousePath.AddString(eventString, FontFamily.get_GenericSerif(),
                (int)FontStyle.Bold, fontSize, mouseDownLocation,
                StringFormat.get_GenericDefault());
        }
        else {
            mousePath.AddLine(mouseDownLocation, mouseDownLocation);
        }
        panel1.Focus();
        panel1.Invalidate();
    } //panel1_MouseDown

    private void panel1_MouseEnter(Object sender, System.EventArgs e)
    {
        // Update the mouse event label to indicate the MouseEnter event occurred.
        label1.set_Text(sender.GetType().ToString() + ": MouseEnter");
    } //panel1_MouseEnter

    private void panel1_MouseHover(Object sender, System.EventArgs e)
    {
        // Update the mouse event label to indicate the MouseHover event occurred.
        label1.set_Text(sender.GetType().ToString() + ": MouseHover");
    } //panel1_MouseHover

    private void panel1_MouseLeave(Object sender, System.EventArgs e)
    {
        // Update the mouse event label to indicate the MouseLeave event occurred.
        label1.set_Text(sender.GetType().ToString() + ": MouseLeave");
    } //panel1_MouseLeave

    private void panel1_MouseMove(Object sender,
        System.Windows.Forms.MouseEventArgs e)
    {
        // Update the mouse path that is drawn onto the Panel.
        int mouseX = e.get_X();
        int mouseY = e.get_Y();

        mousePath.AddLine(mouseX, mouseY, mouseX, mouseY);
    } //panel1_MouseMove

    private void panel1_MouseWheel(Object sender,
        System.Windows.Forms.MouseEventArgs e)
    {
        // Update the drawing based upon the mouse wheel scrolling.
        int numberOfTextLinesToMove =
            e.get_Delta() * SystemInformation.get_MouseWheelScrollLines() / 120;
        int numberOfPixelsToMove = numberOfTextLinesToMove * fontSize;

        if (numberOfPixelsToMove != 0) {
            System.Drawing.Drawing2D.Matrix translateMatrix =
                new System.Drawing.Drawing2D.Matrix();
            translateMatrix.Translate(0, numberOfPixelsToMove);
            mousePath.Transform(translateMatrix);
        }
        panel1.Invalidate();
    } //panel1_MouseWheel

    private void panel1_MouseUp(Object sender,
        System.Windows.Forms.MouseEventArgs e)
    {
        Point mouseUpLocation = new System.Drawing.Point(e.get_X(), e.get_Y());
        // Show the number of clicks in the path graphic.
        int numberOfClicks = e.get_Clicks();
        mousePath.AddString("    " + ((Int32)numberOfClicks).ToString(),
            FontFamily.get_GenericSerif(), (int)(FontStyle.Bold), fontSize,
            mouseUpLocation, StringFormat.get_GenericDefault());

        panel1.Invalidate();
    } //panel1_MouseUp

    private void panel1_Paint(Object sender,
        System.Windows.Forms.PaintEventArgs e)
    {
        // Perform the painting of the Panel.
        e.get_Graphics().DrawPath(System.Drawing.Pens.get_DarkRed(), mousePath);
    } //panel1_Paint

    private void clearButton_Click(Object sender, System.EventArgs e)
    {
        // Clear the Panel display.
        mousePath.Dispose();
        mousePath = new System.Drawing.Drawing2D.GraphicsPath();
        panel1.Invalidate();
    } //clearButton_Click
} //Form1


Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

o.NET Framework e.NET Compact Framework não oferecem suporte a todas as versões de cada plataforma. Para obter uma lista de versões suportadas, consulte Requisitos de sistema do .NET framework.

.NET Framework

Compatível com: 3.5, 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Compatível com: 3.5, 2.0, 1.0
Isso foi útil para você?
(1500 caracteres restantes)
Conteúdo da Comunidade Adicionar