|
Has anyone here any experience working
with the MetaDraw component from Bennet-Tec.
I'm starting a new project and I'm looking
for a component that allows users to draw and later
to move shapes around - like in Visio but without every
user needing to purchase Visio ( required when using Visio ActiveX ).
MetaDraw seems to fit but I'd like to know if anyone
has experience using it. Also how is their support ?
|
|
|
|
|
Hi. I'm coding a C# application and I know nothing about GDI. I have a mdi parent form which has mdi child forms bigger than the screen. I overcome the form screen size limitation using the following code I've found on the net but now I have a problem: setting form.Location property doesn't work. Can you please tell me how to fix this?
Here's the code:
[System.Runtime.InteropServices.DllImport("user32")]<br />
public static extern int SetWindowPos(int hwnd, int hWndInsertAfter, int x, int y, int cx, int cy, int wFlags);<br />
<br />
protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)<br />
{<br />
SetWindowPos((int)this.Handle, 0, 0, 0, width, height, 0);<br />
}
|
|
|
|
|
This is really a NET Framework question, rather than a GDI question, but,...
I'm just guessing here, but, when you set or get a value for Location in your NET Form class, the framework at some point probably interops to the underlying Win32 API to do the actual work (probably SetWindowPos). And, by importing the original function with the System.Runtime.InteropServices.DllImport("user32") attribute, (Check out: PInvoke, SetWindowPos[^]) you are just short-circuiting the NET class implementation, which probably maintains a complex Form instance data structure somewhere in garbage-collected memory, and has a conflict now because the data are NOT what it expects, or something similar. Almost all of the NET Framework still interops its function calls, and it can be confusing from a developers point of view to maintain a consistent implementation.
The simplest method would be to use Form.Location property in the first place to set and maintain the correct value for your form's display. The MSDN documentation Control.Location[^] doesn't really explain that, though.
You might find this interesting: NET Framework Interoperability[^]
The article advises: "Before you decide to call a flat API using either of these interop technologies, you should determine whether there is equivalent functionality available in the .NET Framework. It is suggested that, whenever possible, you use .NET Framework functionality instead of calling unmanaged APIs."
modified on Thursday, May 8, 2008 1:38 PM
|
|
|
|
|
Hello,
I'm looking for an image transition library, i.e. wipes fades etc for vb.Net can anyone point me in the right direction please?
John
|
|
|
|
|
Use CxImage Library available on codeproject.
Don't be ruffled if now and then you get a brush from the world; it will be over in no time, and everything will be all right.(Swami Vivekananda)
|
|
|
|
|
Hi all,
I am planning to develop a website which have a simulator where allows users to design thier nail design online. This will be something drag and drop the design to the fingernail in 3D mode.
I would like to ask can this implement in C# with Managed DirectX? And, how do I implement this using C# wi9th Managed DirectX?
Thanks.
|
|
|
|
|
You've demonstrated the worse case of abusing these boards I've seen.
Nice.
Pick ONE APPROPRIATE board and post your question. Folks will be much friendlier
Good luck,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Sorry.
This is my first time asking the question on this website.
Regards,
Katelva
|
|
|
|
|
katelva wrote: This is my first time asking the question on this website
But you've been here for two years, didn't you get a hint or three in that time how things work?
2 75 22 6
|
|
|
|
|
You forgot to post in the SQL forum.
|
|
|
|
|
Luc Pattyn wrote: You forgot to post in the SQL forum
...and the Silverlight forum too!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
*grin* yeah, I think that's what he needs to use.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Mark Salsbery wrote: ...and the Silverlight forum too!
Had to give him the hint, didn't you?
2 75 22 6
|
|
|
|
|
O M G
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I have a winform which has a UserControl in it that I use for drawing. The only drawing it does is creating rectangles made by user using mouse. Now, I need to add two comboboxes next to each rectangle. I created a UserControl which has two comboboxes in it. When a rectangle is done I create a new UserControl and it to the page, placing next to the new rectangle. Now this works fine but after a few rectangles (and combobox UserControls) the cpu usage goes off the charts while drawing new rectangle. While idle there's no cpu usage but drawing becomes impossible. With UserControl without comboboxes or without any UserControls (only drawed rectangles) this problem doesn't happen. Also I only have one Graphics, I use the only one comes with PaintEventArgs.
The UserControl I use for drawing is very similar to DrawTools here[^].
Any idea about what's the problem is or other ways to add comboboxes next to the rectangles? I'd appreciate any help..
|
|
|
|
|
I'm not sure how your invalidating your form but if your invalidating the entire area everytime the dynamic rectangle is resized then you will see a performance hit. If your not familiar with Clipping an invalidation area, I suggest you do a google search on "Invalidation+Clipping".
Cheers,
Richard
If you could rent a programmer a hour and a half for a dollar and a half, how much would he charge for 10 hours?
|
|
|
|
|
programmingAddict wrote: I'm not sure how your invalidating your form but if your invalidating the entire area everytime the dynamic rectangle is resized then you will see a performance hit.
The UserControl displays an image as background. I use Refresh() at:
1. When new image is assigned
2. New rectangle is added
3. Rectangle is resized
Also on OnPaint() event I use graphics.DrawImage for the image and graphics.DrawRectangle for all the rectangles. Combobox UserControls are added with this.Controls.Add() and I don't do anything specific to draw them.
The form and UserControl size doesn't change at all.
I set double buffering true on drawing UserControl and on combobox UserControl.
Anything I overdone/done bad?
modified on Saturday, May 3, 2008 12:44 PM
|
|
|
|
|
Hi,
I tend to never use Refresh(), I call Invalidate() instead.
Refresh is Invalidate+ImmediateRepaint which typically is more than what is really
necessary, so I suggest you try with Invalidate().
If that results in some parts not being updated, then your architecture is wrong;
Refresh() should be used only when it is essential to have something redrawn right away
say for better esthetics, not to get it right.
|
|
|
|
|
How do I write my own Autobalance code, like Acdsee and Photoshop have? I can't find it anywhere. It is not equalize cause the result doesnt look like anything as good as in the forementioned apps.
I believe I need the Histogram for this purpose, but where do I go from here?
Thanks
|
|
|
|
|
Hi Guys,
I am really stuck here, unable to find any solution on the net, and hence would like to ask all you experts out there...if you could please please help me...
I am using the GDI+ Graphics Class in VS2005 (.NET FW 2.5), to write text in a form of mine.
The form however, has multiple (multi-colored) pictures and background images. Thats why I chose Graphics.DrawString to write over these images.
Now, I want that once a text has been displayed, on another button click, this text should be erased, and instead a new one should be displayed.
The problem right now is, when i write the new text, C# writes it over the old one..and well u can imagine how it looks like then... unreadably gibberish! And thats coz i cant figure out how to erase the old text, i believe.
Any ideas people??
-Thanks a million!!
|
|
|
|
|
Don't draw on your image, draw on the screen in your paint event.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi all,
Can i know how to force to refresh the graphic?
Any tips are welcome.
Note: I am using override OnPaint and render() method to display the graphic.
regards
cocoonwls
|
|
|
|
|
A bit of background information would be usefull (even needed). Which technologies are you using ? A wild guess because I recognize OnPaint is that you are using the MFC's in C++ (but as I'm not familiar with other technologies, it can be completely wrong).
If that's the case, calling Invalidate will force a redraw of your window.
|
|
|
|
|
Hi Cedric,
Thanks for reply, I am using buffer graphic (GDI technologies in c#)to draw into off screen. then use Render() method to display on screen.Note that, these drawing method is develop in my Custom User Control. here are some samples code :
FrmMain : TimewayChartControl
private void DrawChart()<br />
{<br />
TimewayChartControl.CreatBufferGraphics(); <-----create buffergraphic<br />
TimewayChartControl.RenderLinePath(); <-----draw line<br />
}
Custom Control:
BufferedGraphicsContext CurrentContext = BufferedGraphicsManager.Current;<br />
BufferedGraphics bg;
public void CreatBufferGraphics()<br />
{<br />
bg = CurrentContext.Allocate(this.CreateGraphics(), this.ClientRectangle);<br />
bg.Graphics.TextRenderingHint = TextRenderingHint.AntiAlias;<br />
bg.Graphics.Clear(this.BackColor);<br />
}
private void DrawLinePath(Graphics g)<br />
{<br />
g.DrawPath(LinePathPen, gpLine);<br />
}
protected override void OnPaint(PaintEventArgs pe)<br />
{<br />
bg.Render(pe.Graphics);<br />
}
Everytime when after i draw the first graphic, the second graphic which i draw will not render unless some frame or other form move over the painting area, then only the second graphic will appear and erase the first graphic.... I am not sure what was happen
|
|
|
|
|
Hi Cedric,
i have try to use invalidate in my application, but seem it dosen't work for me
I try to add Invalidate after calling TimewayChartControl.RenderLinePath(); , it dosen't work (please point it out if i was wrong,thanks).
|
|
|
|