Click here to Skip to main content
15,891,033 members
Home / Discussions / C#
   

C#

 
GeneralRe: Over ride closing event Pin
Heath Stewart29-Jan-04 13:08
protectorHeath Stewart29-Jan-04 13:08 
GeneralListbox deleting items Pin
Gavin Coates29-Jan-04 8:19
Gavin Coates29-Jan-04 8:19 
GeneralRe: Listbox deleting items Pin
Mazdak29-Jan-04 8:28
Mazdak29-Jan-04 8:28 
GeneralRe: Listbox deleting items Pin
Gavin Coates29-Jan-04 9:09
Gavin Coates29-Jan-04 9:09 
GeneralRe: Listbox deleting items Pin
Mazdak29-Jan-04 9:14
Mazdak29-Jan-04 9:14 
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 
First, never store a Graphics object and always call Dipose on it when you're finished.

Second, using the ClientRectangle of the Button means that the rectangle will be within the Button, which maintains its own state. Drawing a rectangle within said bounds won't be visible. Instead you must inflate the rectangle (you can use Rectangle.Inflate) by the size of the pen (5, in your example).

You'll also want to do this in the override for OnPaint in your Panel-derived class (or in the Paint event if from another - possibly container - class. Painting this rectangle once will work (if you take into account what I mentioned above) but once the surface requires repainting it won't show up (and only part of it - the invalidated part - will disappear if the whole surface doesn't need repainting). So, in DrawScanArea(Button button) instead set a value to signify that the border should be painted (like a non empty rectangle which you would have to store anyway) and in OnPaint check that state and draw the border if necessary.

 

-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
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 

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.