Click here to Skip to main content
15,902,299 members
Home / Discussions / C#
   

C#

 
AnswerRe: reading the remaining hours Pin
Mbah Dhaim14-Sep-08 11:03
Mbah Dhaim14-Sep-08 11:03 
GeneralRe: reading the remaining hours Pin
Jassim Rahma14-Sep-08 11:07
Jassim Rahma14-Sep-08 11:07 
GeneralRe: reading the remaining hours Pin
Guffa14-Sep-08 11:22
Guffa14-Sep-08 11:22 
GeneralRe: reading the remaining hours Pin
Guffa14-Sep-08 11:20
Guffa14-Sep-08 11:20 
GeneralRe: reading the remaining hours Pin
Mbah Dhaim14-Sep-08 11:44
Mbah Dhaim14-Sep-08 11:44 
Questionreading Extended Properties from SQL Server 2005 Express Pin
Jassim Rahma14-Sep-08 10:30
Jassim Rahma14-Sep-08 10:30 
QuestionUnable to Call MDI Parent property from MID Client Pin
Muhammad Nauman Yousuf14-Sep-08 8:06
Muhammad Nauman Yousuf14-Sep-08 8:06 
AnswerRe: Unable to Call MDI Parent property from MID Client Pin
Mbah Dhaim14-Sep-08 8:51
Mbah Dhaim14-Sep-08 8:51 
GeneralRe: Unable to Call MDI Parent property from MID Client Pin
Muhammad Nauman Yousuf14-Sep-08 20:32
Muhammad Nauman Yousuf14-Sep-08 20:32 
GeneralRe: Unable to Call MDI Parent property from MID Client Pin
DaveyM6914-Sep-08 22:35
professionalDaveyM6914-Sep-08 22:35 
GeneralRe: Unable to Call MDI Parent property from MID Client Pin
Mbah Dhaim15-Sep-08 6:58
Mbah Dhaim15-Sep-08 6:58 
QuestionSearching Between Dates Pin
Vimalsoft(Pty) Ltd14-Sep-08 6:11
professionalVimalsoft(Pty) Ltd14-Sep-08 6:11 
AnswerRe: Searching Between Dates Pin
Mbah Dhaim14-Sep-08 7:00
Mbah Dhaim14-Sep-08 7:00 
QuestionGDI problem, Drawing rectangle by drag and drop. Pin
hdv21214-Sep-08 2:37
hdv21214-Sep-08 2:37 
Hi i have this code to create a new control (inherites from Panel) and when user over it, click mouse and drag, a new rectangle create and resize to fit with mouse position cordination:
public partial class Stage : Panel
    {
        int originX = 0;
        int originY = 0;
        bool dragging = false;

        public Stage()
        {
            InitializeComponent();
            this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);
        }

        protected override void OnMouseDown(MouseEventArgs e)
        {
            this.dragging = true;
            this.originX = e.X;
            this.originY = e.Y;

            Graphics g = this.CreateGraphics();
            g.DrawRectangle(new Pen(Brushes.Red, 4), this.originX, this.originY, this.originX, this.originY);
            this.Invalidate();
            base.OnMouseDown(e);
        }

        protected override void OnMouseMove(MouseEventArgs e)
        {
            if (this.dragging)
            {
                int posX = e.X;
                int posY = e.Y;

                Graphics g = this.CreateGraphics();
                g.DrawRectangle(new Pen(Brushes.Red, 4), this.originX, this.originY, posX, posY);
                this.Invalidate();
            }
            base.OnMouseMove(e);
        }

        protected override void OnMouseUp(MouseEventArgs e)
        {
            if (this.dragging)
                this.dragging = false;            
            base.OnMouseUp(e);
        }
    }


but at runTime, it work so bad with flicker and when mouse button released. not any rectangle exist in Stage control.
can anyBody help me to find out how to create rectangle whith drag and drop correctly ?
thanks
AnswerRe: GDI problem, Drawing rectangle by drag and drop. Pin
Mbah Dhaim14-Sep-08 4:56
Mbah Dhaim14-Sep-08 4:56 
AnswerRe: GDI problem, Drawing rectangle by drag and drop. Pin
Anthony Mushrow14-Sep-08 5:03
professionalAnthony Mushrow14-Sep-08 5:03 
Question? operator wuestion Pin
Mohammad Dayyan14-Sep-08 1:57
Mohammad Dayyan14-Sep-08 1:57 
AnswerRe: ? operator wuestion [modified] Pin
Perspx14-Sep-08 2:12
Perspx14-Sep-08 2:12 
GeneralRe: ? operator wuestion Pin
Lutosław14-Sep-08 2:56
Lutosław14-Sep-08 2:56 
GeneralRe: ? operator wuestion Pin
Guffa14-Sep-08 3:43
Guffa14-Sep-08 3:43 
GeneralRe: ? operator wuestion Pin
Perspx14-Sep-08 3:48
Perspx14-Sep-08 3:48 
QuestionUsing the office 2007 Ribbon ( drag-n-drop a window without using the border ) [modified] Pin
Mahhouraaaaaa14-Sep-08 1:22
Mahhouraaaaaa14-Sep-08 1:22 
AnswerRe: Using the office 2007 Ribbon ( drag-n-drop a window without using the border ) Pin
The Cake of Deceit14-Sep-08 9:37
The Cake of Deceit14-Sep-08 9:37 
QuestionDebugging External .exe Pin
Jammer14-Sep-08 1:03
Jammer14-Sep-08 1:03 
AnswerRe: Debugging External .exe Pin
Jimmanuel14-Sep-08 9:18
Jimmanuel14-Sep-08 9:18 

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.