Click here to Skip to main content
15,888,579 members
Home / Discussions / C#
   

C#

 
AnswerRe: how to get shotcut in the folder right click Pin
Judah Gabriel Himango24-Apr-07 4:08
sponsorJudah Gabriel Himango24-Apr-07 4:08 
GeneralRe: how to get shotcut in the folder right click Pin
Nkuttynasi25-Apr-07 6:19
Nkuttynasi25-Apr-07 6:19 
QuestionMDI Child Pin
sayed8324-Apr-07 3:02
sayed8324-Apr-07 3:02 
AnswerRe: MDI Child Pin
Pete O'Hanlon24-Apr-07 3:06
mvePete O'Hanlon24-Apr-07 3:06 
QuestionWebServices and classes Pin
JHubSharp24-Apr-07 2:29
JHubSharp24-Apr-07 2:29 
QuestionSystem.NotSupportedException (not support proxies of web-proxy scheme) Pin
AlexZieg7124-Apr-07 2:26
AlexZieg7124-Apr-07 2:26 
QuestionCOM realted question Pin
Stevo Z24-Apr-07 2:24
Stevo Z24-Apr-07 2:24 
Question(wpf) Panning & zooming Pin
Frostsnow24-Apr-07 2:11
Frostsnow24-Apr-07 2:11 
Hi, we're a couple of students on our internship, and we're kinda stuck in the project we're doing. I'll first try to explain what it is we are expected to make.

You have to imagine a white empty 2D paper which is virtually unlimited in size. An admin can place a question on this paper, users can then reply on the active question. The admin can also zoom in and zoom out and drag the paper around and post new questions. So we have to work with an environment that contains a fair amount of questions linked to answers. Every question can be differently scaled, so this means that you have to zoom in more on some questions than others.

Basic functionality would have to be panning the paper, by that I mean hold mouse down and dragging it to another position, thus moving all objects on the paper in that direction.

We've tried this with the following code, however the performance was really bad.

void Window_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)<br />
{<br />
if (mbMouseDown)<br />
{<br />
Point bNew = e.GetPosition(Window);<br />
foreach (UIElement oObject in LayoutRoot.Children)<br />
{<br />
Canvas.SetTop(oObject, bNew.X - mpBegin.X);<br />
Canvas.SetLeft(oObject, bNew.Y - mpBegin.Y);<br />
}<br />
}<br />
mbMouseDown = false;<br />
}<br />
<br />
void LayoutRoot_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)<br />
{<br />
if (mbMouseDown)<br />
{<br />
Point bNew = e.GetPosition(Window);<br />
foreach (UIElement oObject in LayoutRoot.Children)<br />
{<br />
Canvas.SetTop(oObject, bNew.X - mpBegin.X);<br />
Canvas.SetLeft(oObject, bNew.Y - mpBegin.Y);<br />
}<br />
}<br />
}<br />
<br />
void LayoutRoot_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)<br />
{<br />
mbMouseDown = true;<br />
mpBegin = e.GetPosition(Window);<br />
}

With the zooming we tried the scaling functionality of wpf.
private void Window_MouseWheel(object sender, MouseWheelEventArgs e)<br />
<br />
{<br />
<br />
if (e.Delta > 0)<br />
<br />
{<br />
<br />
mpScaleSize = new Point((mpScaleSize.X - 0.05), (mpScaleSize.Y - 0.05));<br />
<br />
grdCanvas.LayoutTransform = new ScaleTransform(mpScaleSize.X, mpScaleSize.Y);<br />
<br />
zoomX.Content = mpScaleSize.X.ToString();<br />
<br />
zoomY.Content = mpScaleSize.Y.ToString();<br />
<br />
}<br />
<br />
else<br />
<br />
{<br />
<br />
mpScaleSize = new Point((mpScaleSize.X + 0.05), (mpScaleSize.Y + 0.05));<br />
<br />
grdCanvas.LayoutTransform = new ScaleTransform(mpScaleSize.X, mpScaleSize.Y);<br />
<br />
zoomX.Content = mpScaleSize.X.ToString();<br />
<br />
zoomY.Content = mpScaleSize.Y.ToString();<br />
<br />
}<br />
<br />
}

This again wasn't going smoothly.
(My laptop is a IBM Thinkpad r50p, 1,7Ghrz Centrino, 1gig RAM, maybe it's just not fast enough?)

Anyway , I've posted this same question on the msdn forums. One person with little experience with the subject suggested me that I should try to work with visualBrushes and use it as some kind of view. I've been playing around with the VisualBrushes for a while now.

I've managed to get controls from code onto the VisualBrush(which is on a rectangle in the center of my app), however working with VisualBrush as some kind of view isn't working for me.What I "discovered"is that working with the viewbox property of the visualbrush might be the solution, but I can't seem to get it to work.

To my understanding the viewbox is a rectangle with it's x & y as panning values, and it's with & height as crop/stretch values (zoom).

Anyone with some experience in the area, I would really appreciate the help.


Thanks,
Tobias
Questionhow to create an array right, if you don't know its length in advance Pin
greenpci24-Apr-07 1:49
greenpci24-Apr-07 1:49 
AnswerRe: how to create an array right, if you don't know its length in advance Pin
Christian Graus24-Apr-07 1:55
protectorChristian Graus24-Apr-07 1:55 
Generalspeed boost Pin
V.24-Apr-07 1:31
professionalV.24-Apr-07 1:31 
GeneralRe: speed boost Pin
althamda24-Apr-07 1:54
althamda24-Apr-07 1:54 
GeneralRe: speed boost Pin
Christian Graus24-Apr-07 1:59
protectorChristian Graus24-Apr-07 1:59 
GeneralRe: speed boost Pin
V.24-Apr-07 2:18
professionalV.24-Apr-07 2:18 
GeneralRe: speed boost Pin
Pete O'Hanlon24-Apr-07 4:04
mvePete O'Hanlon24-Apr-07 4:04 
GeneralRe: speed boost Pin
V.24-Apr-07 4:14
professionalV.24-Apr-07 4:14 
GeneralRe: speed boost Pin
Pete O'Hanlon24-Apr-07 4:22
mvePete O'Hanlon24-Apr-07 4:22 
GeneralRe: speed boost Pin
althamda24-Apr-07 4:41
althamda24-Apr-07 4:41 
GeneralRe: speed boost Pin
Pete O'Hanlon24-Apr-07 5:17
mvePete O'Hanlon24-Apr-07 5:17 
QuestionHow to copy a string into a byte[] Pin
GDavy24-Apr-07 1:16
GDavy24-Apr-07 1:16 
AnswerRe: How to copy a string into a byte[] Pin
stancrm24-Apr-07 1:18
stancrm24-Apr-07 1:18 
AnswerRe: How to copy a string into a byte[] Pin
szukuro24-Apr-07 1:23
szukuro24-Apr-07 1:23 
AnswerRe: How to copy a string into a byte[] Pin
lmoelleb24-Apr-07 1:24
lmoelleb24-Apr-07 1:24 
GeneralRe: How to copy a string into a byte[] Pin
GDavy24-Apr-07 1:26
GDavy24-Apr-07 1:26 
QuestionProblem in trying to hide MenuStipItems from a static function Pin
Rocky#24-Apr-07 1:11
Rocky#24-Apr-07 1:11 

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.