|
The only way with Access I knowing is the following SQL-Statement:
SELECT COUNT(*) AS TableCount FROM [Table]
|
|
|
|
|
Hi
I am trying to draw a rectangle over an existing image by using the following code (pb is the PictureBox and has an image)
<br />
Dim oGraphics As Graphics = Graphics.FromImage(pb.Image)<br />
With oGraphics<br />
.DrawRectangle(New Pen(Color.Red, 2), New Rectangle(5, 5, 300, 300))<br />
End With<br />
pb.Refresh()<br />
The problem comes when I want to draw another rectangle (at a different location) and I can't remove/clear the existing rectangle before drawing the new one.
Is there any way I can remove the existing drawn rectangle?
I don't want to use the pb.CreateGraphics() b/c the drawing is not consistent when this method is used.
I am using the FromImage() method b/c later I want to resize (zoom) or rotate the image with drawn rectangle and It won't require any further coding for rotating and resizing the rectangle.
I tried reload the Image again, but large images take to much time to load, so I want to avoid the Image reloading.
Please help!
|
|
|
|
|
Maybe you can load the image, and the clone it, and the put the clone in the pb? That way, when you want to remove the stuff you were drawing on the image of the pb, you can dispose that image and put a new clone of the original in the pb. I think on large images cloning takes much time too, but less that reloading it.
Pompiedompiedom...
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick
|
|
|
|
|
I haven't worked with graphics for a while, so I don't know how hard this would be, but could you lay down the image first, and then overlay a transparent picturebox on the first image? Then, instead of drawing the rectange directly on the image, you can draw it over the image, on the second picturebox.
Roy.
|
|
|
|
|
Thank You Roy,
I am not sure and don't remember it correctly (I read it somewhere) that there is something like a Xor Pen.
Is there anything like this that can help me?
Another CP user in the C# forum suggested me that I should remember the Pixel values of the image (for rectangular area) before drawing the rectangle. How do I remember those values and how to reload those values?
|
|
|
|
|
Hello, how can i make a chat messanger using the ips! i want to send a message from a computer to another computer in another house not in my house! I want the program to send a message to another pc using ips! Thanks alot!!
Adrian De Battista
|
|
|
|
|
Try looking at the TcpClient, TcpListener and NetworkStream classes in the System.Net namespace.
|
|
|
|
|
As the subject suggest how can i monitor CPU.
|
|
|
|
|
Maybe this[^] is what you're looking for?
Pompiedompiedom...
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick
|
|
|
|
|
Hi All ,
how can i receive the ip address from a remote client?
im using this code to listen to a client:
dim PORT as integer = 10000
listener = New Sockets.TcpListener(System.Net.IPAddress.Any, PORT)
listener.Start()
Dim client As TcpClient = listener.AcceptTcpClient()
now i need the client ip address ?....
|
|
|
|
|
hey all,
Does anyone know, how to determine the port of a printer? I need this to know because my application allows a user to select a printer but all print jobs are send directly to the port (i.E. "copy print.txt LPT1").
I do not find any information abount this
I'm using VB.NET 1.1
thx, bernd
|
|
|
|
|
The GetPrinter API can be used from VB.Net to get this info.
'--8<------------------------
Ex Datis:
Duncan Jones
Merrion Computing Ltd
|
|
|
|
|
Thx very much !!
after knowing what i am looking for i found this:
<DllImport("winspool.drv", CharSet:=CharSet.Auto, SetLastError:=True)> _
Private Shared Function OpenPrinter( _
ByVal pPrinterName As String, ByRef hPrinter As IntPtr, _
ByVal pDefault As IntPtr) As Boolean
End Function
<DllImport("winspool.drv", CharSet:=CharSet.Auto, _
SetLastError:=True)> _
Private Shared Function ClosePrinter( _
ByVal hPrinter As IntPtr) As Boolean
End Function
<DllImport("winspool.drv", CharSet:=CharSet.Auto, _
SetLastError:=True)> _
Private Shared Function GetPrinter( _
ByVal hPrinter As IntPtr, ByVal dwLevel As Integer, _
ByVal pPrinter As IntPtr, ByVal cbBuf As Integer, _
ByRef pcbNeeded As Integer) As Boolean
End Function
Private Shared Function GetPrinterInfo(ByVal printerName As String) As PRINTER_INFO_2
Dim hPrinter As IntPtr
If Not OpenPrinter(printerName, hPrinter, IntPtr.Zero) Then
Throw New Win32Exception(Marshal.GetLastWin32Error())
End If
Dim pPrinterInfo As IntPtr = IntPtr.Zero
Try
Dim needed As Integer
GetPrinter(hPrinter, 2, IntPtr.Zero, 0, needed)
If needed <= 0 Then
Throw New Exception("Na Zeavas...")
End If
pPrinterInfo = Marshal.AllocHGlobal(needed)
Dim temp As Integer
If Not GetPrinter(hPrinter, 2, pPrinterInfo, needed, temp) Then
Throw New Win32Exception(Marshal.GetLastWin32Error())
End If
Dim printerInfo As PRINTER_INFO_2 = _
CType(Marshal.PtrToStructure( _
pPrinterInfo, GetType(PRINTER_INFO_2)), PRINTER_INFO_2)
Return printerInfo
Finally
ClosePrinter(hPrinter)
Marshal.FreeHGlobal(pPrinterInfo)
End Try
End Function
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto)> _
Public Structure PRINTER_INFO_2
Public pServerName As String
Public pPrinterName As String
Public pShareName As String
Public pPortName As String
Public pDriverName As String
Public pComment As String
Public pLocation As String
Public pDevMode As IntPtr
Public pSepFile As String
Public pPrintProcessor As String
Public pDatatype As String
Public pParameters As String
Public pSecurityDescriptor As IntPtr
Public Attributes As System.UInt32
Public Priority As System.UInt32
Public DefaultPriority As System.UInt32
Public StartTime As System.UInt32
Public UntilTime As System.UInt32
Public Status As System.UInt32
Public cJobs As System.UInt32
Public AveragePPM As System.UInt32
End Structure
|
|
|
|
|
Hi,
Cud you suggest me a way to bind one textbox with two tables?
i'l tell u the actual situation.
I am having n text box on a tab page.Some of the textboxes get the data from a previously filled table.i need to fill data in other textboxes and want to save the data of all the text boxes in another table.
Im having a primary data in one of the textboxs and many records for that primary data has to be saved n times.
Thanx
|
|
|
|
|
Hi,
I am new in VB.net. I have a problem while debugging a windows application, which will read a bmp image and save it after processing. I used the following code
//Opening an image
private sub button1_click (Byval sender as object,Byval e as system.eventergs)
dim odlg as new openfiledialog()
odlg.filter = "Bitmap(*.bmp)|*.bmp"
if (odlg.showdialog=dialogresult.ok) then
picturebox1.image = image.fromfile(odlg.filename)
picturebox1.invalidate()
end if
end sub
//Saving an Image
private sub button2_click (Byval sender as object,Byval e as system.eventergs)
dim sdlg as new savefiledialog()
sdlg.filter = "Bitmap(*.bmp)|*.bmp"
if (sdlg.showdialog=dialogresult.ok) then
picturebox1.image.save(sdlg.filename)
picturebox1.invalidate()
end if
end sub
While I open an image "b.bmp" and after processing it want to overwrite the file with the same filename (b.bmp) an error occurs, saying:
"An unhandled exception of type
System.Runtime.InteropServices.ExternalException occurred in System.Drawing.dll
Additional information: A generic error occurred in GDI+."
What should I do now, how can i overcome this problem?
Please help me. Thanks in advance.
Anindya Chatterjee
|
|
|
|
|
how to add a combobox to a datagrid column in datagrid. also for this how to create the user control
|
|
|
|
|
|
|
u r trying to back up as database from that database only
thats why this msg is coming try changing the database and then taking the back up.
it worked with me ..
it may also help u.
abhinav
|
|
|
|
|
Thank u abhinav. it worked fantastically. thank u.
Roy Joseph
|
|
|
|
|
Hi,
if I develop a Usercontrol with VB.Net, it is easy to give a own Property a Default-Value. But I want to give the Font-Property a Default-Value (a other like the System-Default). How can I do that?
Vocaris
|
|
|
|
|
You can do that in your constructor.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Ah thx shure, I think last night was too long
|
|
|
|
|
DefaultValue attribute only works for simple values. For complicated stuff (like that the default value depends on other properties), you can use ShouldSerialize[PropertyName] & Reset[PropertyName] . Example:
Private _someFont As New Font("verdana", 12.0!)
Public Property SomeFont As Font
Get
Return _someFont
End Get
Set(Value As Font)
If Not Font.Equals(_someFont, Value) Then
_someFont = Value
End If
End Set
End Property
Public Function ShouldSerializeSomeFont As Boolean
Static default As New Font("verdana", 12.0!)
If Font.Equals(SomeFont, default)
Return False
Else : Return True
End If
End Function
Public Sub ResetSomeFont
If Not SomeFont Is Nothing Then
SomeFont.Dispose()
End If
SomeFont = New Font("verdana", 12.0!)
End Sub HTH
Pompiedompiedom...
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick
|
|
|
|
|
Thanks for answering, I didn't know about the 'ShouldSerialize' and 'Reset' functions. but now after knowing about these function I can use them.
Thanks
|
|
|
|