|
Hi!
Again, thanks for the appreciation. I usually don't write such long answers but I've been at a customer site (staying at a hotel) this week, and nights get a bit boring...
Sorry, no idea what is happening. I have never used asynchronous calls seriously so I don't have any experience to draw from. Then again, try looking for asynchronous samples (I don't find any using HttpListeners, but there are bound to be others) and understand what they do. Then perhaps it will become clearer.
--
Peter
|
|
|
|
|
Hi,
I've seen others have this concern and have seen a multitude of solutions, but like Christian says, why? I only realized this recently (and felt pretty stupid about that), but like he says, there is NO circumstance whatsoever where it is correct for two different threads to invoke Dispose() on the same object.
In fact, if Dispose() is ever invoked twice on the same object (even from the same thread), it is a design fault. It is explicitly wrong to invoke Dispose() on an object if there is a chance (no matter how slim) that someone else is holding a reference to it (meaning that if you ever directly or indirectly expose a reference to an object outside of your class, you should never dispose the object).
Further, Dispose() cannot be invoked unless the object is alive, so it can never conflict with the finalizer being invoked by the GC.
The most common pattern for implementing IDisposable that I've seen is:
protected virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
}
disposed = true;
}
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
~MyClass()
{
Dispose(false);
}
Note: Written from memory, beware of spelling mistakes. Google for "IDisposable pattern" and you will get all the examples you need (good and bad).
Later,
--
Peter
|
|
|
|
|
|
I was wondering if there was any way to see what functions are availble in dll's. For example how can I find out the available functions for the user32.dll?
|
|
|
|
|
www.pinvoke.net has a good list.
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 )
|
|
|
|
|
|
If you really want to get oldschool, use the dumpbin[^] utility.
Scott P
“It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.”
-Edsger Dijkstra
|
|
|
|
|
Thanks for alll your replies.
|
|
|
|
|
I have to include a image such that it is editable when clicked on it.
Can any one help me?
|
|
|
|
|
|
http://msdn.microsoft.com/en-us/magazine/cc164043.aspx[^]
1) Open up your form in design view
2) In the toolbox, Right click and select "Choose Items"
3) When the dialog pops up, click the "Com components" tab
4) scroll down to "Microsoft Visio x.x Drawing Control" and tick it.
5) Hit OK
6) The control will appear in the toolbox under General.
7) Drag the control onto your form.
You can use this control to display a Visio drawing and allow the user to edit it. See the MSDN article above for a tutorial of using the control.
Note that this will bind to a specific version of Visio. The user must have that version installed to use your app. There is a way of bundling up a lite installer with your app, that the article talks about. I would assume the user still has to have a Visio license, but I'm not sure.
Simon
|
|
|
|
|
hi,i have a form and when you click a button you show a webbrowser whith a flash and a textbox in the html,and i would obtain the information of the textbox(is in the web page) how i can?
|
|
|
|
|
You need to do this by inspecting the website using the DOM. It's not a simple thing, the web browser is it's own world, it doesn't expose stuff like a windows app
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,
I'm using an Access file as data source of a crystal report Report, in my computer all is ok, but when install my application in another system, because the path of mdb file changes, the report don't work?
how can give a related path in crystal report or force it to read the path from a setting file?
Best wishes
|
|
|
|
|
mehrdadc48 wrote: I'm using an Access file as data source of a crystal report Report, in my computer all is ok, but when install my application in another system, because the path of mdb file changes, the report don't work?
how can give a related path in crystal report or force it to read the path from a setting file?
You will need to define the connection parameters to the report within your code.
HTH.
|
|
|
|
|
hi
i need a control that display my image maps and panning and zooming it in my control.
i was create a userControl named ImageMap, and add a panel to it and set Doc to Fill and wrote this code to get result :
public partial class ImageMap : UserControl<br />
{ <br />
Bitmap bitmap; <br />
BufferedGraphicsContext currentContext;<br />
BufferedGraphics myBuffer; <br />
PointF viewPortCenter;<br />
float Zoom = 1.0f;<br />
<br />
bool draging = false;<br />
Point lastMouse;<br />
public static Rectangle rec;<br />
<br />
<br />
public ImageMap()<br />
{<br />
InitializeComponent();<br />
currentContext = BufferedGraphicsManager.Current;<br />
setup(false);<br />
rec = this.panel1.DisplayRectangle;<br />
} <br />
<br />
private void setup(bool resetViewport)<br />
{ <br />
if (myBuffer != null)<br />
myBuffer.Dispose();<br />
myBuffer = currentContext.Allocate(this.panel1.CreateGraphics(), this.panel1.DisplayRectangle);<br />
if (bitmap != null)<br />
{<br />
if (resetViewport)<br />
SetViewPort(new RectangleF(0, 0, bitmap.Width, bitmap.Height)); <br />
} <br />
this.panel1.Focus();<br />
this.panel1.Invalidate();<br />
} <br />
<br />
private void SetViewPort(RectangleF worldCords)<br />
{ <br />
if (worldCords.Height > worldCords.Width)<br />
{<br />
this.Zoom = worldCords.Width / bitmap.Width;<br />
}<br />
else<br />
this.Zoom = worldCords.Height / bitmap.Height;<br />
<br />
viewPortCenter = new PointF(worldCords.X +(worldCords.Width / 2.0f), worldCords.Y + (worldCords.Height / 2.0f));<br />
<br />
} <br />
<br />
private void PaintImage()<br />
{<br />
if (bitmap != null)<br />
{<br />
float widthZoomed = panel1.Width / Zoom;<br />
float heigthZoomed = panel1.Height / Zoom;<br />
<br />
if (widthZoomed > 30000.0f)<br />
{<br />
Zoom = panel1.Width / 30000.0f;<br />
widthZoomed = 30000.0f;<br />
}<br />
if (heigthZoomed > 30000.0f)<br />
{<br />
Zoom = panel1.Height / 30000.0f;<br />
heigthZoomed = 30000.0f;<br />
}<br />
<br />
if (widthZoomed < 2.0f)<br />
{<br />
Zoom = panel1.Width / 2.0f;<br />
widthZoomed = 2.0f;<br />
}<br />
if (heigthZoomed < 2.0f)<br />
{<br />
Zoom = panel1.Height / 2.0f;<br />
heigthZoomed = 2.0f;<br />
}<br />
<br />
float wz2 = widthZoomed / 2.0f;<br />
float hz2 = heigthZoomed / 2.0f;<br />
Rectangle drawRect = new Rectangle(<br />
(int)(viewPortCenter.X - wz2),<br />
(int)(viewPortCenter.Y - hz2),<br />
(int)(widthZoomed),<br />
(int)(heigthZoomed));<br />
<br />
<br />
myBuffer.Graphics.Clear(Color.White);
<br />
myBuffer.Graphics.DrawImage(bitmap, this.panel1.DisplayRectangle, drawRect, GraphicsUnit.Pixel);<br />
myBuffer.Render(this.panel1.CreateGraphics());<br />
} <br />
}<br />
<br />
protected override void OnBackgroundImageChanged(EventArgs e)<br />
{<br />
bitmap = (Bitmap)this.BackgroundImage;<br />
setup(true);<br />
base.OnBackgroundImageChanged(e);<br />
}<br />
<br />
protected override void OnResize(EventArgs e)<br />
{<br />
setup(false);<br />
base.OnResize(e);<br />
}<br />
<br />
private void panel1_Paint(object sender, PaintEventArgs e)<br />
{ <br />
PaintImage();<br />
}<br />
<br />
private void panel1_MouseWheel(object sender, System.Windows.Forms.MouseEventArgs e)<br />
{<br />
Zoom += Zoom * (e.Delta / 1200.0f);
if (e.Delta > 0)
viewPortCenter = new PointF(viewPortCenter.X + ((e.X - (panel1.Width / 2)) /(2* Zoom)), viewPortCenter.Y + ((e.Y - (panel1.Height/2)) / (2*Zoom))); <br />
this.panel1.Invalidate(); <br />
}<br />
<br />
private void panel1_MouseDown(object sender, MouseEventArgs e)<br />
{<br />
if (e.Button == MouseButtons.Left)<br />
draging = true;<br />
}<br />
<br />
private void panel1_MouseMove(object sender, MouseEventArgs e)<br />
{<br />
if (draging)<br />
{<br />
viewPortCenter = new PointF(viewPortCenter.X + ((lastMouse.X - e.X)/Zoom), viewPortCenter.Y + ((lastMouse.Y- e.Y)/Zoom)); <br />
panel1.Invalidate(); <br />
}<br />
lastMouse = e.Location;<br />
}<br />
<br />
private void panel1_MouseUp(object sender, MouseEventArgs e)<br />
{<br />
if (e.Button == MouseButtons.Left)<br />
draging = false;<br />
} <br />
}
but in runTime, when i panning image in my control, it has a flicker and very bad result, for solve this problem, in top of above code, i define a new class that derived from Panel and wrote this code :
public class overRidePanel : Panel<br />
{<br />
protected override void OnPaintBackground(PaintEventArgs pevent) <br />
{<br />
<br />
}<br />
}
then modify my panel to instanciate from new overRidePanel class, as u can see in above code, i was override OnPaintBackground event only, then run my app, it gave me best result and remove flicker when i panning and zomming my images in app, but when my app run, the ImageMap does not have a any image to display it, and my control in runTime does not display white color correctly(it show back of the my app and not good for me), i want when i start app, it is white color before selecting image, but how to do ?
thanks
|
|
|
|
|
Hello,
I've been trying for while now to upload a picture and get it to be displayed in an Image control. I still can't get the code right. I used
FileUpload1.PostedFile.SaveAs(filepath);
Image1.ImageURL = filepath;
after performing the necessary checks. The ASP.NET debugger says the path format is not supported. I need help.
Thanks.
Obinna from Nigeria.
PS. I'm using VS 2005.
//obinnaaj Eof
|
|
|
|
|
You need to store it within your web app, then your imageURL needs to be a URL to the file, not a path on the file system. Server.MapPath is how you convert them,
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 )
|
|
|
|
|
In .Net, Text box control is in square shape. I would like to change the shape of the control to Circle from square shape. Is it possible to customize the shape of Textbox control as circle?
Thanks in advance.
|
|
|
|
|
By overriding OnPaint method
|
|
|
|
|
Not really, no. The textbox in windows sucks because it paints itself often outside it's paint event. It can be done, but it's hard work. Why not just draw a circle of white around the edges of a textbox with no border ?
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 )
|
|
|
|
|
|
*grin* for any other control it would probably be right. It still is, excepting that you need to handle a bunch of other events and force repaints, and you'll never get rid of the flicker.
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 )
|
|
|
|
|
Thanks
Meanwhile, was the reply for the earlier thread (disable copy paste) correct?
|
|
|
|
|
Yes, it looked like it to me. I'd have to try it to see if it worked, but that's what I had in mind.
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 )
|
|
|
|