PC Review


Reply
Thread Tools Rate Thread

Control Selection & Resizing at runtime

 
 
for1248
Guest
Posts: n/a
 
      8th Jan 2008
I have a common mousemove/down/up handler for any control placed on the panel
at runtime .It's Working fine .

I need for moving and resizing controls (labels/textboxes/checkboxes/etc) and
shape controls (LineShape ,RectangleShape, OvalShape which are from
powerpacks.dll ) which i place on the Panel which are generated at runtime .


Is there any Class for creating Control Selection and Resizing Handles for
my controls which are present on the panel at runtime ??????

I want to show the selection if user presses the control and able to resize
those controls with resizing handles for Any Typeof control . ?????


' If i release the mouse button after resizing it has to update the size or
location of that control same like in vs2005 design time environment but
here at runtime .

plzzz ,



Thanks & Regards

 
Reply With Quote
 
 
 
 
Mike Powell
Guest
Posts: n/a
 
      8th Jan 2008
Hi,
there is no built in way to do this with .net however since you capture the
mouse up down and move events you shouldn't have any problem coding this
kind of thing. I've made a few ResizerRects as i call em, just make a class
which has a rectangle and however many grab handles you want, then just
handle resizing that rectangle as desired (grabhandle, Size property...)
once you have this simple control set up to behave how you want it, you just
need to create one for each object dragged onto the form and use it as a
sort of container, this makes sure that no matter what kind of object is
dragged onto the form, moving and resizing is always handled the same way
I'll look through my backups to see if i can find you an example (old
machines in bits for now).

Regards,

Michael Powell
Ramuseco ltd .Net Consulting

P.S
you may find the ControlPaint class useful, check it out.


"for1248" <u40506@uwe> wrote in message news:7de71312fe92c@uwe...
>I have a common mousemove/down/up handler for any control placed on the
>panel
> at runtime .It's Working fine .
>
> I need for moving and resizing controls (labels/textboxes/checkboxes/etc)
> and
> shape controls (LineShape ,RectangleShape, OvalShape which are from
> powerpacks.dll ) which i place on the Panel which are generated at
> runtime .
>
>
> Is there any Class for creating Control Selection and Resizing Handles
> for
> my controls which are present on the panel at runtime ??????
>
> I want to show the selection if user presses the control and able to
> resize
> those controls with resizing handles for Any Typeof control . ?????
>
>
> ' If i release the mouse button after resizing it has to update the size
> or
> location of that control same like in vs2005 design time environment but
> here at runtime .
>
> plzzz ,
>
>
>
> Thanks & Regards
>


 
Reply With Quote
 
anoj
Guest
Posts: n/a
 
      9th Jan 2008
Hi,

Though there is no built in functionality available but same can be
achieved using
SharpRectTracker control.
http://www.codeproject.com/KB/miscct...ctTracker.aspx

Hope this helps.

