I have a custom Panel which will have smaller custom Panels added and drawn
within it. I want to be able to re-order the arrangement of the inner Panels
using drag n drop, and I want to do this graphically by actually drawing the
inner Panel being dragged around, instead of just the default DragDropEffects
graphics.
But I can't seem to get this to work...
What I tried is when you click on an inner Panel you acitvate a DragNDrop
with the panel itself being the Data object. Then in the DragOver event of
the main, outer panel I pull out the inner Panel object and assign it a new
Location, to where the current mouse x,y are. Then I tried calling Refresh
on either and/or both the outer panel and inner panel to no success.
What happens is the inner Panel is drawn initially then as soon as I click
on it to drag it, it disappears and as I drag my mouse over the outer panel
it is never redrawn again.
Any suggestions?
Here's some code...
Within InnerPanel:
void InnerPanel_Mous eDown(object sender, MouseEventArgs e)
{
this.DoDragDrop (this, DragDropEffects .Move);
}
Within OuterPanel:
// AllowDrop set to true
void OuterPanel_Drag Over(object sender, DragEventArgs e)
{
InnerPanel i = e.Data.GetData( typeof(InnerPan el)) as InnerPanel;
i.Location = new Point(e.X, e.Y);
//this.Refresh(); //tried refreshing outer panel
//i.Refresh(); //also tried refreshing just inner panel
}
InnerPanel has a overriden OnPaint which basically just draws itself as a
roudned ractangle with a thick border. nothing fancy or crazy. It uses an
ExtendedGraphic s object to do the rounded rectangle- something someone else
wrote on the Net somewhere
protected override void OnPaint(PaintEv entArgs args)
{
Graphics gfx = args.Graphics;
gfx.SmoothingMo de =
System.Drawing. Drawing2D.Smoot hingMode.AntiAl ias;
Pen myPen = new Pen(borderColor );
myPen.Width = 2;
ExtendedGraphic s egfx = new ExtendedGraphic s(gfx);
Brush brush = Brushes.DarkCya n;
egfx.FillRoundR ectangle(brush, 0, 0, this.Width-2,
this.Height-2, 10);
egfx.DrawRoundR ectangle(myPen, 0, 0, this.Size.Width-2,
this.Height-2, 10);
} 0 2172 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Marco Auday |
last post by:
I need to associate items in two listviews. I have got the drag-and-drop operation to perform as I wanted. However, I would like the items in the target listview to be highlighted when the mouse hovers over them during the drag-and-drop operation, so that I know for sure which item I selected on the target listview.
I have tried a number of approaches without success, including:
1) TargetListview.DragEnter event – tried to...
|
by: nicomp |
last post by:
I studied the Drag and Drop example that all the .Net dev sites link to: a
string is dragged from one list box to another. It all makes sense but it
doesn't explain how to determine what the object being dragged is. The code
assumes the object is a string and only verifies that is really is a string.
How can I drop into a Select Case and handle all the possible cases that the
object might be?
I can call e.Data.GetFormats( ) and then...
|
by: D Witherspoon |
last post by:
I am developing a Windows Forms application in VB.NET that will use .NET
remoting to access the data tier classes.
A very simple way I have come up with is by creating typed (.xsd) datasets.
For example dsParts.xsd and including that in the data tier. I then will
create a class that looks like this
Public Class CPart
Inherits dsParts
|
by: Grey |
last post by:
I need to design a workflow application with C#. I want to design an UI with
some workflow components which they can be drag & drop anywhere in order to
design the workflow for the application users. Moreover, when the user
double click on the component, they can define some routing rules for the
process. Is it possible to have such fancy UI in C#?? Any reference sites or
tutorial??
Million Thanks.
|
by: jojobar |
last post by:
Hello,
I look at the asp.net 2.0 web parts tutorial on the asp.net web site. I
tried to run it under firefox browser but it did not run.
If I want to use this feature in a commercial product where the user can run
on firefox/mozilla, what would be a good approach.
1. Should I overwrite the javascript code drag-and-drop to make it more
browser independent. If I want to go this route, can anybody provide me a
| |
by: murl |
last post by:
Im starting on a application that will map fields from an excel file
to fields of a sql table for a very small integration project. I have
enabled drag and drop on the source listbox, and the form inbetween
the 2 listboxes so i can tell when im dragging over the form. Im stuck
on when i dragenter into the 2nd listbox, how can i figure out what
position their mouse is over, and what item is at that x and y
position? If anybody has any...
|
by: zhaow |
last post by:
Hi, All
Greetings!
I want to develop as appllication that requires a line-drawing function
in the blank area between two forms. I have looked up the MSDN, it says that
a graphics object need a reference to a control or a form. I guess it means
that lines can't be draw on blank area between two forms. Can anybody
guarantee this for me? Is there any method can realize this function? I
mainly want to draw a line from a button in form1 to...
|
by: scf1984 |
last post by:
I have this code creating an object to drag-and-drop:
window.onload = function()
{
var dragObject = document.createElement('DIV');
dragObject.id = 'dragObject';
dragObject.style.cssText = 'position:absolute;display:none;';
document.body.appendChild(dragObject);
}
|
by: kam45 |
last post by:
I did one program that draws a line with two squares at the ends and I can just click and extend each ends. It works ok but I need to move the whole line. Would anyone knows how?
Private Const gs As Integer = 34
Private Const hw As Integer = 6
Private Const hhw As Integer = hw \ 2
Private bf As Bitmap
Private drag As Integer = -1
Private pts() As Point
Private Sub Form1_Load(ByVal sender As System.Object,...
|
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...
|
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...
| |
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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...
| |