Click here to Skip to main content
15,908,020 members
Home / Discussions / C#
   

C#

 
GeneralRe: Compiler error Pin
Heath Stewart14-Nov-03 1:59
protectorHeath Stewart14-Nov-03 1:59 
GeneralSimple question: PerformanceCounter Pin
CillyMe13-Nov-03 4:27
CillyMe13-Nov-03 4:27 
GeneralRe: Simple question: PerformanceCounter Pin
leppie13-Nov-03 6:25
leppie13-Nov-03 6:25 
GeneralRe: Simple question: PerformanceCounter Pin
CillyMe13-Nov-03 13:45
CillyMe13-Nov-03 13:45 
GeneralRe: Simple question: PerformanceCounter Pin
leppie13-Nov-03 14:05
leppie13-Nov-03 14:05 
GeneralC# and Excel Pin
Member 51858613-Nov-03 4:18
Member 51858613-Nov-03 4:18 
Generalhelp needed to create custom control which can arrange controls in polygonal shape. Pin
Shailaja13-Nov-03 4:08
Shailaja13-Nov-03 4:08 
GeneralRe: help needed to create custom control which can arrange controls in polygonal shape. Pin
Heath Stewart13-Nov-03 6:31
protectorHeath Stewart13-Nov-03 6:31 
You should check out GoDiagram. What you're talking about can be done but there's a lot of calculations and drawing. Plus, if you want to use shaped pictures on a canvas to represent different machines, you'll need to create an object model. GoDiagram has all that and at a good price. Just get GoDiagram with the layout model and it can do all this for you and is extensible.

Otherwise, you're going to have to do the math yourself. You can get the controls in a container (like the UserControl, or it if contains other controls you don't want positioned, you can use another Panel or something or filter the Controls collection as you enumerate the controls). For how many there are, you need to calculate the position. There's lots of different equations to help you, but you still have to code them. You also have to decide what the anchor point for each control is (i.e., one of the corners, the center, or other anchor point) and position the controls so that they don't overlap - resizing your virtual polygonal grid. That's not too bad since you can get the Size of each control and calculate the anchor point (probably good to have a separate method to do so and abstract that functionality so you don't have to include it all in one method).

When doing this, you have to take into account the relative position of each control. When calculating the anchor point, for instance, the Size of the control is for the control itself. The Location (a Point) is relative to its container. Because these two things are used for the Bounds property, you'll need to take that into account.

 

-----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-----
GeneralDistributed Transaction Pin
CillyMe12-Nov-03 22:15
CillyMe12-Nov-03 22:15 
QuestionRichTextBox Change Picture?? Pin
electronicm12-Nov-03 22:14
electronicm12-Nov-03 22:14 
AnswerRe: RichTextBox Change Picture?? Pin
Anonymous13-Nov-03 10:26
Anonymous13-Nov-03 10:26 
GeneralRe: RichTextBox Change Picture?? Pin
electronicm13-Nov-03 22:35
electronicm13-Nov-03 22:35 
GeneralMouse/Key Messages in Windows Service Pin
krisp12-Nov-03 19:37
krisp12-Nov-03 19:37 
GeneralRe: Mouse/Key Messages in Windows Service Pin
J. Dunlap12-Nov-03 20:59
J. Dunlap12-Nov-03 20:59 
GeneralRe: Mouse/Key Messages in Windows Service Pin
jeff_martin13-Nov-03 3:51
jeff_martin13-Nov-03 3:51 
GeneralRe: Mouse/Key Messages in Windows Service Pin
krisp13-Nov-03 16:36
krisp13-Nov-03 16:36 
GeneralRe: Mouse/Key Messages in Windows Service Pin
Jonathan Slenders13-Nov-03 9:41
Jonathan Slenders13-Nov-03 9:41 
GeneralGet Derived class Pin
pnolan12-Nov-03 19:21
pnolan12-Nov-03 19:21 
GeneralRe: Get Derived class Pin
krisp12-Nov-03 19:46
krisp12-Nov-03 19:46 
GeneralRe: Get Derived class Pin
pnolan12-Nov-03 20:04
pnolan12-Nov-03 20:04 
GeneralRe: Get Derived class Pin
krisp12-Nov-03 20:29
krisp12-Nov-03 20:29 
GeneralRe: Get Derived class Pin
Colin Angus Mackay12-Nov-03 23:13
Colin Angus Mackay12-Nov-03 23:13 
GeneralCachedBitmap Pin
mhmoud rawas12-Nov-03 18:54
mhmoud rawas12-Nov-03 18:54 
GeneralRe: CachedBitmap Pin
Corinna John12-Nov-03 20:54
Corinna John12-Nov-03 20:54 
GeneralRe: CachedBitmap Pin
mhmoud rawas12-Nov-03 21:31
mhmoud rawas12-Nov-03 21:31 

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.