|
In that case you really need free space to start your mouse drag.
0100000101101110011001000111001011101001
|
|
|
|
|
Thanks, at least I won't spend my time for a thing which is not possible.
|
|
|
|
|
teknolog123 wrote: I did Ctrl+click, it works but I also want my users to select the controls with only one hand Just curious: I assume you are speaking here of "your users" as "design-time" consumers within Visual Studio ... where they have your Panel's source code within their own projects, and can manipulate any object inside the Panel, delete it, move it, etc., ... ? And the controls within your Panel (via use of Dock and Anchor) completely fill the Panel ... so if the user did resize it no Panel surface would be exposed ?
best, Bill
"Use the word 'cybernetics,' Norbert, because nobody knows what it means. This will always put you at an advantage in arguments." Claude Shannon (Information Theory scientist): letter to Norbert Weiner of M.I.T., circa 1940
|
|
|
|
|
BillWoodruff wrote: Just curious: I assume you are speaking here of "your users" as "design-time" consumers
No, I mean runtime users
|
|
|
|
|
teknolog123 wrote: No, I mean runtime users Hi, Now that it's clear this is a run-time scenario: curious to know if your goal is to have a visible selection rectangle appear, and for controls to visually indicate their selected state.
Have you considered an alternative selection mechanism, such as a pop-up window that has TreeView with CheckBoxes where the Control hierarchy can be represented ... perhaps selected from a custom context menu ... that could possibly still enable you to stay in 'one-handed' mode ?
Have you written your selection code already ? Are you still interested in pursuing this ?
best, Bill
"Use the word 'cybernetics,' Norbert, because nobody knows what it means. This will always put you at an advantage in arguments." Claude Shannon (Information Theory scientist): letter to Norbert Weiner of M.I.T., circa 1940
|
|
|
|
|
BillWoodruff wrote: Have you written your selection code already ?
Yes I did but not the way I wanted.
What I wanted was to click on a control and move the mouse to the others (with the help of a visible selection rectangle) to select the controls which intersect with the selection rectangle
What I did : I click the panel that contains all those controls (with a selection rec. visible only on the panel not the controls) and move the mouse.Intersection with rectangle logic is same
the point is I don't want to enlarge the panel to leave a clicking space for selection.The panel should be invisible behind the controls
|
|
|
|
|
Hi Guys,
I want to add few files to already running application, with out Building application is this possible with any framework..Please let me know...
|
|
|
|
|
As far as I know, its not.
Too much of heaven can bring you underground
Heaven can always turn around
Too much of heaven, our life is all hell bound
Heaven, the kill that makes no sound
|
|
|
|
|
pravin_mun wrote: few files
what is in those files? are they executable (EXE, DLL), source files (C#), or something else?
You can load DLLs dynamically, call native code using P//Invoke and managed code using reflection.
You can compile C# files at run-time, the necessary tools are part of the .NET framework.
|
|
|
|
|
It could load plug-ins if you tell it how.
|
|
|
|
|
Hi guys, i want to create userdefined controls in different ascx (1.ascx, 2.ascx, 3.ascx)files at runtime in some button click.. Can some one please let me know the process of doing the same..
|
|
|
|
|
|
Hi
I am invoking a simple web service from Windows form to do simple addition.
The client code is as follows, defined array of int and setting values based on number pressed in the form.
Want to pass the array as parm to web service. Getting error that the method in web service does not have compatible arguments. Can you pls help to see find the issue is.
Client Code
namespace Calculator
{
public partial class Form1 : Form
{
private int sumSoFar;
private int[] numcalc = new int[10];
public Form1()
{
InitializeComponent();
sumSoFar = 0;
for (int i = 0; i < 10; i++)
{
numcalc[i] = 0;
}
}
private void button0_Click(object sender, EventArgs e)
{
numcalc[0] = 0;
}
private void button1_Click(object sender, EventArgs e)
{
numcalc[1] = 1;
}
private void button2_Click(object sender, EventArgs e)
{
numcalc[2] = 2;
}
private void button3_Click(object sender, EventArgs e)
{
numcalc[3] = 3;
}
private void button4_Click(object sender, EventArgs e)
{
numcalc[4] = 4;
}
private void button5_Click(object sender, EventArgs e)
{
numcalc[5] = 5;
}
private void button6_Click(object sender, EventArgs e)
{
numcalc[6] = 6;
}
private void button7_Click(object sender, EventArgs e)
{
numcalc[7] = 7;
}
private void button8_Click(object sender, EventArgs e)
{
numcalc[8] = 8;
}
private void button9_Click(object sender, EventArgs e)
{
numcalc[9] = 9;
}
private void button13_Click(object sender, EventArgs e)
{
MathOps.Service1SoapClient MathOpsObj = new MathOps.Service1SoapClient() ;
sumSoFar = MathOpsObj.AddValues(numcalc);
<< err in this line, I thought numcalc is an array that can be passed as argument to web service, somehow getting error>>
}
}
}
Web service code
namespace MathOps
{
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
public int AddValues(int [] num)
{
int sumSoFar = 0;
for (int i = 0; i < 10; i++)
{
sumSoFar = sumSoFar + num[i];
}
return sumSoFar;
}
}
}
|
|
|
|
|
What is the exact error message you are getting?
I am guessing you to get an error mentioning
cannot convert from 'int[]' to 'MathOps.ArrayOfInt'
If this is the case try the following
MathOps.ArrayOfInt myClientArray = (MathOps.ArrayOfInt)numcalc;
sumSoFar = MathOpsObj.AddValues(myClientArray);
0100000101101110011001000111001011101001
modified 8-Oct-11 20:08pm.
|
|
|
|
|
Hi Andre
Thanks much for the reply. Sorry for the delay in my response. Had to go out of town. I googled the issue and found the same solution as you have suggested and it works like a charm.
Thanks very much.
|
|
|
|
|
There is any Merge Modules for Crystal Report 2008
|
|
|
|
|
Yes[^]?
Bastard Programmer from Hell
|
|
|
|
|
Eddy Vluggen wrote: Yes?
I've never seen a nullable yes before.
|
|
|
|
|
It's the top link on Google; the answer would be a Schrödinger's positive, since although it seems it's possible, the fact that there's a question implies that it's not.
In the latter case, the cat dies
Bastard Programmer from Hell
|
|
|
|
|
|
Hello all,
Situation:
A Win Form, having a panel in it.
size of the panel is bigger than the form itself.
scrollbars are enabled on form and are working fine to scroll through the panel.
http://img824.imageshack.us/img824/1388/panelv.png[^]
Requirement:
1. Enable dragging the panel to see the hidden portion of the panel.
2. Auto align the Scrollbars properly
Problem:
I wrote a code and it does drag the panel but not working so good. it often misposition the scrollbars, and abruptly change the dragged psition.
Help Required:
1. What am i doing wrong ?
2. Is there a better way ?
Here is my code:
public partial class Form1 : Form
{
Point clickPoint = new Point();
public Form1()
{
InitializeComponent();
panel1.Location = new Point(0, 0);
this.HorizontalScroll.SmallChange = 1;
this.VerticalScroll.SmallChange = 1;
}
private void panel1_MouseDown(object sender, MouseEventArgs e)
{
if(e.Button == System.Windows.Forms.MouseButtons.Left)
clickPoint = e.Location;
}
private void panel1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Left)
{
Point diff = new Point(
clickPoint.X - e.Location.X,
clickPoint.Y - e.Location.Y);
this.HorizontalScroll.Value =
Math.Min(Math.Max((this.HorizontalScroll.Value + diff.X),
this.HorizontalScroll.Minimum),
this.HorizontalScroll.Maximum);
this.VerticalScroll.Value =
Math.Min(Math.Max((this.VerticalScroll.Value + diff.Y),
this.VerticalScroll.Minimum),
this.VerticalScroll.Maximum);
}
}
}
And relocating the Panel is not what want:
Panel1.left += e.X - clickPoint.X;
Panel1.top += e.Y - clickPoint.Y;
modified 8-Oct-11 22:38pm.
|
|
|
|
|
A scrollbar's value is anywhere between its Minimum and its Maximum .
Assuming it is meant to fill the Form, a scrolling panel's Top is anywhere between Panel.Height-Form.ClientSize.Height and zero.
You need to linearly scale the one value to the other coordinate, setting the right Scrollbar.MinValue and Scrollbar.MaxValue should do it.
[EDIT]Fixed for sign trouble[/EDIT]
[EDIT2]Strike all that, it doesn't work like that; see my other post[/EDIT2]
modified 8-Oct-11 14:18pm.
|
|
|
|
|
Thanks for the prompt reply.
>> setting the right Scrollbar.MaxValue should do it.
I don't think so.
Scrollbar.MaxValue is decided automatically according to the size of form and the panel. Since I am not changing the panel/form size. Scrollbar.MaxValue has nothing to do with it.
Also while changing the Scrollbar's value, the code is taking care not to let it go beyond it's Min/Max limits.
>> scrolling panel's Top is anywhere between Panel.Height-Form.ClientSize.Height and zero.
scrolling panel's Location is fixed at (0,0).
modified 8-Oct-11 12:37pm.
|
|
|
|
|
Hi again,
I created a project and discovered how the AutoScroll works (hadn't used it in ages). I got it working just fine, assuming the Panel only holds disabled Controls (so MouseDown and MouseMove are sure to fire). This is the relevant code:
private int clickX;
private int clickY;
private void panel1_MouseDown(object sender, MouseEventArgs e) {
clickX=e.X+panel1.HorizontalScroll.Value;
clickY=e.Y+panel1.VerticalScroll.Value;
}
private void panel1_MouseMove(object sender, MouseEventArgs e) {
if (e.Button==MouseButtons.Left) {
int x=clickX-e.X;
if (x<panel1.HorizontalScroll.Minimum) x=panel1.HorizontalScroll.Minimum;
if (x>panel1.HorizontalScroll.Maximum) x=panel1.HorizontalScroll.Maximum;
panel1.HorizontalScroll.Value=x;
int y=clickY-e.Y;
if (y<panel1.VerticalScroll.Minimum) y=panel1.VerticalScroll.Minimum;
if (y>panel1.VerticalScroll.Maximum) y=panel1.VerticalScroll.Maximum;
panel1.VerticalScroll.Value=y;
}
}
It looks very much the same as yours, except for two things:
1. I don't like Math.Min/Math.Max much;
2. I'm not accumulating diff all the time, which you did.
Test: move the mouse over a significant distance, the panel should track that; then (button still down) follow a small circle, this should not do much at all.
[ADDED] I've created this little article[^] on the subject.[/ADDED]
modified 8-Oct-11 16:31pm.
|
|
|
|
|
Hello Luc
Thanks a lot for the explanation, the reference code and detailed article.
However, sadly this does not solve my problem.
In my case, Scrollbars are not associated with the panel. Infact, Panel does not have Scroll bars.
Since the size of the panel is already larger than the Form itself, Form's scrollbars (not Panel's) need to be manipulated.
See this : http://img824.imageshack.us/img824/1388/panelv.png
So, to get the clickX value, you dont need to add panel1.HorizontalScroll.Value to e.X .
In this case e.X itself will be clickX .
Can you please help some more to deal this problem ?
|
|
|
|