|
Well, with a bunch of sin and cos and a bit of multiplication, you can do it.
Can you be more precise in your questions?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
I am coding a program that drawing shapes in canvas. Shapes can move, rotate, resize and group together. I tried many ways (using Matrix...) but it still slow and not accuracy (due to rotate action).
Anybody knows any program do like me or any document about this problems, help me!!!!
Thank for your help!
|
|
|
|
|
If they are moving, you should be using DirectX
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
It is like you edit a canvas in Microsoft Word, I dont think I have to use DirectX
|
|
|
|
|
OK, it depends, you didn't describe it well, if it's just simple drawing. In that case, it's impossible to say much, based on your vague descriptions.
Of course, Word is written in C, so it's always going to be faster than C#. I have written plenty of paint programs in C# tho. It depends, if you have a lot of moving objects, as you implied, then it's not like Word, and you need DX to do it well.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
It's slow and not accuracy not because of my drawing method (i use double buffer and other fast techique to draw) but because of the transformation agorithyms.
I searched the Internet but dont see anything...
|
|
|
|
|
try to put the property double buffering to true in your form properties.
V.
I found a living worth working for, but haven't found work worth living for.
|
|
|
|
|
maybe showing the code could help us help you.
|
|
|
|
|
OK, but it is so BIG
This is my main class of shape, I hope it's not very complicated to learn
using System;<br />
using System.Collections.Generic;<br />
using System.Text;<br />
using System.Drawing;<br />
using System.Drawing.Drawing2D;<br />
using System.Windows.Forms;<br />
using EZDesignerCore.ShapeAttribute;<br />
using EZDesignerCore.ShapeApperance;<br />
using Utils.GraphicsUtils;<br />
<br />
namespace EZDesignerCore.Shape<br />
{<br />
public abstract class AbstractShape : ICloneable, IDisposable<br />
{<br />
#region properties<br />
<br />
protected string _name;<br />
public string Name<br />
{<br />
get { return _name; }<br />
set { _name = value; }<br />
}<br />
<br />
protected string _text;<br />
public string Text<br />
{<br />
get { return _text; }<br />
set { _text = value; }<br />
}<br />
<br />
protected RectangleF _border;<br />
public RectangleF Border<br />
{<br />
get { return _border; }<br />
}<br />
<br />
public virtual PointF Location<br />
{<br />
get { return _border.Location; }<br />
set { _border.Location = value; }<br />
}<br />
<br />
public virtual SizeF Size<br />
{<br />
get { return _border.Size; }<br />
set { _border.Size = value; }<br />
}<br />
<br />
protected Spot _spot;<br />
public Spot Spot<br />
{<br />
get { return _spot; }<br />
}<br />
<br />
protected Apperance _apprerance;<br />
public Apperance Apprerance<br />
{<br />
get { return _apprerance; }<br />
}<br />
<br />
protected Restriction _restriction;<br />
public Restriction Restriction<br />
{<br />
get { return _restriction; }<br />
}<br />
<br />
protected State _state;<br />
internal State State<br />
{<br />
get { return _state; }<br />
set { _state = value; }<br />
}<br />
<br />
protected float _rotateDegree;<br />
public float RotateDegree<br />
{<br />
get { return _rotateDegree; }<br />
set { _rotateDegree = value; }<br />
}<br />
<br />
protected TextBox _editTextBox;<br />
public TextBox EditTextBox<br />
{<br />
get { return _editTextBox; }<br />
}<br />
<br />
#endregion<br />
<br />
PointF _startPoint = PointF.Empty;<br />
Control _control = null;<br />
Graphics _graphics = null;<br />
<br />
GraphicsPath _path;<br />
GraphicsPath _oldPath = null;<br />
protected float[] _childShapeRotateDegrees;<br />
<br />
#region constructor<br />
<br />
public AbstractShape()<br />
{<br />
_spot = new Spot();<br />
_apprerance = new Apperance();<br />
_state = new State();<br />
_restriction = new Restriction();<br />
_border = new Rectangle(0, 0, 10, 10);<br />
_name = "Object";<br />
_path = new GraphicsPath();<br />
}<br />
<br />
public abstract AbstractShape CreateInstance();<br />
<br />
#endregion<br />
<br />
public abstract GraphicsPath CreatePath(PointF startPoint, PointF endPoint);<br />
<br />
#region draw<br />
<br />
public void Draw(Graphics g)<br />
{<br />
Matrix oldMatrix = g.Transform;<br />
if (_rotateDegree != 0)<br />
{<br />
using (Matrix matrix = new Matrix())<br />
{<br />
matrix.RotateAt(_rotateDegree, _spot.RotatePoint);<br />
g.MultiplyTransform(matrix);<br />
}<br />
}<br />
<br />
DrawDetail(g);<br />
<br />
if (_rotateDegree != 0)<br />
{<br />
g.Transform = oldMatrix;<br />
}<br />
}<br />
<br />
protected abstract void DrawDetail(Graphics g);<br />
<br />
#endregion<br />
<br />
#region create shape<br />
<br />
public void EnterCreateMode(PointF point, Control control, Graphics graphics)<br />
{<br />
_control = control;<br />
_graphics = graphics;<br />
_startPoint = point;<br />
_state |= State.Creating;<br />
_control.MouseMove += new MouseEventHandler(EnterCreateMode_MouseMove);<br />
}<br />
<br />
void EnterCreateMode_MouseMove(object sender, MouseEventArgs e)<br />
{<br />
if (e.Button != MouseButtons.Left)<br />
return;<br />
<br />
DrawCreatingObject(_startPoint, e.Location, _graphics);<br />
}<br />
<br />
protected void DrawCreatingObject(PointF startPoint, PointF endPoint, Graphics g)<br />
{<br />
if (_oldPath != null)<br />
Rubberband.DrawXORPath(g, _oldPath, _childShapeRotateDegrees);<br />
<br />
if (_path != null)<br />
_path.Dispose();<br />
_path = CreatePath(startPoint, endPoint);<br />
Rubberband.DrawXORPath(g, _path, _childShapeRotateDegrees);<br />
_oldPath = _path;<br />
}<br />
<br />
public virtual void Create(PointF startPoint, PointF endPoint)<br />
{<br />
_border = Functions.StandardlizeRect(startPoint, endPoint);<br />
float width = Math.Max(5, _border.Size.Width);<br />
float height = Math.Max(5, _border.Size.Height);<br />
_border.Size = new SizeF(width, height);<br />
_spot.CalculateSpots(_border, _rotateDegree);<br />
}<br />
<br />
protected void LeaveCreatingMode(PointF point)<br />
{<br />
Create(_startPoint, point);<br />
GCPath();<br />
_state &= ~State.Creating;<br />
_control.MouseMove -= new MouseEventHandler(EnterCreateMode_MouseMove);<br />
}<br />
<br />
#endregion<br />
<br />
#region move<br />
<br />
public void EnterMovingMode(PointF point, Control control, Graphics graphics)<br />
{<br />
_control = control;<br />
_graphics = graphics;<br />
_startPoint = point;<br />
_state |= State.Moving;<br />
_control.MouseMove += new MouseEventHandler(EnterMovingMode_MouseMove);<br />
}<br />
<br />
void EnterMovingMode_MouseMove(object sender, MouseEventArgs e)<br />
{<br />
if (e.Button != MouseButtons.Left)<br />
return;<br />
<br />
DrawMovingObject(_startPoint, e.Location, _graphics);<br />
}<br />
<br />
PointF _oldMovingEndPoint;<br />
public void DrawMovingObject(PointF startPoint, PointF endPoint, Graphics g)<br />
{<br />
if (_oldPath != null)<br />
Rubberband.DrawXORPath(g, _oldPath, SizeF.Empty, PointF.Empty, new SizeF(_oldMovingEndPoint.X - startPoint.X, _oldMovingEndPoint.Y - startPoint.Y), _rotateDegree, _spot.RotatePoint, _childShapeRotateDegrees);<br />
<br />
if (_path != null)<br />
_path.Dispose();<br />
_path = CreatePath(_border.Location, new PointF(_border.Right, _border.Bottom));<br />
Rubberband.DrawXORPath(g, _path, SizeF.Empty, PointF.Empty, new SizeF(endPoint.X - startPoint.X, endPoint.Y - startPoint.Y), _rotateDegree, _spot.RotatePoint, _childShapeRotateDegrees);<br />
<br />
_oldPath = _path;<br />
_oldMovingEndPoint = endPoint;<br />
}<br />
<br />
public virtual void Move(float offsetX, float offsetY)<br />
{<br />
PointF[] pts = Functions.GetPointsFromRect(_border);<br />
using (Matrix matrix = new Matrix())<br />
{<br />
matrix.Translate(offsetX, offsetY);<br />
matrix.TransformPoints(pts);<br />
}<br />
<br />
_border = Functions.GetRectFromPoints(pts);<br />
_spot.CalculateSpots(_border, _rotateDegree);<br />
}<br />
<br />
protected void LeaveMovingMode(PointF point)<br />
{<br />
Move(point.X - _startPoint.X, point.Y - _startPoint.Y);<br />
GCPath();<br />
_state &= ~State.Moving;<br />
_control.MouseMove -= new MouseEventHandler(EnterMovingMode_MouseMove);<br />
}<br />
<br />
#endregion<br />
<br />
#region resize<br />
<br />
SpotLocation _spotLocation;<br />
public void EnterResizeMode(SpotLocation location, Control control, PointF point, Graphics graphics)<br />
{<br />
_control = control;<br />
_graphics = graphics;<br />
_startPoint = point;<br />
_spotLocation = location;<br />
_state |= State.Resizing;<br />
_control.MouseMove += new MouseEventHandler(EnterResizingMode_MouseMove);<br />
}<br />
<br />
void EnterResizingMode_MouseMove(object sender, MouseEventArgs e)<br />
{<br />
if (e.Button != MouseButtons.Left)<br />
return;<br />
<br />
DrawResizingObject(_spotLocation, _startPoint, e.Location, _graphics);<br />
}<br />
<br />
SizeF _oldScaleSize;<br />
protected void DrawResizingObject(SpotLocation location, PointF startPoint, PointF endPoint, Graphics g)<br />
{<br />
PointF scaleRootPoint;<br />
SizeF scaleSize;<br />
CalculateScaleInfo(location, startPoint, endPoint, out scaleRootPoint, out scaleSize);<br />
<br />
if (_oldPath != null)<br />
Rubberband.DrawXORPath(g, _path, _oldScaleSize, scaleRootPoint, SizeF.Empty, _rotateDegree, _spot.RotatePoint, _childShapeRotateDegrees);<br />
<br />
if (_path != null)<br />
_path.Dispose();<br />
_path = CreatePath(_border.Location, new PointF(_border.Right, _border.Bottom));<br />
Rubberband.DrawXORPath(g, _path, scaleSize, scaleRootPoint, SizeF.Empty, _rotateDegree, _spot.RotatePoint, _childShapeRotateDegrees);<br />
<br />
_oldPath = _path;<br />
_oldScaleSize = scaleSize;<br />
}<br />
<br />
protected void CalculateScaleInfo(SpotLocation location, PointF startPoint, PointF endPoint, out PointF scaleRootPoint, out SizeF scaleSize)<br />
{<br />
scaleRootPoint = PointF.Empty;<br />
scaleSize = SizeF.Empty;<br />
<br />
_spot.CalculateSpots(_border, 0);<br />
<br />
if (_rotateDegree != 0)<br />
{<br />
using (Matrix matrix = new Matrix())<br />
{<br />
matrix.RotateAt(-_rotateDegree, startPoint);<br />
PointF[] pts = new PointF[] { endPoint };<br />
matrix.TransformPoints(pts);<br />
endPoint = pts[0];<br />
}<br />
}<br />
<br />
float distanceX = startPoint.X - endPoint.X;<br />
float distanceY = startPoint.Y - endPoint.Y;<br />
<br />
float width = _border.Width;<br />
float height = _border.Height;<br />
<br />
switch (location)<br />
{<br />
case SpotLocation.Left:<br />
scaleRootPoint = _spot.Right;<br />
scaleSize = new SizeF((float)(width + distanceX) / width, 1);<br />
break;<br />
<br />
case SpotLocation.TopLeft:<br />
scaleRootPoint = _spot.BottomRight;<br />
scaleSize = new SizeF((float)(width + distanceX) / width, (float)(height + distanceY) / height);<br />
break;<br />
<br />
case SpotLocation.Top:<br />
scaleRootPoint = _spot.Bottom;<br />
scaleSize = new SizeF(1, (float)(height + distanceY) / height);<br />
break;<br />
<br />
case SpotLocation.TopRight:<br />
scaleRootPoint = _spot.BottomLeft;<br />
scaleSize = new SizeF((float)(width + (-distanceX)) / width, (float)(height + distanceY) / height);<br />
break;<br />
<br />
case SpotLocation.Right:<br />
scaleRootPoint = _spot.Left;<br />
scaleSize = new SizeF((float)(width + (-distanceX)) / width, 1);<br />
break;<br />
<br />
case SpotLocation.BottomRight:<br />
scaleRootPoint = _spot.TopLeft;<br />
scaleSize = new SizeF((float)(width + (-distanceX)) / width, (float)(height + (-distanceY)) / height);<br />
break;<br />
<br />
case SpotLocation.Bottom:<br />
scaleRootPoint = _spot.Top;<br />
scaleSize = new SizeF(1, (float)(height + (-distanceY)) / height);<br />
break;<br />
<br />
case SpotLocation.BottomLeft:<br />
scaleRootPoint = _spot.TopRight;<br />
scaleSize = new SizeF((float)(width + distanceX) / width, (float)(_border.Height + (-distanceY)) / height);<br />
break;<br />
}<br />
}<br />
<br />
protected PointF _resizeOffset;<br />
public virtual void Resize(PointF scaleRootPoint, SizeF scaleSize)<br />
{<br />
PointF[] pts = Functions.GetPointsFromRect(_border);<br />
RectangleF tmp = _border;<br />
<br />
using (Matrix matrix = new Matrix())<br />
{<br />
matrix.Translate(-scaleRootPoint.X, -scaleRootPoint.Y);<br />
matrix.TransformPoints(pts);<br />
matrix.Reset();<br />
matrix.Scale(scaleSize.Width, scaleSize.Height);<br />
matrix.TransformPoints(pts);<br />
matrix.Reset();<br />
matrix.Translate(scaleRootPoint.X, scaleRootPoint.Y);<br />
matrix.TransformPoints(pts);<br />
tmp = Functions.GetRectFromPoints(pts);<br />
<br />
if (_rotateDegree != 0)<br />
{<br />
matrix.Reset();<br />
matrix.RotateAt(_rotateDegree, _spot.RotatePoint);<br />
matrix.TransformPoints(pts);<br />
<br />
PointF newRotatePoint = Functions.GetRotatePoint(pts);<br />
<br />
pts = Functions.GetPointsFromRect(_border);<br />
PointF oldRotatePoint = Functions.GetRotatePoint(tmp);<br />
float offsetX = newRotatePoint.X - oldRotatePoint.X;<br />
float offsetY = newRotatePoint.Y - oldRotatePoint.Y;<br />
_resizeOffset = new PointF(offsetX, offsetY);<br />
matrix.Reset();<br />
matrix.Translate(offsetX, offsetY);<br />
matrix.TransformPoints(pts);<br />
<br />
tmp = Functions.GetRectFromPoints(pts);<br />
}<br />
}<br />
<br />
tmp = Functions.StandardlizeRect(tmp.Location, new PointF(tmp.X + tmp.Width, tmp.Y + tmp.Height));<br />
float width = Math.Max(5, tmp.Width);<br />
float height = Math.Max(5, tmp.Height);<br />
tmp.Size = new SizeF(width, height);<br />
_border = tmp;
_spot.CalculateSpots(_border, _rotateDegree);<br />
}<br />
<br />
protected void LeaveResizingMode(PointF point)<br />
{<br />
PointF scaleRootPoint;<br />
SizeF scaleSize;<br />
CalculateScaleInfo(_spotLocation, _startPoint, point, out scaleRootPoint, out scaleSize);<br />
<br />
Resize(scaleRootPoint, scaleSize);<br />
GCPath();<br />
_state &= ~State.Resizing;<br />
_control.MouseMove -= new MouseEventHandler(EnterResizingMode_MouseMove);<br />
}<br />
<br />
#endregion<br />
<br />
#region rotate<br />
<br />
static AbstractShape __firstShape;<br />
static float __rotateDegree;<br />
public void EnterRotateMode(Control control, PointF point, Graphics graphics, AbstractShape firstShape)<br />
{<br />
__firstShape = firstShape;<br />
_control = control;<br />
_graphics = graphics;<br />
_startPoint = point;<br />
_state |= State.Rotating;<br />
_control.MouseMove += new MouseEventHandler(EnterRotatingMode_MouseMove);<br />
}<br />
<br />
void EnterRotatingMode_MouseMove(object sender, MouseEventArgs e)<br />
{<br />
if (e.Button != MouseButtons.Left)<br />
return;<br />
<br />
if (this == __firstShape)<br />
__rotateDegree = CalculateRotateDegree(e.Location);<br />
<br />
DrawRotatingObject(_startPoint, e.Location, __rotateDegree, _graphics);<br />
}<br />
<br />
float _oldRotateDegree;<br />
public void DrawRotatingObject(PointF startPoint, PointF endPoint, float rotateDegree, Graphics g)<br />
{<br />
PointF[] pts = Functions.GetPointsFromRect(_border);<br />
using (Matrix matrix = new Matrix())<br />
{<br />
matrix.RotateAt(rotateDegree, _spot.RotatePoint);<br />
matrix.TransformPoints(pts);<br />
}<br />
<br />
if (_oldPath != null)<br />
Rubberband.DrawXORPath(g, _oldPath, SizeF.Empty, PointF.Empty, SizeF.Empty, _oldRotateDegree, _spot.RotatePoint, _childShapeRotateDegrees);<br />
<br />
if (_path != null)<br />
_path.Dispose();<br />
_path = CreatePath(_border.Location, new PointF(_border.Right, _border.Bottom));<br />
Rubberband.DrawXORPath(g, _path, SizeF.Empty, PointF.Empty, SizeF.Empty, rotateDegree, _spot.RotatePoint, _childShapeRotateDegrees);<br />
<br />
_oldPath = _path;<br />
_oldRotateDegree = rotateDegree;<br />
}<br />
<br />
public virtual void Rotate(float rotateDegree)<br />
{<br />
_rotateDegree = rotateDegree;<br />
_spot.CalculateSpots(_border, _rotateDegree);<br />
}<br />
<br />
protected void LeaveRotatingMode(PointF point)<br />
{<br />
Rotate(__rotateDegree);<br />
GCPath();<br />
_state &= ~State.Rotating;<br />
_control.MouseMove -= new MouseEventHandler(EnterRotatingMode_MouseMove);<br />
}<br />
<br />
float CalculateRotateDegree(PointF point)<br />
{<br />
PointF rootPoint = _spot.RotatePoint;<br />
<br />
double tg = ((float)point.X - rootPoint.X) / (-(float)point.Y + rootPoint.Y);<br />
float degree = (float)((Math.Atan(tg) / Math.PI) * 180);<br />
if ((point.X < rootPoint.X && point.Y > rootPoint.Y) || (point.X > rootPoint.X && point.Y > rootPoint.Y))<br />
degree += 180;<br />
return degree;<br />
}<br />
<br />
#endregion<br />
<br />
#region support functions<br />
<br />
public virtual bool Contains(PointF point)<br />
{<br />
using (GraphicsPath path = CreatePath(_border.Location, new PointF(_border.Right, _border.Bottom)))<br />
{<br />
if (_rotateDegree != 0)<br />
{<br />
using (Matrix matrix = new Matrix())<br />
{<br />
matrix.RotateAt(_rotateDegree, _spot.RotatePoint);<br />
path.Transform(matrix);<br />
}<br />
}<br />
return path.IsVisible(point);<br />
}<br />
}<br />
<br />
public void LeaveCurrentMode(PointF point)<br />
{<br />
if ((_state & State.Creating) != 0)<br />
LeaveCreatingMode(point);<br />
<br />
if ((_state & State.Moving) != 0)<br />
LeaveMovingMode(point);<br />
<br />
if ((_state & State.Resizing) != 0)<br />
LeaveResizingMode(point);<br />
<br />
if ((_state & State.Rotating) != 0)<br />
LeaveRotatingMode(point);<br />
}<br />
<br />
private void GCPath()<br />
{<br />
if (_oldPath != null)<br />
{<br />
_oldPath.Dispose();<br />
_oldPath = null;<br />
}<br />
if (_path != null)<br />
{<br />
_path.Dispose();<br />
_path = null;<br />
}<br />
}<br />
<br />
#endregion<br />
<br />
#region IClonable Members<br />
<br />
public virtual object Clone()<br />
{<br />
AbstractShape obj = this.CreateInstance();<br />
obj._name = _name;<br />
obj._text = _text;<br />
obj.Size = this.Size;<br />
obj.Location = this.Location;<br />
obj._apprerance = (Apperance)this._apprerance.Clone();<br />
obj._restriction = (Restriction)this._restriction.Clone();<br />
obj._spot = (Spot)this._spot.Clone();<br />
obj._rotateDegree = _rotateDegree;<br />
return obj;<br />
}<br />
<br />
#endregion<br />
<br />
#region IDisposable Members<br />
<br />
public virtual void Dispose()<br />
{<br />
if (this._apprerance != null)<br />
this._apprerance.Dispose();<br />
if (this._editTextBox != null && this._editTextBox.IsDisposed == false)<br />
this._editTextBox.Dispose();<br />
__firstShape = null;<br />
}<br />
<br />
#endregion<br />
}<br />
}
|
|
|
|
|
Hi,
yes it is big, and that was just the one abstract class...
my first impression is you create a lot of matrix objects, and you try to do
all the transformations (translation, rotation) yourself.
So it is my guess your app is repainting fine (e.g. when resizing the form),
but is slow when changing a shape (moving/rotating/whatever).
For one, I would give each shape one instance of Matrix, and Reset it when a new
matrix is needed, rather than creating matrix instances all the time.
But overall I think I would do it all differently: have each shape remember
its properties (size, color, whatever) and also its translation and rotation,
then use the transformations offered by Graphics in the paint handler itself.
As a result:
1) methods such as Move() would become very simple, they just accumulate translation,
but dont modify all the coordinates.
2) method draw() for one shape becomes something like:
g.ScaleTransform(...);
g.TranslateTransform(...);
g.RotateTransform(...);
NowDrawTheOriginalShape();
I realize this is quite a change from what you have, and I would suggest you
perform some small experiment before changing everything...
As a last thought, you may want to try repainting only the part of your drawing
that has changed, by using Control.Invalidate(Rectangle/Region).
|
|
|
|
|
I understand your idea that create the transformation status in each shape instance, for example:
float _scaleOffsetX;<br />
float _scaleOffsetY;<br />
float _rotateAngle;<br />
float _movingOffsetX;<br />
float _movingOffsetY;
and then use this information to draw the shape.
But did you notice my _border field? It is the bound of the shape. Client will use it to determine the shape's position and size, so it has to change when any transformation of the shape has done. The problem is when you rotate the shape, you have to re-calculate the _border again and of course its not accuracy.
I know you and I is so close to the final solution, but it's still the gap...
I will think about your solution more carefully.
|
|
|
|
|
Yes, you are right you need the final coordinates to support shape selection...
I have to think about this.
Can you confirm my assumption: "So it is my guess your app is repainting fine
(e.g. when resizing the form), but is slow when changing a shape (moving/rotating/whatever)."
Can you give a quantization on "slow drawing" ? And how many shapes are involved then ?
Please also show the draw method for a simple specific shape.
I am particularly interested in how you repaint (or let the system repaint) your
drawing.
|
|
|
|
|
Yes, its fast drawing, but not as fast as Word does. I just use and old-fashion double-buffer drawing techique.
For object moving, I use GDI rubberband line and curve to draw. It not good for now, fast on drawing rectangle, but for ellipse, I have to flatten the graphics path, so it's extremly slow when drawing moving ellipse.
I will show you the code (or even send mail to you all the source code) the next Monday, because I don't bring code to home and today is Saturday
Anyway, do you interest of building a canvas component that can draw and transform shapes, group shapes, support zooming, ect or know any body experienced about this?...... I'm stuck on this now because I working alone
|
|
|
|
|
How can I set enable true on Named Pipe using C# code?
Regards.
I Love SQL
|
|
|
|
|
Hi,
Its awesome really fantastic but it would be much better if we hide all the replies of a perticular query until one clicks on the respective query (as of tree view model) and at a time one can able to view only one replay, is it possible to view other replies opend at a time and more over if i click on the parent query then all the opend childs should be closed.
Please suggest me some ideas to implement the changes
very urgent ....
|
|
|
|
|
What on earth are you talking about ? Does this relate to a previous question ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: What on earth are you talking about ? Does this relate to a previous question ?
Probably this one[^] - But it still won't make any sense.
|
|
|
|
|
Wow...
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
That's awesomely fantastic that is.
Can anyone decipher this?
|
|
|
|
|
1. Don't multiple post.
2. What are you smoking?
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi All,
I am sure the solution to this is *Really* easy, but i've been staring at it for a while now and have got nowhere. I've written the test below in both C# and VB and both do the same thing.
I need to use an XmlReader object to read in an xml document. Note that it is essential that i use an XmlReader object as I need to perform schema validation. The code below does not incluse schema validation as as this stage i'm just trying to get an xml file into an XmlReader.
Looking in the msdn and a range of examples in google i should be able to get an XmlReader object containing my xml document by using XmlReader.Create(TextReader o). Everything is working right up until that step, but using the debug tools my XmlReader object appears to remain content-less. Here's the code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.IO;
namespace XmlTest
{
class Program
{
static void Main(string[] args)
{
String file = "C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\CONFIG\\web.config";
XmlDocument doc = new XmlDocument();
doc.Load(new System.IO.StreamReader(file));
String docString = doc.OuterXml;
TextReader tr = new StringReader(docString);
XmlReader xr = XmlReader.Create(tr);
System.Console.ReadKey();
}
}
}
So we're loading in an xml file, putting it into an XmlDocument and getting the Xml as a string out of it. This is because ultimately when i slot this work back into what i'm doing i'll be obtaining the xml document via a string.
A TextReader object is then created from the string via a StringReader. If i debug the code i can see the document correctly loaded into the TextReader (tr) in it's entirity. It just doesn't seem to be converted into an XmlReader object via XmlReader.Create(tr).
Similarly, if i replace XmlReader.Create(tr) with XmlReader.Create(new System.IO.StreamReader(file)) I have the same problem, proving it's none of the logic inbetween that is messing things up.
What am i missing about XmlReader? Please help if you can, this is driving me absolutely nuts. When i look at it in debug the object has a depth of zero and looking in items i see "In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user." I have no idea what this means and google doesn't help.
You should be able to copy and paste the code and replicate the issue easily.
Many thanks,
Rolf
|
|
|
|
|
It's morning, but, try use some method of XmlReader starting with "Read"
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
Tried that.
Using the ReadInnerXml and ReadOuterXml i get nothing.
Interestingly if i pass the XmlReader to an XmlDocument.load method and then inspect the XmlDocument, i see my xml is in there. But why can't i see it in the XmlReader object anywhere? Using both read methods and inspecting the object via 'watch' yields nothing.
|
|
|
|
|
Rolf Baxter wrote: Using the ReadInnerXml and ReadOuterXml i get nothing.
But these read content of current node. To move on node, use Read() method. Check out example[^].
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
Hi,
Its awesome really fantastic but it would be much better if we hide all the replies of a perticular query until one clicks on the respective query (as of tree view model) and at a time one can able to view only one replay, is it possible to view other replies opend at a time and more over if i click on the parent query then all the opend childs should be closed.
Please suggest me some ideas to implement the changes
very urgent ....
santy
|
|
|
|
|