Click here to Skip to main content
15,894,297 members
Home / Discussions / C#
   

C#

 
AnswerRe: DataSet.Clear problem Pin
Gareth H27-May-08 11:16
Gareth H27-May-08 11:16 
AnswerRe: DataSet.Clear problem Pin
NK728-May-08 21:16
NK728-May-08 21:16 
QuestionA very unhappy System.Diagnostics.Debug.WriteLine Pin
RB@Emphasys27-May-08 10:33
RB@Emphasys27-May-08 10:33 
AnswerRe: A very unhappy System.Diagnostics.Debug.WriteLine Pin
Gareth H27-May-08 11:04
Gareth H27-May-08 11:04 
GeneralRe: A very unhappy System.Diagnostics.Debug.WriteLine Pin
RB@Emphasys27-May-08 11:21
RB@Emphasys27-May-08 11:21 
AnswerRe: A very unhappy System.Diagnostics.Debug.WriteLine Pin
Peter Josefsson Sweden27-May-08 15:02
Peter Josefsson Sweden27-May-08 15:02 
GeneralRe: A very unhappy System.Diagnostics.Debug.WriteLine Pin
RB@Emphasys28-May-08 6:32
RB@Emphasys28-May-08 6:32 
QuestionNewbie - Mouse Events Handling problem Pin
gborges27-May-08 10:29
gborges27-May-08 10:29 
Hi all!

I create a class that extends UserControl, and so, I try to add some mouse events to the objects that my app creates dynamically.

It follows the class UserControlEx, the one that I created.
public class ControlEx : System.Windows.Forms.UserControl {

    private bool isDragging = false;
    private int clickOffsetX, clickOffsetY;
    KineticaRT.Controls.Dial lblDragger;

    public ControlEx (System.Windows.Forms.TabPage tabPage) {
        this.lblDragger = new KineticaRT.Controls.Dial();
        this.lblDragger.Enabled = true;
        tabPage.Controls.Add(this.lblDragger);
        this.MouseUp += new System.Windows.Forms.MouseEventHandler(controlEx_MouseUp);
        this.MouseMove += new System.Windows.Forms.MouseEventHandler(controlEx_MouseMove);
        this.MouseDown += new System.Windows.Forms.MouseEventHandler(controlEx_MouseDown);
    }

    private void controlEx_MouseDown (System.Object sender, System.Windows.Forms.MouseEventArgs e) {
        isDragging = true;
        clickOffsetX = e.X;
        clickOffsetY = e.Y;
    }

    private void controlEx_MouseUp (System.Object sender, System.Windows.Forms.MouseEventArgs e) {
        isDragging = false;
    }

    private void controlEx_MouseMove (System.Object sender, System.Windows.Forms.MouseEventArgs e) {
        if (isDragging == true) {
            this.Left = e.X + this.Left - clickOffsetX;
            this.Top = e.Y + this.Top - clickOffsetY;
        }
    }

    private void InitializeComponent() {
        this.SuspendLayout();
        //
        // ControlEx
        //
        this.Name = "ControlEx";
        this.ResumeLayout(false);
    }

}


As you can see, the constructor of the class, creates the object and adds the events to the control(lblDragger).

But, a problem occurs. When I press the mouse down and I try to drag the object nothing occurs. The mouse up functions also does not work.

private ControlEx dial;
private void button1_Click(object sender, EventArgs e) {
    if (tcDataPanes.TabCount == 0) {
        TabPageEx tabpage = new TabPageEx(tcDataPanes);
    }

    dial = new ControlEx(tcDataPanes.SelectedTab);
}


How can I solve this problem?

Thank you in advance.
Gustavo
QuestionA large NotifyIcon Size Pin
Adel Khayata27-May-08 10:06
Adel Khayata27-May-08 10:06 
AnswerRe: A large NotifyIcon Size Pin
leppie27-May-08 21:04
leppie27-May-08 21:04 
AnswerRe: A large NotifyIcon Size Pin
benjymous27-May-08 22:45
benjymous27-May-08 22:45 
AnswerRe: A large NotifyIcon Size Pin
Adel Khayata28-May-08 4:33
Adel Khayata28-May-08 4:33 
QuestionSend keystrokes Pin
xax27-May-08 9:40
xax27-May-08 9:40 
AnswerRe: Send keystrokes Pin
Judah Gabriel Himango27-May-08 12:13
sponsorJudah Gabriel Himango27-May-08 12:13 
GeneralRe: Send keystrokes Pin
xax28-May-08 1:52
xax28-May-08 1:52 
GeneralRe: Send keystrokes Pin
Judah Gabriel Himango28-May-08 5:44
sponsorJudah Gabriel Himango28-May-08 5:44 
AnswerRe: Send keystrokes Pin
GuyThiebaut27-May-08 21:14
professionalGuyThiebaut27-May-08 21:14 
GeneralRe: Send keystrokes Pin
xax28-May-08 2:00
xax28-May-08 2:00 
GeneralRe: Send keystrokes Pin
GuyThiebaut28-May-08 2:31
professionalGuyThiebaut28-May-08 2:31 
QuestionProblem in connection string Pin
Shuaib wasif khan27-May-08 8:59
Shuaib wasif khan27-May-08 8:59 
AnswerRe: Problem in connection string Pin
Wes Aday27-May-08 9:03
professionalWes Aday27-May-08 9:03 
AnswerRe: Problem in connection string Pin
Ennis Ray Lynch, Jr.27-May-08 9:09
Ennis Ray Lynch, Jr.27-May-08 9:09 
AnswerRe: Problem in connection string Pin
Shuaib wasif khan27-May-08 9:24
Shuaib wasif khan27-May-08 9:24 
QuestionPicturebox problem Pin
Joplinazz27-May-08 8:10
Joplinazz27-May-08 8:10 
AnswerRe: Picturebox problem Pin
led mike27-May-08 8:39
led mike27-May-08 8:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.