|
I would like to be able to pick a colour on a PictureBox control and make it transparent. How can I then save the image as a gif file with transparency. I have a program that draws shapes on an image in a picturebox, however when I save the image none of the shapes that I have drawn are saved. What do I need to do to achieve this. Any help is appreciated.
Jim
|
|
|
|
|
OK, first of all, are you drawing the shapes on the PictureBox's Graphics, or a Graphics created from the bitmap? You need to create a graphics from the bitmap using Graphics.FromImage(), and then draw on that.
About transparency, I really don't know how to do that with GIFs in GDI+. I believe the first entry in the palette is the transparent color, but I don't know how to set that with GDI+.
"Have a heart that never hardens, a temper that never tires, a touch that never hurts." -- Charles Dickens
FLUID UI Toolkit
|
|
|
|
|
Thanks for your reply
In my program the PictureBox is either loaded from a file:
pictureBox.Image = Image.FromFile(dlg.FileName)
Or from a stream:
Dim binaryData(-1) As [Byte]
binaryData = Base64Utility.GetByteArray(_ImageData)
Dim ms As New MemoryStream(binaryData)
_PictureBox.Image = Image.FromStream(ms)
To draw on the PictureBox I am calling the Invalidate method which then fires the Paint event:
pictureBox.Invalidate()
In the paint event I am passing the PaintEventArgs to this Draw Sub.
Public Sub Draw(ByVal p As Pen, ByVal e As PaintEventArgs) Implements IHotspot.Draw
If _bEndIsSet Then
e.Graphics.DrawRectangle(p, New Rectangle(_ptOrigin.X, _ptOrigin.Y, (_ptEnd.X - _ptOrigin.X), (_ptEnd.Y - _ptOrigin.Y)))
e.Graphics.DrawRectangle(p, _ptEnd.X - 2, _ptEnd.Y - 2, 4, 4)
'e.Graphics.DrawString(CStr(_ptOrigin.X) & ":" & CStr(_ptOrigin.Y), New Font("arial", 8, FontStyle.Regular), Brushes.Yellow, _ptOrigin.X, _ptOrigin.Y)
End If
End Sub
So instead of using e.Graphics I should be using Graphics.FromImage() to draw on?
Jim
|
|
|
|
|
Jim Taylor wrote:
So instead of using e.Graphics I should be using Graphics.FromImage() to draw on?
Correct. In VB6, you could draw on the picturebox and what you drew would show up on the image, but with VB.NET, this doesn't happen. IMO it's much better that way.
"Love does not delight in evil but rejoices with the truth." -- 1 Corinthians 13:6
FLUID UI Toolkit
|
|
|
|
|
|
Any ways to do MDI in VB.NET?
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Yes, what particular problems are you having?
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
|
|
|
|
|
Sorry, but that struck me as very tongue-in-cheek.
|
|
|
|
|
I won't say it is a problem. Just that I was interested to know wheither VB.NET has a MDI template like in MFC MDI?
I have checked out VB.NET. It seems that most the stuff need to be built on scratch.
Any hints? Thanks
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Create a (parent) form and set the form's IsMdiContainer property.
- <parent>.IsMdiContainer = True
Create a child form and set the child's MdiParent property to point to the parent form.
|
|
|
|
|
Any specifc URL or tutorial on this. I would want it to be short and simple as I am used to program in VB.
thanx in advance
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
|
How to make the other form be a member of the MDICHILDREN? I want to call a second FORM from the first FORM through a button(first FORM is already a MDI CHILD). How to make this second FORM be a part of the MDI?
thanx!
|
|
|
|
|
I am writing a netstat for windows kind of application which tell you which process is accessing what port etc. The problem is that netstat returns PIDs but not the program names.
My question is how do i translate a PID into a program name.
|
|
|
|
|
dear all,
how can i merge data from 2 or more xml files having similar kinds of tags.
is there way to do this using VB
thanx and regards
rIsHaBh
|
|
|
|
|
We have had multiple occurances of datasets disappering from the designer. We cannot be specific about the circumstances since we simply do not know when this will occur or under what conditions.
The .xsd and associated .vb files are still located in the source directory. The .vbproj file has references to both but is missing the following tagged lines (as an example). Restoring the tagged lines allows the code to compile correctly, but the data sets still do not show up in the designer. The implication is that we can't select the dataset and look at or modify the schema. Here is a snippet from the .vbproj with the missing lines tagged by >>>
<file
relpath="LabNfonts.vb"
="">>> DependentUpon = "LabNfonts.xsd"
SubType = "code"
>>> BuildAction = "Compile"
>>> DesignTime = "True"
>>> AutoGen = "True"
/>
<file
relpath="LabNfonts.xsd"
="" buildaction="Content">>> Generator = "MSDataSetGenerator"
>>> LastGenOutput = "LabNfonts.xsd"
/>
We are using a single data adapter and reconfiguring it to generate each data set. At execution time, the dataAdapter select, insert, delete, and update comman text is dynamically altered.
The only other way we have found to get the datasets back is to completely delete the dataset and all references to it in the MS generated code, then reconfigure the dataAdaper and regenerate the the dataset.
This is a huge waste of time, and I believe there must be s simple solution for prevention and cure of the problem.
Any insight would be greatly appreciated.
Thanks.
|
|
|
|
|
Hi,
I need to open a Word document in Crystal reports for .NET at run time.
Can anybody suggest a good means of acheiving this?
Thanks
Pedro Silva
|
|
|
|
|
Hey guys, I used VB.NET running on Win2K Advanced Server (SP3). I played around with DataGrid and it went fine. However, there's one point where all the changes I made seem to have no effect on the program when I ran it.
This is what happened:
I created a datagrid containing 3 columns, then I set the datasource to the dataset I read from SQL. It went fine!
Then I tried to play with the property of the datagrid (change the ReadOnly property for the column), and it didn't show any effect when I ran the program. Then, I delete 1 column from the datagrid (so, it's left with 2 columns), however, when I compiled and ran it, the datagrid still showed up with 3 columns!!!
Has anybody experienced this before? Or know the reason behind it?
Thanks in advance for your help!
|
|
|
|
|
I haven't used too much of the Windows datagrid, but if IIRC, any changes you make to the grid(like column no, or size) will not be reflected if you use databinding.
|
|
|
|
|
I'm trying to parse a CSV string and examples I've found so far do not appear to work with VB.NET
The regular expression I'm trying to work with is
,(?=([^"]*"[^"]*")*(?![^"]*"))
So if I'm coding this in VB.NET I have to replace the double quotes with two double quotes right?....
Therefore, my code is using a simple form with two controls as follows...
Dim re As Regex = New Regex(",(?=([^""]*""[^""]*"")*(?![^""]*""))", RegexOptions.Compiled)
Dim myArray() As String = re.Split(TextBox1.Text)
TextBox2.Clear()
Dim i As Integer
For i = 0 To UBound(myArray)
TextBox2.Text = TextBox2.Text & myArray(i) & vbCrLf
Next
Now if TextBox1 is A,B,C it works as expected
If any of the values have double quotes round them it all goes pear shaped.
Eg. a,"substr1,substr2",3.14,"hello" comes out with 7 elements in my array
a
,3.14,"hello"
"substr1,substr2"
3.14,"hello"
3.14
"hello"
"hello"
this is doing my nut! I've been looking at reference books and still can't get it to work.
Is there someone out there that's going to be my saviour?!?!
cheers
mf
|
|
|
|
|
Please help,there is any method or way to print data from datagrid.
|
|
|
|
|
Sure, there are some examples if you search on CP.
|
|
|
|
|
Have you investigated the PrintDocument class? You may want to subclass PrintDocument to output rows from the source of a datagrid.
|
|
|
|
|
Ok, anyone got an idea on how to do this in VB.NET? I need to know how to put Descriptions onto the Properties of my Classes that will show up in the "Tooltips" that display during Intellisense typing. Also, I'd like these descriptions availabe in the Object Browser.
You used to be able to do this in VB6 by going to "Tools --> Procedure Attributes". No, I am not looking for the "ComponentModel.Description" either...that is only for design time control properties (so it seems).
|
|
|
|
|
Can't you just use the <Description()> attribute?
[Edit]Sorry bout that, forgot that < wouldn't work in html [/Edit]
|
|
|
|