|
as topic, i can find DrawEllipse, DrawRectangle in picturebox control but i cant find DrawRoundRec in VB.Net !! anyone can help me plz...
this is the roundrectangle i mean...(of coz the lines must be connected each other)
____
(____)
|
|
|
|
|
That's because there isn't one. You're going to have to draw them yourself, line segment by line segment. You might want to look into GraphicsPath for creating an object that can be drawn all at once.
RageInTheMachine9532
|
|
|
|
|
Hi,
Here's a couple of functions I wrote that will draw you a rectangle with rounded corners. I just ripped them out of my own code, so I hope I didn't miss anything. Just call DrawRoundedRectangle and pass it your graphics object, a rectangle to draw in and an integer specifying how "round" you want the corners to be. If you have a program drop me a line.
' Draw an empty rectangle with rounded corners using the same pen for all sides
Public Sub DrawRoundedRectangle(ByRef prGraphics As Graphics, ByRef prPen As Pen, ByRef prRect As Rectangle, ByVal pvRounding As Integer)
Dim lrectSurface As GraphicsPath
lrectSurface = BuildRoundedRectangle(CreateRectangle(prRect.Left, prRect.Top, prRect.Width - 1, prRect.Height - 1), pvRounding)
prGraphics.DrawPath(prPen, lrectSurface)
End Sub
' Build a graphic path for a rounded rectangle/square
Public Function BuildRoundedRectangle(ByRef prRect As Rectangle, ByVal pvRounding As Integer) As GraphicsPath
Dim lPath As New GraphicsPath()
Dim lHalf As Integer = CInt(pvRounding / 2)
With prRect
lPath.StartFigure()
lPath.AddArc(.Left, .Top, pvRounding, pvRounding, 180, 90)
lPath.AddLine(.Left + lHalf, .Top, .Right - lHalf, .Top)
lPath.AddArc(.Right - pvRounding, .Top, pvRounding, pvRounding, 270, 90)
lPath.AddLine(.Right, .Top + lHalf, .Right, .Bottom - pvRounding)
lPath.AddArc(.Right - pvRounding, .Bottom - pvRounding, pvRounding, pvRounding, 0, 90)
lPath.AddLine(.Right - lHalf, .Bottom, .Left + lHalf, .Bottom)
lPath.AddArc(.Left, .Bottom - pvRounding, pvRounding, pvRounding, 90, 90)
lPath.AddLine(.Left, .Bottom - lHalf, .Left, .Top + lHalf)
lPath.CloseFigure()
End With
BuildRoundedRectangle = lPath
End Function
Nursey
|
|
|
|
|
thanks for replying me!!
i think i need ur program understand how the coding works, can u send to me?
my email is mjlai83@pd.jaring.my
thanks again for help!!
|
|
|
|
|
I have been writing a VB 6 program to execute dos commands with parameter eg :-
Commands1 = "pairdisplay -x umount " & DriveLetter & " " & VolumeName & " > d:\apps\shadowapp\logs\pairdisplay4.txt"
ExecCmd Commands1
Public Sub ExecCmd(ByVal cmdline As String, Optional ByVal HideWindow As Boolean = False)
' This sub executes the command in cmdline$ and waits for it to finish.
Dim proc As PROCESS_INFO
Dim start1 As STARTUPINFO
Dim ret&
If (HideWindow) Then
start1.dwFlags = STARTF_USESHOWWINDOW
start1.wShowWindows = SW_HIDE
End If
start1.cb = Len(start1)
ret& = CreateProcessA(0&, cmdline$, 0&, 0&, 1&, NORMAL_PRIORITY_CLASS, 0&, 0&, start1, proc)
ret& = WaitForSingleObject(proc.hProcess, INFINITE)
ret& = CloseHandle(proc.hProcess)
End Sub
When I try and execute this the execcmd gives an error stating that the file cannot be found.
Right now this does not work with the parameters and for the the pipe for the output (txt file), but the individual commands without the output etc do.
I am at a loss of how to get this to work. If anyone can help then i would really appreciate it.
Paul
|
|
|
|
|
Try adding the full path to pairdisplay before you pass it to ExecCmd:
Commands1 = "C:\Full\PathName\pairdisplay -x umount " & DriveLetter & " " & VolumeName & " > d:\apps\shadowapp\logs\pairdisplay4.txt"
RageInTheMachine9532
|
|
|
|
|
I want to make an image maipulation program and would like to know if anyone has any code that would be useful for image manipulation. Anything would be helpful...THANKS!!!;)
|
|
|
|
|
What kind of manipulation? There are volumes of books on various techniques for HUNDREDS of manipulations. Also, your going to have to be aware of pixel formats, color tables, transparency, ...
RageInTheMachine9532
|
|
|
|
|
I'd like to do some stuff with panels as the base to a range of user controls. What I'd like to do is, at design time, have a client area that is not comprised of the whole area of the user control. So, just like a form, I need a client area where the developer can place controls, and a non-client area where the developer can not put controls. Of course, moving a control in the client area clips it against the client area edges, so that controls can not be placed in the non-client area.
I've been looking briefly into the SetClientSizeCore stuff, but due to too many late nights I haven't been able to put much into my investigations. Has anybody here done such a thing.
An approach I tried a few weeks back was to put a scrollable panel inside a panel which didn't scroll. It was quite effective but lots of things happened that you don't want to, like the user being able to get outside the client area.
Any suggestions and pointers are much appreciated.
Nursey
|
|
|
|
|
Hi, I'm creating a windows application for user to input inventory items. I'm using a datagrid for the user input. However, when I'm creating the SQL statement to insert it into the database, I couldn't figure out how to get the datagrid row count.
When i'm using datagrid.VisibleRowCount, only the visible items will be counted (therefore added to the DB). How could I get the total row count for datagrid. Anybody? Thanks!
|
|
|
|
|
hello,
why do you need the rowcount? if your datagrid is bound to dataset you just have to call the update-methode of the dataadapter. the dataadapter have to be configured with a selectstatement and the db-table must have a primary key so the dataadapter can generate the insert, update and delete statements. or isn't this your problem..?
keep trying
|
|
|
|
|
Actually my datagrid is not bound to any dataset. I start the form with an empty datagrid, which let the user to input the data (it look somewhat like microsoft access). So once the user has fill in all the data, the user has to click a button to save the records.
To save the records, i need to know how many rows of data the user has entered. Therefore I need to know the number of rows for that datagrid.
And the only method that the datagrid has is "VisibleRowCount", which only count the visible rows.
|
|
|
|
|
it is much easier to handle data with a dataset. you can build the strucure of the dataset in memory and bind it to the grid. i think the grid is not a good container for data, it's just a input/output mask for something like a grid.
|
|
|
|
|
I made a simple database program. I wanted to use it at work. I used MS Access as my database. I have finished everything and made the .exe file for the program that i made. I'm wondering if you guys could help me connect my program to my database (MS Access), without going into like using the ODBC. I just want to connect my program to my database using some codes.
jct
|
|
|
|
|
Well, you've given us no details about what you want other than 'connect'. Besides, if you've already got the database done in Access and you've already written the VB code, what's the problem? You should have been testing the code against the database already...??
You can start with this[^] for a guide on how to connect to various data sources and use them.
Your connection string will probably look something like this:
Dim strConnect as String
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data source=C:\Documents and Settings\username\My Documents\dbFile.mdb"
RageInTheMachine9532
|
|
|
|
|
Thanks so much for the reply. And to give you a bit of details on the simple program that i have created, well, i usually used ADO as my mediator between my program and my database (connection). The program is working fine. But when i try to create the .exe file and run it to my computer at work, it won't run since it tries to seach for msstdfmt.dll and i can't just install the dll file cause my computer has admin rights and i don't have access on it. So, i'm wondering if i could connect my program to my database without using ADO and just use codes to have it connected.
|
|
|
|
|
Well, from what I can find, msstdfmt.dll is the Data Format object library. You could TRY recoding the app to use DAO, but I think without that file, you're out of luck as Access installs it when you install Office and I think no matter how you go about getting to the database, the Jet Database engine still needs this dll to do it's work.
RageInTheMachine9532
|
|
|
|
|
Thanks for the info. i really appreciate it. thanks again!;)
jjt
|
|
|
|
|
Try Planet-source-code.com
|
|
|
|
|
I want to be able to start my app (vb 6) by "throwing" a file on it (via sendto). When the app starts i want to catch the name of the file that triggered the application to start... Is this possible in vb 6...?
Or do I have to have my application running when "throwing" the file at it?
(I don't need to open or manipulate the file in any way: I just want to be able to catch the filename)
|
|
|
|
|
Simple, when that happens, your app gets launched with the full path and name of the file as it's command line parameter:
MyVBApp.exe C:\Documents and Settings\MyId\Desktop\TestFile.txt
All you have to do then is get the command line arguments from Command().
RageInTheMachine9532
|
|
|
|
|
RageInTheMachine, that was a peace of cake!
Thanks a lot!
|
|
|
|
|
I just added a .vbs file to my windows forms application. I was wondering how to invoke that vbscript from within my application.
Thanks.
|
|
|
|
|
let say i got 2 forms, form1 and form2, how i going to show form2 when i click one button in form1??
just like form2.show in vb6!! but i cant find that in vb.net!!
|
|
|
|
|
In the button click event handler in form1 create (or obtain) an instance of form2.
MyForm2.Show()
or
MyForm2.ShowDialog()
depending on how you want it to work.
--Colin Mackay--
"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown)
Enumerators in .NET: See how to customise foreach loops with C#
|
|
|
|
|