|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
drawing a rectangle in a formI try to draw a rectangle in a form on a buttons click event, The code is
Dim bitmap As New Bitmap("lysblaa.jpg") Dim tBrush As New TextureBrush(bitmap) Dim texturedPen As New Pen(tBrush, 30) e.Graphics.DrawImage(bitmap, 0, 0, bitmap.Width, bitmap.Height) e.Graphics.DrawEllipse(texturedPen, 100, 20, 200, 100) I get an error on e.Graphics... I have trie to set Imports System.Drawing.Design but it doesn't help reidarT
Show quote
Hide quote
"reidarT" <rei***@eivon.no> schrieb: \\\>I try to draw a rectangle in a form on a buttons click event, The code is > Dim bitmap As New Bitmap("lysblaa.jpg") > > Dim tBrush As New TextureBrush(bitmap) > > Dim texturedPen As New Pen(tBrush, 30) > > e.Graphics.DrawImage(bitmap, 0, 0, bitmap.Width, bitmap.Height) > > e.Graphics.DrawEllipse(texturedPen, 100, 20, 200, 100) > > I get an error on e.Graphics... > > I have trie to set Imports System.Drawing.Design but it doesn't help Private m_Button1Clicked As Boolean Private Sub Button1_Click(...) Handles Button1.Click m_Button1Clicked = True Me.Invalidate(...) End Sub Private Sub Form_Paint(...) Handles MyBase.Paint If m_Button1Clicked Then ... e.Graphics.DrawImage(...) ... End If End Sub /// -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/> I have tried to do like you suggested with this code
Private m_Button1Clicked As Boolean Private Sub Button1_Click() Handles Button1.Click m_Button1Clicked = True Me.Invalidate() End Sub Private Sub Form_Paint() Handles MyBase.Paint If m_Button1Clicked Then e.Graphics.DrawImage("1.jpg") End If End Sub but I get n error on Button1.click and e.graphics reidarT Show quoteHide quote "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> skrev i melding news:ek1scPf0GHA.2196@TK2MSFTNGP03.phx.gbl... > "reidarT" <rei***@eivon.no> schrieb: >>I try to draw a rectangle in a form on a buttons click event, The code is >> Dim bitmap As New Bitmap("lysblaa.jpg") >> >> Dim tBrush As New TextureBrush(bitmap) >> >> Dim texturedPen As New Pen(tBrush, 30) >> >> e.Graphics.DrawImage(bitmap, 0, 0, bitmap.Width, bitmap.Height) >> >> e.Graphics.DrawEllipse(texturedPen, 100, 20, 200, 100) >> >> I get an error on e.Graphics... >> >> I have trie to set Imports System.Drawing.Design but it doesn't help > > > \\\ > Private m_Button1Clicked As Boolean > > Private Sub Button1_Click(...) Handles Button1.Click > m_Button1Clicked = True > Me.Invalidate(...) > End Sub > > Private Sub Form_Paint(...) Handles MyBase.Paint > If m_Button1Clicked Then > ... > e.Graphics.DrawImage(...) > ... > End If > End Sub > /// > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://dotnet.mvps.org/dotnet/faqs/> "reidarT" <rei***@eivon.no> schrieb: The methods's signatures are wrong. I didn't include the complete parameter > Private Sub Button1_Click() Handles Button1.Click >[...] > Private Sub Form_Paint() Handles MyBase.Paint list because I didn't test the code in the IDE. Instead I just used ellipsis instead to simplify typing the post. I suggest to create handlers for the button's 'Click' event and the form's 'Paint' event using the IDE by selecing the object in the left dropdown list on top of the code editor and then selecting the event in the combobox on the right hand side. > e.Graphics.DrawImage("1.jpg") \\\Private m_Image As Image = Image.FromFile("1.jpg") .... Private Sub Form_Paint(...) Handles MyBase.Paint e.Graphics.DrawImage(m_Image) End Sub /// -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
SQL parameter: what is wrong here?
Exporting a vb.net datagrid to excel WebRequest.Create Formatting text w/VB.NET Abstraction question Calling a VB.NET-DLL FROM VB6 Iterating through the records in a dataset VB.NET Progress Bar - Recursive Search DataGridView visible columns Access of shared member, constant member, enum member or nested type through an instance |
|||||||||||||||||||||||