Click here to Skip to main content
15,908,674 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: IListSource Implementation Pin
Dave Kreskowiak11-Aug-09 5:14
mveDave Kreskowiak11-Aug-09 5:14 
GeneralRe: IListSource Implementation Pin
Ovais Memon11-Aug-09 5:25
Ovais Memon11-Aug-09 5:25 
GeneralRe: IListSource Implementation Pin
Dave Kreskowiak11-Aug-09 6:48
mveDave Kreskowiak11-Aug-09 6:48 
AnswerRe: IListSource Implementation Pin
Mycroft Holmes11-Aug-09 16:21
professionalMycroft Holmes11-Aug-09 16:21 
QuestionMove,Resize and Drag and Drop a control Pin
Anubhava Dimri10-Aug-09 18:17
Anubhava Dimri10-Aug-09 18:17 
AnswerRe: Move,Resize and Drag and Drop a control Pin
Moreno Airoldi10-Aug-09 23:25
Moreno Airoldi10-Aug-09 23:25 
GeneralRe: Move,Resize and Drag and Drop a control Pin
Anubhava Dimri11-Aug-09 0:25
Anubhava Dimri11-Aug-09 0:25 
GeneralRe: Move,Resize and Drag and Drop a control Pin
Moreno Airoldi12-Aug-09 1:51
Moreno Airoldi12-Aug-09 1:51 
This is a very raw example, it should give you the basic idea:

C#
private bool DragActive = false;
System.Threading.Timer DragOrClickTimer = null;

private void DragOrClickTimer_Tick(object state)
{
    DragActive = true;
    Control c = (Button)state;
    c.Invalidate();
}

private void button1_MouseDown(object sender, MouseEventArgs e)
{
    DragOrClickTimer = new System.Threading.Timer(new System.Threading.TimerCallback(DragOrClickTimer_Tick), button1, 200, System.Threading.Timeout.Infinite);
}

private void button1_MouseUp(object sender, MouseEventArgs e)
{
    if (DragOrClickTimer != null)
    {
        DragOrClickTimer.Dispose();
        DragOrClickTimer = null;
    }
    if (DragActive)
    {
        DragActive = false;
        button1.Invalidate();
    }
    else
    {
        MessageBox.Show("Click!");
    }
}

private void button1_Paint(object sender, PaintEventArgs e)
{
    if (DragActive)
    {
        Graphics g = e.Graphics;
        Pen p = new Pen(Color.Red, 3);
        g.DrawRectangle(p, 5, 5, button1.Width - 11, button1.Height - 11);
    }
}


Of course it should be incapsulated properly in custom controls, or if you just want to implement it simply in a form, tweaked to work for all controls - the basics are all there.

Good luck!

2+2=5 for very large amounts of 2
(always loved that one hehe!)

GeneralRe: Move,Resize and Drag and Drop a control Pin
Anubhava Dimri13-Aug-09 23:52
Anubhava Dimri13-Aug-09 23:52 
GeneralRe: Move,Resize and Drag and Drop a control Pin
Moreno Airoldi14-Aug-09 1:28
Moreno Airoldi14-Aug-09 1:28 
AnswerRe: Move,Resize and Drag and Drop a control Pin
Henry Minute11-Aug-09 5:06
Henry Minute11-Aug-09 5:06 
GeneralRe: Move,Resize and Drag and Drop a control Pin
Luc Pattyn11-Aug-09 5:19
sitebuilderLuc Pattyn11-Aug-09 5:19 
GeneralRe: Move,Resize and Drag and Drop a control Pin
Henry Minute11-Aug-09 5:30
Henry Minute11-Aug-09 5:30 
QuestionHow can I fit a child form to be inside a MdiParent Pin
waner michaud10-Aug-09 11:35
waner michaud10-Aug-09 11:35 
AnswerRe: How can I fit a child form to be inside a MdiParent Pin
Dave Kreskowiak10-Aug-09 18:25
mveDave Kreskowiak10-Aug-09 18:25 
GeneralRe: How can I fit a child form to be inside a MdiParent Pin
waner michaud11-Aug-09 3:11
waner michaud11-Aug-09 3:11 
GeneralRe: How can I fit a child form to be inside a MdiParent Pin
DaveyM6911-Aug-09 3:35
professionalDaveyM6911-Aug-09 3:35 
GeneralRe: How can I fit a child form to be inside a MdiParent Pin
Dave Kreskowiak11-Aug-09 3:49
mveDave Kreskowiak11-Aug-09 3:49 
AnswerRe: How can I fit a child form to be inside a MdiParent Pin
DaveyM6911-Aug-09 1:47
professionalDaveyM6911-Aug-09 1:47 
QuestionDeleting a Database Record when DeletedDate is XX Days Old Pin
mrtupperware10-Aug-09 4:52
mrtupperware10-Aug-09 4:52 
AnswerRe: Deleting a Database Record when DeletedDate is XX Days Old Pin
Luc Pattyn10-Aug-09 5:20
sitebuilderLuc Pattyn10-Aug-09 5:20 
GeneralRe: Deleting a Database Record when DeletedDate is XX Days Old Pin
mrtupperware10-Aug-09 6:08
mrtupperware10-Aug-09 6:08 
GeneralRe: Deleting a Database Record when DeletedDate is XX Days Old Pin
Luc Pattyn10-Aug-09 6:24
sitebuilderLuc Pattyn10-Aug-09 6:24 
GeneralRe: Deleting a Database Record when DeletedDate is XX Days Old Pin
mrtupperware10-Aug-09 6:39
mrtupperware10-Aug-09 6:39 
GeneralRe: Deleting a Database Record when DeletedDate is XX Days Old Pin
Luc Pattyn10-Aug-09 6:40
sitebuilderLuc Pattyn10-Aug-09 6:40 

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.