Click here to Skip to main content
15,915,752 members
Home / Discussions / C#
   

C#

 
GeneralRe: TextBoxes on GUI Pin
dealon27-May-08 20:37
dealon27-May-08 20:37 
GeneralRe: TextBoxes on GUI Pin
Blubbo28-May-08 3:34
Blubbo28-May-08 3:34 
GeneralRe: TextBoxes on GUI Pin
DaveyM6928-May-08 4:19
professionalDaveyM6928-May-08 4:19 
AnswerRe: TextBoxes on GUI Pin
darkelv27-May-08 18:02
darkelv27-May-08 18:02 
GeneralRe: TextBoxes on GUI Pin
Blubbo28-May-08 3:38
Blubbo28-May-08 3:38 
GeneralRe: TextBoxes on GUI Pin
darkelv28-May-08 5:51
darkelv28-May-08 5:51 
AnswerRe: TextBoxes on GUI Pin
V.27-May-08 20:14
professionalV.27-May-08 20:14 
QuestionImprove Custom Control Performance by Storing Bitmap of Control? Pin
User 1278227-May-08 14:03
User 1278227-May-08 14:03 
AnswerRe: Improve Custom Control Performance by Storing Bitmap of Control? Pin
Christian Graus27-May-08 14:27
protectorChristian Graus27-May-08 14:27 
GeneralRe: Improve Custom Control Performance by Storing Bitmap of Control? Pin
User 1278227-May-08 15:14
User 1278227-May-08 15:14 
QuestionDataSet.Clear problem Pin
hdv21227-May-08 11:10
hdv21227-May-08 11:10 
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
The Nightcoder27-May-08 15:02
The Nightcoder27-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 

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.