Click here to Skip to main content
15,890,579 members
Home / Discussions / C#
   

C#

 
GeneralRe: Listbox deleting items Pin
Gavin Coates29-Jan-04 9:52
Gavin Coates29-Jan-04 9:52 
GeneralRe: Listbox deleting items Pin
thomasa30-Jan-04 0:45
thomasa30-Jan-04 0:45 
GeneralRe: Listbox deleting items Pin
Gavin Coates31-Jan-04 10:17
Gavin Coates31-Jan-04 10:17 
GeneralRe: Listbox deleting items Pin
thomasa1-Feb-04 22:14
thomasa1-Feb-04 22:14 
GeneralMulti-threading Pin
Guinness4Strength29-Jan-04 5:17
Guinness4Strength29-Jan-04 5:17 
GeneralRe: Multi-threading Pin
scadaguy29-Jan-04 10:23
scadaguy29-Jan-04 10:23 
GeneralRe: Multi-threading Pin
Guinness4Strength29-Jan-04 10:27
Guinness4Strength29-Jan-04 10:27 
GeneralRe: Multi-threading Pin
Heath Stewart29-Jan-04 12:55
protectorHeath Stewart29-Jan-04 12:55 
GeneralDatabase Problem, PLEASE HELP Pin
gls2ro29-Jan-04 4:24
gls2ro29-Jan-04 4:24 
Generalconvert web form to windows form Pin
OmegaSupreme29-Jan-04 4:19
OmegaSupreme29-Jan-04 4:19 
GeneralRe: convert web form to windows form Pin
Colin Angus Mackay29-Jan-04 14:40
Colin Angus Mackay29-Jan-04 14:40 
GeneralRe: convert web form to windows form Pin
OmegaSupreme29-Jan-04 23:43
OmegaSupreme29-Jan-04 23:43 
GeneralRe: convert web form to windows form Pin
Kentamanos29-Jan-04 19:22
Kentamanos29-Jan-04 19:22 
GeneralRe: convert web form to windows form Pin
OmegaSupreme29-Jan-04 23:48
OmegaSupreme29-Jan-04 23:48 
GeneralWeird problem Pin
cmedia29-Jan-04 3:57
susscmedia29-Jan-04 3:57 
GeneralRe: Weird problem Pin
hxxbin29-Jan-04 11:59
hxxbin29-Jan-04 11:59 
GeneralDrawing a rectangle Pin
thomasa29-Jan-04 3:24
thomasa29-Jan-04 3:24 
GeneralRe: Drawing a rectangle Pin
Heath Stewart29-Jan-04 4:06
protectorHeath Stewart29-Jan-04 4:06 
GeneralRe: Drawing a rectangle Pin
thomasa29-Jan-04 23:38
thomasa29-Jan-04 23:38 
GeneralRe: Drawing a rectangle Pin
Heath Stewart30-Jan-04 3:16
protectorHeath Stewart30-Jan-04 3:16 
GeneralRe: Drawing a rectangle Pin
thomasa2-Feb-04 0:39
thomasa2-Feb-04 0:39 
Thank you Heath for your respons and it
nearly works:
I added to my Main class:
private void DrawScanArea(MyButtonLib.MyButton btnRect)
{
Rectangle rect = new Rectangle(btnRect.Location, btnRect.Size);
ThePanel.StoredRect = rect;
ThePanel.StoredRect.Inflate(5, 5);
this.Refresh();
}
To my panel class:
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
base.OnPaint(e);
if (rStoredRect != Rectangle.Empty)
{
Pen pen = new Pen(Brushes.Blue, 5f);
e.Graphics.DrawRectangle(pen, rStoredRect);
}
}

The problem is that the button hides the rectangle(it paints the button over)
I've tryed to put the OnPaint(..) in my Main class, and the ofcourse the panel hids the rectangle.
I tryed to put it in my button class:
private Rectangle scnaRect = Rectangle.Empty;
public void DrawScanArea(Rectangle rect)
{
scnaRect = rect;
scnaRect.Inflate(5, 5);
this.Refresh();
}
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
{
base.OnPaint(e);
if (scnaRect != Rectangle.Empty)
{
Pen pen = new Pen(Brushes.Blue, 5f);
e.Graphics.DrawRectangle(pen, scnaRect);
}
}
But it won't draw the rectangel at all.
What to do?

Thanks
Thomas
GeneralRe: Drawing a rectangle Pin
thomasa2-Feb-04 2:04
thomasa2-Feb-04 2:04 
GeneralRe: Drawing a rectangle Pin
Heath Stewart2-Feb-04 2:47
protectorHeath Stewart2-Feb-04 2:47 
GeneralSorting in cyclic order Pin
Shree29-Jan-04 2:26
Shree29-Jan-04 2:26 
GeneralRe: Sorting in cyclic order Pin
Heath Stewart29-Jan-04 3:57
protectorHeath Stewart29-Jan-04 3:57 

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.