Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

AtomRiot

@AtomRiot
About
Posts
8
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Focus lost when dragging a button
    A AtomRiot

    Sorry, but I am a little confused by the usage. I have tried setting the Capture property but I guess I just don't know how to use it properly. Can you point me to an example of this? Everywhere I search, it looks to be used just as a bool variable for that control.

    "Details details. Things to do Things to get done. Don't bother me with details just tell me when they're done." James Price

    C# help question

  • Focus lost when dragging a button
    A AtomRiot

    The Capture property is simply a bool variable that you can set. that doesnt change the fact that the button mousedown event is only thrown once and is not continuously. i already have a bool variable in that example that does the same thing the Capture property does.

    "Details details. Things to do Things to get done. Don't bother me with details just tell me when they're done." James Price

    C# help question

  • Focus lost when dragging a button
    A AtomRiot

    what do you mean? in the mouse down i currently grab the offset from the button's corner to the mouse, then use that in the mouse move so i can seamlessly move the button in the mouse move by saying button1.Left += (e.X - xOffset); and the same for the top coordinate. Mouse Down event is only sent once, its not a continuous thing is it? I tried moving in just the mouse down and it only moved once.

    "Details details. Things to do Things to get done. Don't bother me with details just tell me when they're done." James Price

    C# help question

  • Focus lost when dragging a button
    A AtomRiot

    ok, i have a button that i am dragging around. this much i can handle, but then i thought i would put it on a panel (like change the parent attribute) until the time came to use it and then when the button was clicked, it would set the parent to the main form (this) the issue is when I do this, i can drag the button around ok if i drag very slowly, if i go to fast, the mouse comes off the button and the button no longer drags. here is the main code. It uses a panel named panel1 and a button named button1

    namespace focus_test
    {
    public partial class Form1 : Form
    {
    int xOffset, yOffset;
    bool buttonClicked;
    public Form1()
    {
    xOffset = yOffset = 0;
    buttonClicked = false;
    InitializeComponent();
    }

        private void button1\_MouseDown(object sender, MouseEventArgs e)
        {
            xOffset = e.X;
            yOffset = e.Y;
            buttonClicked = true;
    
            if (button1.Parent != this)
            {
                button1.Parent = this;
                button1.Left += panel1.Left;
                button1.Top += panel1.Top;
            }            
            button1.BringToFront();
        }
    
        private void button1\_MouseUp(object sender, MouseEventArgs e)
        {
            buttonClicked = false;
        }
    
        private void button1\_MouseMove(object sender, MouseEventArgs e)
        {
            if (buttonClicked)
            {
                button1.Left += (e.X - xOffset);
                button1.Top += (e.Y - yOffset);
            }
        }
    }
    

    }

    to see what i am seeing, click on the button and hold down the mouse and drag it around. Going too fast (using the term "fast" loosely) the mouse will end up not over the piece any longer and not send a mouse move message to it anymore. but if you go over the button and let go of your mouse then click and drag again, you can go as fast as you want like the poor little mouse is welded to the button. anyone got any clues as to why this is so?

    "Details details. Things to do Things to get done. Don't bother me with details just tell me when they're done." James Price

    C# help question

  • Getting an object location
    A AtomRiot

    ahh, i see what you are saying. Thanks, I will give that a try.

    "Details details. Things to do Things to get done. Don't bother me with details just tell me when they're done." James Price

    C# visual-studio docker

  • Getting an object location
    A AtomRiot

    But I would still have to know what the control was under neath the control I am dragging. I cannot use whats under my mouse because that would be what i was dragging. Unless I am just missing the point you are making.

    "Details details. Things to do Things to get done. Don't bother me with details just tell me when they're done." James Price

    C# visual-studio docker

  • Getting an object location
    A AtomRiot

    When I look at the .Parent of the current moving control, it is still showing my form as the parent. I am not implicitly setting a new parent but I would not be able to do that because i wouldnt know what to set it to and run into the same issue.

    "Details details. Things to do Things to get done. Don't bother me with details just tell me when they're done." James Price

    C# visual-studio docker

  • Getting an object location
    A AtomRiot

    Is there a way to tell if an object, like a button, has been moved into a container like a group box or a panel. (this is the running app, not in the IDE) The method of moving would be using the MouseMove event with the button object and I was looking to see if there was an easier way than to use the x,y of the object to see if something was in the container after dragging it.

    "Details details. Things to do Things to get done. Don't bother me with details just tell me when they're done." James Price

    C# visual-studio docker
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups