|
How can I crop a circle/oval out of an image?
Any example would be helpful.
|
|
|
|
|
You can create a texturebrush using the image, use a translate transform to set the starting corner of the oval, and draw your oval using the brush.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
I found this in the help section but how do I call it from the button1 click event, I get Argument not specified for parameter e
Public Class Form1<br />
<br />
Public Sub TransformExample(ByVal e As PaintEventArgs)<br />
<br />
' Create a path and add and ellipse.<br />
Dim myPath As New Drawing2D.GraphicsPath<br />
myPath.AddEllipse(0, 0, 100, 200)<br />
<br />
' Draw the starting position to screen.<br />
e.Graphics.DrawPath(Pens.Black, myPath)<br />
<br />
' Move the ellipse 100 points to the right.<br />
Dim translateMatrix As New Drawing2D.Matrix<br />
translateMatrix.Translate(100, 0)<br />
myPath.Transform(translateMatrix)<br />
<br />
' Draw the transformed ellipse to the screen.<br />
e.Graphics.DrawPath(New Pen(Color.Red, 2), myPath)<br />
End Sub<br />
<br />
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
TransformExample()<br />
End Sub<code>
|
|
|
|
|
Wow - that's almost entirely useless.
1 - your function needs a PaintEventArgs, you've not passed it one, that's why it won't compile
2 - that code is creating an ellipse and moving it on the graphics object, It won't crop anything, and it's just too complex for what it does (draw an ellipse )
A painteventargs comes from a paint event, this code assumes it will be drawing an ellipse within a paint event.
Try doing what I suggested.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
You can see why the vb.net help files are no help.
and why people trying to learn vb.net (like me) give up.
There are just not enough good example to play around with.
|
|
|
|
|
No, the reason peole give up is that they don't ask, or don't take advice. Here[^] are plenty of examples on how to use a texturebrush ( I already told you this is what you need to do ).
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Finally got it all sorted and it had nothing at all to do with
texturebrush, translate transform.
|
|
|
|
|
I have no doubt there was more than one way to do it, but using a texture brush would have been the easiest.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Crop circle: search[^]
---
Year happy = new Year(2007);
|
|
|
|
|
I'm writing a program where I need to capture sound from a microphone and get it into an array in my program.
I've looked around the internet for a tutorial on this but all I get is a bunch of tutorials about playing sounds, special effects, or other irrelevent information. The few times I do get something relavent it's always writen in c++ which is not a language I'm strong in.
If someone could tell me how to do this or direct me to a tutorial on how to do this preferably in vb that would be a big help.
thanks,
Mike
|
|
|
|
|
i want to post a string to a website can anyone show me or point me to example of how you would use vb.net to post a string to a website and accept the response sent back from post / request to the site?
|
|
|
|
|
I am trying to call a function in a dll which was written in com
I am uing the following
Dim myxmlobj As New serviceprovider.ProcessXML<br />
Dim returnmesg As String<br />
<br />
returnmesg = myxml.ProcessXMLFile("c:\myxml.xml")
I have a added a reference to Interop.ServicePorvider in my project.
All seems correct but the funtion fails (Giving HRESULT E_Fails), is there anything special I need to consider as I am a calling a com dll.
Cheers
-- modified at 14:03 Saturday 27th January, 2007
|
|
|
|
|
No, it should just work.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Thanks Christian,
I wish it were only so.
Cheers
Geoff
|
|
|
|
|
Hi all
is there a standard way to determine if the local machine is connected to the internet with vb would appreciate your response
Regards
Daniel
Dan
|
|
|
|
|
Hi,
Through VBscripting without user involvement is to possible send sms via GPRS modem .I need to automate sending of SMS with help of VBscripting.
ThankYou
Anju
|
|
|
|
|
want to replase pic from pictuerbox but its not worked
thats my code
dim Aids as Integer = DataSet11.Admin.Item(0).AID.Trim
Dim fileinfo As String = OpenFileDialog1.FileName.Trim '//new Pic file
Dim fileex As String = Path.GetExtension(fileinfo.Trim)
Dim newdrfile As String = "C:\GymProg\Adminpic\" + AIDS.ToString.Trim + fileex.Trim '// new dirctry file
Dim oldpic As New FileInfo(DataSet11.Admin.Item(0).Pic.Trim) '// old pic thes is Problem Because oldpic.Path = newderfile.Path
'//Delete old Pic
If File.Exists(oldpic.FullName) = True Then
oldpic.Delete() ''//The process cannot access the file "C:\GymProg\Adminpic\1.gif" because it is being used by another process.
another Process like pictuerbox1.image path
End If
'//creat new Pic
FileCopy(fileinfo.Trim, newdrfile.Trim)
Ahmed El-Badry
|
|
|
|
|
If you create an image from a file, you need to call Dispose on that object in order to free the file.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
pict.Image.Dispose()
pict.Image = Nothing
dos not worked
thnx to help
Ahmed El-Badry
|
|
|
|
|
Then you're holding a reference somewhere. Do it when you load the image, write a load routine which loads, copies in memory and disposes of the original
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
the code is worked
convert Pic file to stream and close it and PictureBox.Bitmap= file stream The closure of data processing for Path
Dim asa As New FileInfo("C:\GymProg\Adminpic\D.gif")
Dim Op As New FileStream(asa.FullName, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None, 500, True)
Dim MyImage As Bitmap
Pic.SizeMode = PictureBoxSizeMode.StretchImage
MyImage = New Bitmap(Op)
Pic.ClientSize = New Size(136, 112)
Pic.Image = CType(MyImage, Image)
Op.Close()
True or fales
thnx to help me
Ahmed El-Badry
|
|
|
|
|
Iam currently wirting a vb.net 2003 dll which links to a 3rd party com dll.
I have successfuly created a com class project and registerd the dll using regasm.
There is very little docs (not a surprize) and when calling the below function
ProcessXMLFile("C:\myxl.xml)
I get a bulid error saying "Reference to a non-shared member requires an object reference"
I have found lots of refrences to this error online, but none that help in this situation.
I relise the information is a little thin, not sure I have any more info but if you need more ask and I will try and provide.
Thanks in advance
|
|
|
|
|
Sounds to me like the ProcessXMLFile method is not static, and so requires an instance of an object to call it from. As you say, not much to go on, so I'm guessing'
The other thing is, your quotes are not closed, I asume that's just a typo in your post, not in your code.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Thanks,
I agree that that sounds like the problem from my research.
I have no clue how I would provide an instance of the oblect (I more use to borland c++ circa 1992)
I found the following in the docs regarding the method
HRESULT ProcessXMLFile ([in] BSTR filename,
[out, retval] BSTR * errors) ;
and
Method ProcessXMLFile This method is used to process an XML document stored on disc,
and uses the following parameters:
Parameter Description
BSTR filename File name and path of the XML document.
BSTR * errors Output error string.
Cheers
|
|
|
|
|
Once you import your COM library, are you creating an instance of the stub class it provides ? If not, you've not got a COM object to call methods on. What's your actual code look like, is it
MyCOMObjectInstance.ProcessXMLFile("whatever")
Or, was the line of code exactly as you posted it ?
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|