Click here to Skip to main content
15,897,273 members
Home / Discussions / C#
   

C#

 
QuestionHow to make the text bold in richTextBox? Pin
frossie14-Feb-07 2:17
frossie14-Feb-07 2:17 
AnswerRe: How to make the text bold in richTextBox? Pin
Abisodun14-Feb-07 2:37
Abisodun14-Feb-07 2:37 
QuestionRichTextBox Problem Pin
Abisodun14-Feb-07 2:07
Abisodun14-Feb-07 2:07 
QuestionChanging the Form's and controlBox looks Pin
ThetaClear14-Feb-07 1:56
ThetaClear14-Feb-07 1:56 
AnswerRe: Changing the Form's and controlBox looks Pin
Mircea Puiu14-Feb-07 4:29
Mircea Puiu14-Feb-07 4:29 
GeneralRe: Changing the Form's and controlBox looks Pin
ThetaClear14-Feb-07 4:45
ThetaClear14-Feb-07 4:45 
GeneralRe: Changing the Form's and controlBox looks Pin
ThetaClear14-Feb-07 4:54
ThetaClear14-Feb-07 4:54 
AnswerRe: Changing the Form's and controlBox looks Pin
Martin#14-Feb-07 5:09
Martin#14-Feb-07 5:09 
Hello,

Here is a code which might helps you.
I used the methods in a basic form and my inherit form called the public method. (Just in case you are wondering why it's public)
private Point           _startDragPoint;
private System.Timers.Timer TimerMovePad;

this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.yourFormMouseUp);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.yourFormMouseMove);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.yourFormMouseDown);

public void MovePadMouseDown(System.Windows.Forms.MouseEventArgs e)
{
    // Set the drag flag for the mousemove event
    _dragModeEnabled = true;

    // Record the start point for the slider movement
    _startDragPoint = new Point(e.X, e.Y);
}

public void MovePadMouseMove(System.Windows.Forms.MouseEventArgs e)
{
    if (_dragModeEnabled == false)
        return;

    MovePad(e);
}

public void MovePadMouseUp(System.Windows.Forms.MouseEventArgs e)
{
    if (_dragModeEnabled == false)
        return;

    // Reset the drag flag
    _dragModeEnabled = false;
    MovePad(e);
}

private void MovePad(System.Windows.Forms.MouseEventArgs e)
{
    if(TimerMovePad == null)
    {
        this.TimerMovePad = new System.Timers.Timer();
        this.TimerMovePad.Interval = 100;
        this.TimerMovePad.Elapsed +=new System.Timers.ElapsedEventHandler(TimerMovePad_Elapsed);
    }

    if (TimerMovePad.Enabled == false)
    {
        TimerMovePad.Enabled = true;
    }

    if(_movementok == true)
    {
        _movementok = false;

        //Hier wird die zurückgelegt strecke in Pixel ermittelt.
        int delta_x = e.X - _startDragPoint.X;
        int delta_y = e.Y - _startDragPoint.Y;

        //Hier wird die Position neu bestimmt
        this.Location = new Point((this.Location.X + delta_x), (this.Location.Y + delta_y));
    }
}

private void TimerMovePad_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
    TimerMovePad.Enabled = false;
    _movementok = true;
}

private void yourFormMouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
    MovePadMouseDown(e);
}

private void yourFormMouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
    MovePadMouseMove(e);
}

private void yourFormMouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
    MovePadMouseUp(e);
}

Hope it helps!

All the best,

Martin
GeneralRe: Changing the Form's and controlBox looks Pin
ThetaClear14-Feb-07 5:14
ThetaClear14-Feb-07 5:14 
QuestionHow to set an default button Pin
hiremath7114-Feb-07 1:55
hiremath7114-Feb-07 1:55 
AnswerRe: How to set an default button Pin
il_masacratore14-Feb-07 2:28
il_masacratore14-Feb-07 2:28 
AnswerRe: How to set an default button Pin
Martin#14-Feb-07 2:35
Martin#14-Feb-07 2:35 
GeneralRe: How to set an default button Pin
hiremath7114-Feb-07 2:47
hiremath7114-Feb-07 2:47 
GeneralRe: How to set an default button Pin
Luc Pattyn14-Feb-07 7:47
sitebuilderLuc Pattyn14-Feb-07 7:47 
GeneralRe: How to set an default button Pin
hiremath7120-Feb-07 20:10
hiremath7120-Feb-07 20:10 
GeneralRe: How to set an default button Pin
starcraft4ever15-Feb-07 17:13
starcraft4ever15-Feb-07 17:13 
GeneralRe: How to set an default button Pin
hiremath7120-Feb-07 20:05
hiremath7120-Feb-07 20:05 
QuestionCOM Interface Usage From C# Pin
James R. Twine14-Feb-07 1:25
James R. Twine14-Feb-07 1:25 
AnswerRe: COM Interface Usage From C# Pin
led mike14-Feb-07 6:59
led mike14-Feb-07 6:59 
GeneralRe: COM Interface Usage From C# Pin
James R. Twine14-Feb-07 7:31
James R. Twine14-Feb-07 7:31 
QuestionDeQueuing Thread from ThreadPool. Pin
nasambur14-Feb-07 0:28
nasambur14-Feb-07 0:28 
QuestionC# class help? [modified] Pin
Wolf9214-Feb-07 0:23
Wolf9214-Feb-07 0:23 
AnswerRe: C# class help? Pin
dipswitch@ownage4u.nl14-Feb-07 0:30
professionaldipswitch@ownage4u.nl14-Feb-07 0:30 
AnswerRe: C# class help? Pin
ShermansLagoon14-Feb-07 0:41
ShermansLagoon14-Feb-07 0:41 
AnswerRe: C# class help? Pin
Pete O'Hanlon14-Feb-07 1:21
mvePete O'Hanlon14-Feb-07 1:21 

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.