473,810 Members | 3,135 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to select all controls on panel on rubber band selection

1 New Member
I want to select all controls on form by rubber band selection .Here controls is not selecting.

please help me. thanxs

Expand|Select|Wrap|Line Numbers
  1. public void MyMouseMove(Object sender, MouseEventArgs e)
  2.         {
  3.             Point ptCurrent = new Point(e.X, e.Y);
  4.             // If we "have the mouse", then we draw our lines.
  5.             if (bHaveMouse)
  6.             {
  7.                 // If we have drawn previously, draw again in
  8.                 // that spot to remove the lines.
  9.                 if (ptLast.X != -1)
  10.                 {
  11.                     MyDrawReversibleRectangle(ptOriginal, ptLast);
  12.                 }
  13.                 // Update last point.
  14.                 ptLast = ptCurrent;
  15.                 // Draw new lines.
  16.                 MyDrawReversibleRectangle(ptOriginal, ptCurrent);
  17.             }
  18.         }
  19.  
  20.         public void MyMouseUp(Object sender, MouseEventArgs e)
  21.         {
  22.             // Set internal flag to know we no longer "have the mouse".
  23.             bHaveMouse = false;
  24.             // If we have drawn previously, draw again in that spot
  25.             // to remove the lines.
  26.             if (ptLast.X != -1)
  27.             {
  28.                 Point ptCurrent = new Point(e.X, e.Y);
  29.                 MyDrawReversibleRectangle(ptOriginal, ptLast);
  30.             }
  31.             // Set flags to know that there is no "previous" line to reverse.
  32.             ptLast.X = -1;
  33.             ptLast.Y = -1;
  34.             ptOriginal.X = -1;
  35.             ptOriginal.Y = -1;
  36.         }
  37.         private void MyDrawReversibleRectangle(Point p1, Point p2)
  38.         {
  39.             Rectangle rc = new Rectangle();
  40.  
  41.             // Convert the points to screen coordinates.
  42.             p1 = PointToScreen(p1);
  43.             p2 = PointToScreen(p2);
  44.             // Normalize the rectangle.
  45.             if (p1.X < p2.X)
  46.             {
  47.                 rc.X = p1.X;
  48.                 rc.Width = p2.X - p1.X;
  49.             }
  50.             else
  51.             {
  52.                 rc.X = p2.X;
  53.                 rc.Width = p1.X - p2.X;
  54.             }
  55.             if (p1.Y < p2.Y)
  56.             {
  57.                 rc.Y = p1.Y;
  58.                 rc.Height = p2.Y - p1.Y;
  59.             }
  60.             else
  61.             {
  62.                 rc.Y = p2.Y;
  63.                 rc.Height = p1.Y - p2.Y;
  64.             }
  65.             // Draw the reversible frame.
  66.             ControlPaint.DrawReversibleFrame(rc,
  67.                             Color.Red, FrameStyle.Dashed);
  68.         }
  69.         public void MyMouseDown(Object sender, MouseEventArgs e)
  70.         {
  71.             // Make a note that we "have the mouse".
  72.             bHaveMouse = true;
  73.             // Store the "starting point" for this rubber-band rectangle.
  74.             ptOriginal.X = e.X;
  75.             ptOriginal.Y = e.Y;
  76.             // Special value lets us know that no previous
  77.             // rectangle needs to be erased.
  78.             ptLast.X = -1;
  79.             ptLast.Y = -1;
  80.         }
Apr 19 '12 #1
0 1289

Sign in to post your reply or Sign up for a free account.

Similar topics

2
8023
by: GiSmo | last post by:
hello I'm french so I hope I hunderstand your answers ! I'm begginer in javascript and I would like to do this : select all elements of one selection list (html) with a javascript fonction could you help me ? thanks lot !
0
1077
by: Aditi Deo via .NET 247 | last post by:
(Type your message here) Hello, Can anyone help me? I have a IE Web control treeview displayed with checkboxes. When I check any treeview node, the child nodes below that node.. should automatically get selected when the treeview "check event" fires. Its urgent.. can anyone give me solution ? Thanks ....:-) -------------------------------- From: Aditi Deo
0
1257
by: Jason | last post by:
I've got a gridview with built in paging and sorting and a datasource tag in the aspx. I wanted to change the selection criteria based on a dropdrown list selection, so I created even _SelectedIndexChanged event, and now I get an event was not handled when I select paging or sorting links. Before that there were issues where having a datasource in the asp.net
0
1557
by: Ben3eeE | last post by:
I got one too hard for me to fix problem. I know the cause and i know why but i cant fix it. I am using a "Rubber band" like function, drawing a rectangle on an image in a picturebox that i loaded. Now i want to Cut out the part i marked with the "Rubber band" and load that image in the picturebox. This works great and i can save that image as i want to. The problem is that the image loaded is smaller cause when i load the image i use...
16
2959
by: =?iso-8859-2?Q?K=F8i=B9tof_=AEelechovski?= | last post by:
I need a form control for the user to enter currency symbol. A select control seems to be fit for that purpose; but the problem is that the control must appear on the page several times so the formula for page size gets bounded from below by number of controls times number of currencies. Which means that 1) the page must be produced on the fly in order to be consistent, 2) the data to be transmitted can grow excessively because the...
0
3043
by: New2ASP | last post by:
Thanks everyone in advance for your help. I am fairly new to web development but an experienced window-based developer. Here's the structure of my Gridview Column 1 : Checkbox with SelectAll Checkbox Header Column 2-9: BoundField Column 10: img field If the user select one checkbox item, it will open up another gridview (multiple selection does nothing). If select a row item, it will open a different aspx page. If select...
1
1037
by: imranabdulaziz | last post by:
Dear All, I am using asp.net2.0, C#, sql2005 using Visual studio 2005 Let me explain the scenario. I am making search interface where 18 field(all are master field) are there . which I populate these field in Checkboxlist. based on selection I need to generate that much label control and dropwonlist control and which then after all dropdownlist need to populate with their respective master. Please guide me in doing so or give me...
0
1390
by: Dica | last post by:
in design mode, using VS2005, if i move my asp:button to within asp:tableCell, i'm unable to select it and modify properties/methods. trying to click the control only results in selecting the asp:table. is there a fix for this? tks
7
3527
by: alphanj | last post by:
Hi I need a code for a macro to select every 3rd word after selection.
0
9722
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9603
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10644
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10379
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9200
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7664
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4334
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.