/Anoj Kumar
[htttp://techtips4you.blogspot.com]



On Jan 8, 6:04*pm, "for1248" <u40506@uwe> wrote:
> I have a common mousemove/down/up handler for any control placed on the panel
> at runtime .It's Working fine .
>
> I need for moving and resizing controls (labels/textboxes/checkboxes/etc) and
> shape controls (LineShape ,RectangleShape, OvalShape which are from
> powerpacks.dll ) which i *place on the Panel which are generated at runtime .
>
> Is there any Class for creating Control Selection and Resizing Handles *for
> my controls which are present on the panel at runtime ??????
>
> *I want to show the selection if user presses the control and able to resize
> those controls with resizing handles for Any Typeof control . ????? *
>
> *' If i release the mouse button after resizing it has to update the size or
> location of that control *same like in vs2005 design time environment but
> here at runtime .
>
> *plzzz ,
>
> Thanks & Regards


 
Reply With Quote
 
dotnet2005
Guest
Posts: n/a
 
      10th Jan 2008
Hii ,

Thanks For replying ,

This is the thing which i want for runtime . I used that thing but it
is of type controls inherits from COntrol .


Thanks
 
Reply With Quote
 
dotnet2005
Guest
Posts: n/a
 
      10th Jan 2008
Thanks For Replying ,


That ControlPaint is very useful ,But i am getting only 3 squares at
different places not on control edges .Only at a particular place
those are coming not for individual controls at that location .


Thanks
For1248
 
Reply With Quote
 
dotnet2005
Guest
Posts: n/a
 
      10th Jan 2008
Hii ,

I will come with a nice reply ,Sorry for the previous one .I am doing
practicles on that thing now i understood something ,

I will be back .Please reply me

Thanks
For1248
 
Reply With Quote
 
dotnet2005
Guest
Posts: n/a
 
      11th Jan 2008
HI Powell ,

Now i am able to draw rectangles on any particular control if i
click , but the thing is it is not able to recognize the
LineShape,RectangleShape,OvalShape which are from
VisualBasic.PowerPacks.Dll if click on those shapes ,but recognizing
controls of type Control
if i click a button on toolstrip it creates Rectangle
While creating like this on panel ::
Dim shc As ShapeContainer = New ShapeContainer()
shc.Location = New System.Drawing.Point(0, 0)
shc.Margin = New System.Windows.Forms.Padding(0)
shc.Name = "ShapeContainer1"
Rect = New RectangleShape(shc)
Rect.Location = New System.Drawing.Point(ihorizontal,
ivertical)
Rect.Size = New Size(70, 40)
Rect.Name = "RectangleShape1"
Rect.Enabled = False
CurrentPanel= SampleForm.Panel1.Controls("Page" &
CurrentPanelNo)
cs.WireControl(Rect) --- Used from CodePRoject PICKBOX
project --not working on shapes
CurrentPanel.Controls.Add(shc) --------------- Adding to
Current Panle
g = CurrentPanel.CreateGraphics
'AddHandler ctr.MouseDown, AddressOf Ctr_MouseDown
AddHandler Rect.MouseClick, AddressOf Ctr_MouseClick
'AddHandler ctr.MouseLeave, AddressOf Ctr_MouseLeave
'AddHandler ctr.MouseUp, AddressOf Ctr_MouseUp


while Ctr_MouseClick i am writing this thing to get handle around
that control
If TypeOf sender Is TextBox Then
ctr = DirectCast(sender, TextBox)
ControlPaint.DrawSelectionFrame(g, True, Rectangle.Inflate(Box,
boxsize, boxsize), Box, Color.DarkBlue)
ControlPaint.DrawGrabHandle(g, New Rectangle(ctr.Left - 6,
ctr.Top - 6, boxsize, boxsize), True, True)
ControlPaint.DrawGrabHandle(g, New Rectangle(ctr.Left +
ctr.Width / 2 - 6, ctr.Top - 6, boxsize, boxsize), True, True)
ControlPaint.DrawGrabHandle(g, New Rectangle(ctr.Left +
ctr.Width, ctr.Top - 6, boxsize, boxsize), True, True)
ControlPaint.DrawGrabHandle(g, New Rectangle(ctr.Left - 6,
ctr.Top + ctr.Height, boxsize, boxsize), True, True)
ControlPaint.DrawGrabHandle(g, New Rectangle(ctr.Left +
ctr.Width / 2 - 6, ctr.Top + ctr.Height, boxsize, boxsize), True,
True)
ControlPaint.DrawGrabHandle(g, New Rectangle(ctr.Left +
ctr.Width, ctr.Top + ctr.Height, boxsize, boxsize), True, True)
ElseIf TypeOf sender Is LineSelection Then ----- Not
Recognizing the click
Line = CType(sender, LineShape)
.......


But not Working .........



Thanks & Regards ,
For1248
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Resizing cells in a selection without resizing entire sheet Danielle via OfficeKB.com Microsoft Excel Misc 4 11th Aug 2006 10:06 PM
Resizing a label control at runtime =?Utf-8?B?amNyb3VzZQ==?= Microsoft VB .NET 11 11th Jun 2004 03:57 PM
Runtime control moving and resizing =?Utf-8?B?amJtZWVo?= Microsoft C# .NET 2 19th Feb 2004 06:26 PM
Runtime control resizing =?Utf-8?B?amJtZWVo?= Microsoft Dot NET Framework Forms 1 13th Feb 2004 09:29 PM
Drawing control selection rectanlge/resizing fragget Microsoft C# .NET 0 29th Sep 2003 02:52 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:51 AM.