Click here to Skip to main content
15,901,205 members
Home / Discussions / C#
   

C#

 
QuestionFetching dynamically generated data from a string of 10 lines using C# Pin
H he el el oooo6-Feb-06 22:16
H he el el oooo6-Feb-06 22:16 
AnswerRe: Fetching dynamically generated data from a string of 10 lines using C# Pin
leppie6-Feb-06 22:19
leppie6-Feb-06 22:19 
GeneralRe: Fetching dynamically generated data from a string of 10 lines using C# Pin
J4amieC6-Feb-06 23:59
J4amieC6-Feb-06 23:59 
GeneralRe: Fetching dynamically generated data from a string of 10 lines using C# Pin
leppie7-Feb-06 0:35
leppie7-Feb-06 0:35 
AnswerRe: Fetching dynamically generated data from a string of 10 lines using C# Pin
J4amieC7-Feb-06 0:02
J4amieC7-Feb-06 0:02 
QuestionAbout attachments ?????!!!!!! Pin
students552 university6-Feb-06 21:41
students552 university6-Feb-06 21:41 
AnswerRe: About attachments ?????!!!!!! Pin
J4amieC6-Feb-06 23:54
J4amieC6-Feb-06 23:54 
Questionmoving an object in a panel Pin
hpetriffer6-Feb-06 20:23
hpetriffer6-Feb-06 20:23 
Hello,

If I want to move an object in a panel than I have a lot of strange effects. I use a panel and an button (inside the panel on a form. If I move the button outside of the panel the behaviour of the panel is correct. But if I scroll first outside to the object and the I move the object to the left side. Than the Scollbar isn't anymore there. I have tested already a lot of things but allways I have a strange behaviour.
Has onyone an idea?

I use the following code:
<br />
public partial class Form1 : Form<br />
{<br />
private Point startLoc = new Point(0, 0);<br />
private Point actLoc;<br />
private Point posScreen;<br />
private bool dragging = false;<br />
private Button draggedObject;<br />
<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
<br />
panel1.AutoScroll = true;<br />
panel1.HorizontalScroll.Enabled = true;<br />
panel1.VerticalScroll.Enabled = true;<br />
<br />
button1.MouseMove += new MouseEventHandler(Object_MouseMove);<br />
button1.MouseDown += new MouseEventHandler(Object_MouseDown);<br />
button1.MouseUp += new MouseEventHandler(Object_MouseUp);<br />
}<br />
<br />
private void Object_MouseDown(Object sender, MouseEventArgs e)<br />
{<br />
if (e.Button == MouseButtons.Left &&<br />
sender.GetType() == typeof(Button))<br />
{<br />
Button visObj = (Button)sender;<br />
<br />
posScreen = visObj.PointToScreen(e.Location);<br />
startLoc = visObj.Location;<br />
draggedObject = visObj;<br />
dragging = true;<br />
}<br />
}<br />
<br />
<br />
private void Object_MouseMove(Object sender, MouseEventArgs e)<br />
{<br />
if (dragging == true)<br />
{<br />
Button visObj = (Button)sender;<br />
<br />
int deltaX = MousePosition.X - posScreen.X;<br />
int deltaY = MousePosition.Y - posScreen.Y;<br />
<br />
actLoc.X = startLoc.X + deltaX;<br />
actLoc.Y = startLoc.Y + deltaY;<br />
if (actLoc.X >= 0)<br />
{<br />
int horVal = this.HorizontalScroll.Value;<br />
int left;<br />
int rightObj = actLoc.X + visObj.Width;<br />
if (rightObj >= this.Width)<br />
{<br />
left = actLoc.X;// +actTabPage.AutoScrollPosition.X;<br />
}<br />
else<br />
{<br />
left = actLoc.X - this.AutoScrollPosition.X;<br />
}<br />
<br />
visObj.Left = left;<br />
}<br />
else<br />
{<br />
visObj.Left = 0;<br />
}<br />
<br />
if (actLoc.Y >= 0)<br />
{<br />
int top = actLoc.Y;// -actTabPage.AutoScrollOffset.Y;<br />
visObj.Top = top;<br />
<br />
}<br />
else<br />
{<br />
visObj.Top = 0;<br />
}<br />
<br />
}<br />
}<br />
<br />
private void Object_MouseUp(Object sender, MouseEventArgs e)<br />
{<br />
dragging = false;<br />
}<br />
}<br />



Regards and thanks for any hint!!!!!
Hansjörg
QuestionDeployment Pin
JacquesDP6-Feb-06 19:46
JacquesDP6-Feb-06 19:46 
AnswerRe: Deployment Pin
mav.northwind6-Feb-06 21:29
mav.northwind6-Feb-06 21:29 
QuestionRe: Deployment Pin
JacquesDP6-Feb-06 22:04
JacquesDP6-Feb-06 22:04 
AnswerRe: Deployment Pin
mav.northwind7-Feb-06 0:02
mav.northwind7-Feb-06 0:02 
GeneralRe: Deployment Pin
JacquesDP7-Feb-06 0:38
JacquesDP7-Feb-06 0:38 
QuestionRe: Deployment Pin
JacquesDP6-Feb-06 22:58
JacquesDP6-Feb-06 22:58 
QuestionCOM+ and .NET Pin
paully6-Feb-06 18:51
paully6-Feb-06 18:51 
AnswerRe: COM+ and .NET Pin
leppie6-Feb-06 22:24
leppie6-Feb-06 22:24 
Questiongenerate the C# application by coding C# Pin
tadung6-Feb-06 17:31
tadung6-Feb-06 17:31 
AnswerRe: generate the C# application by coding C# Pin
jdkulkarni7-Feb-06 1:57
jdkulkarni7-Feb-06 1:57 
QuestionTransaction Number Pin
knight_sky6-Feb-06 16:04
knight_sky6-Feb-06 16:04 
AnswerRe: Transaction Number Pin
Judah Gabriel Himango6-Feb-06 16:10
sponsorJudah Gabriel Himango6-Feb-06 16:10 
AnswerRe: Transaction Number Pin
JacquesDP6-Feb-06 20:15
JacquesDP6-Feb-06 20:15 
Questionlocation of current document Pin
edel_ong6-Feb-06 15:06
edel_ong6-Feb-06 15:06 
AnswerRe: location of current document Pin
Judah Gabriel Himango6-Feb-06 16:13
sponsorJudah Gabriel Himango6-Feb-06 16:13 
GeneralRe: location of current document Pin
edel_ong6-Feb-06 16:34
edel_ong6-Feb-06 16:34 
GeneralRe: location of current document Pin
Judah Gabriel Himango6-Feb-06 16:37
sponsorJudah Gabriel Himango6-Feb-06 16:37 

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.