|
How can I center text on a form using the Graphics.DrawString method?
Using C++ I would write:
pdc -> DrawText(cs,cr,DT_CENTER | DT_VCENTER | DT_SINGLELINE);<br />
where cs is the string to write and cr the bounds rectangle. Is there a similar method in .NET?
Ican write in the form easily enough but I want to center the text in the middle of the form, also how doI stop it flickering when it repaints it?
Thanks in anticipation.
Rugby League: The Greatest Game Of All.
|
|
|
|
|
See the Graphics.DrawString method. You may also have to center the image on the form yourself. To get the length of the drawn string use Graphics.MeasureString
RageInTheMachine9532
|
|
|
|
|
Thanks, got that working. Is there anyway to stop the flicker?
Rugby League: The Greatest Game Of All.
|
|
|
|
|
You did not mention when do you see it flicker (i.e. When do you re-redraw,
In what rate and how many objects etc.)
Fade (Amit BS)
|
|
|
|
|
Essentially i am using forms as controls on a parent form - i draw some text on the child forms in the Paint event because the forms can be resized - it flickers when I resize it.
Rugby League: The Greatest Game Of All.
|
|
|
|
|
Hi every body!
please tell me how can i get a data type of a field in data base!!!
Thanks!
xyz
|
|
|
|
|
I have not done it in .Net yet but in the old VB you need to set a reference to: 'Microsoft ADO Ext. 2.7 for DDL and Security'. You many have another version than 2.7 but you get the idea.
Dim cn As ADODB.Connection
Dim sch As New ADOX.Catalog
cn = New Connection
cn.ConnectionString = ConnectString
cn.Open
sch.ActiveConnection = cn
Dim t As ADOX.Table
Dim c As ADOX.Column
Set t = sch.Tables("TableName")
Set c = t.Columns("ColumnName")
Debug.Print c.Type
Michael
I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious.
Vince Lombardi (1913-1970)
|
|
|
|
|
Does anyone here know a way i can draw over a picture box?? And i mean draw (anything such a rectangle or so), not place a picture!
-----------------------
Toola
|
|
|
|
|
In VB.Net you can draw on almost anything, using this simple syntax:
Dim MyGraphicsObject as Graphics ' Creating a graphics object Holder<br />
MyGraphicsObject= PictureBox1.CreateGraphics ' Getting a graphics <br />
' object for the PictureBox
Note that you can create a graphics object using the .CreateGraphics on almost anything
and for images use :
MyGraphicsObject = Graphics.FromImage(MyImageObject)
to get a refference to a graphics object.
now you can do whatever you want, like
MyGraphicsObject.DrawArc
Or
MyGraphicsObject.DrawRectangle or .DrawString
and so on.
just dont forget to use
MyGraphicsObject.Dispose()
when you're done
Fade (Amit BS)
|
|
|
|
|
I have got Vb 6.0 and applying for that I want DAO connection. But I unable to connect. what may be the problem??? Is DAO is not allowed for VB6.0?? May be the problem with the code...! What is the code..????
|
|
|
|
|
hi when i built the solution, it complies well but when running it gives an error, unable to start the debugger. please repair or reinstall the debugger. anybody having any idea, whats the problem. i have reinstalled and repaired vs.net more than once but problem is till there. i m using vs.net2003. thanks in advance.
|
|
|
|
|
R u using this for Windows apps or web application?
There is nothing new under the sun, But there are lots of old things we don't know. - Ambrose Bierce
|
|
|
|
|
hi
i really need help
i wish to show some data in the recordset when a user enter value into textbox. i can only manage to do the following coding but the result is not as i expected.
Private Sub Text18_Change()
If rs.Fields(0) = Text18.Text Then
Label2.Caption = rs.Fields(1)
Label3.Caption = rs.Fields(2)
Else
Label2.Caption = ""
Label3.Caption = ""
End If
End Sub
i wish that the textbox can search the whole recordset, but this code will only show the result than the pointer is currently pointing. it just wont move to the next record. i try putting rs.movenext any where in the code but the result is "No current record"
can any please help me
if this is not possible please tell me so that i think of another way
i wish this way is possible
please help me
thank you in advance
Gary
|
|
|
|
|
Hi,
I want to make a windows service that run in the process. I want that at specific time (Time Which Mention in the code) a message box will be display and when user click on OK then another application should be open.
I hope someone help me
Thanking You
(Hemant Uttam Mane)
|
|
|
|
|
Hemant_Mane wrote:
I want to make a windows service that run in the process.
You didn't ask any specific questions so it's hard to help you with any problems...
BUt, I've got one for you. What do you mean by "run in the process"?
Are you using VB or VB.NET? VB.NET is easy enough. Just create a Windows Service project. When you install the app, make sure it is using the Local System account and 'Allow service to interact with desktop' is checked.
RageInTheMachine9532
|
|
|
|
|
I want to hook the even when word document is close. how
can i achieve this i know i have to declare something like
the following
Public WithEvents appEventHandler As word.application
but somehow i get compiler error
why?
Shin
|
|
|
|
|
Hello all,
I have to read the html string from email, and display it back on the internet explore.
I have no problem getting html body of the email. but displaying back is giving me trouble.
Here what I do, (i'm using vb.net)
1) read the html body from email. ebody = mail.HTMLBody
2) write to the file in two ways regualr text string and binary string so all text (in any (i don't care)language that was able to view on internet explore). As soon as I read the htmlbody, I take it and write it to the .html file so it can view on internet explore.
<br />
1) <br />
Dim objStr As StreamWriter<br />
'creating html file<br />
objStr = New StreamWriter("c:\afile.html") ' location could be changed<br />
objStr.WriteLine(ebody) 'writing to the file<br />
objStr.Close() 'close the file<br />
<br />
2)<br />
Dim fs As New FileStream("c:\afile.html", FileMode.Create)<br />
Dim w As New BinaryWriter(fs)<br />
w.Write(ebody)<br />
w.Close()<br />
3) display the html file with internet explore
<br />
Dim ie As New SHDocVw.InternetExplorer<br />
ie.Visible = True<br />
ie.Navigate("c:\afile.html")<br />
However the text are not displaying right if the text was written in different language other than English. Let's say the sentence is written in Chinese, then it display boxes.
I tried to write the string in both binary format, and regular format.
How can I write to the text file not changing all the text font and format?
|
|
|
|
|
Hi!
I want to bind a custom collection to a datagrid. The collection inherits from CollectionBase. The binding is no problem, but I want to see a "add new" row at the end of the datagrid. How can this be done? I know this is no Problem if you use a datatable. But I don't want to copy my list to a table. There must be a way to do this with a collection, right? I even tried to implement IBindingList. No difference. Do I have to implement ITypedList, too?
Markus
|
|
|
|
|
Hi,
I want to create a menu control (support unicode) but i dont know to create it . Please tell me how to create it or sourcecode.
Please reply me as soon as posible.
Thanks
|
|
|
|
|
Hi,
Does anyone know where I can get a component that can get the possible HanYuPin from a Simplified Chinese Character in GB format?
I really need help on this!
Best Rgds,
Nickson
|
|
|
|
|
Hello Everybody,
We have an existing VB 6.0 application and we want to make this send and receive data using sockets instead of MSComm32 which it currently uses.
Questions are:
1. Can it be done using VB 6.0 effectively or should I go VB.Net?
2. I guess I may be able to use Winsock Control but I'm worried about how good VB is in terms of socket programming when compared to VB.Net?
|
|
|
|
|
I think you are best off getting VB.NET. You can still interact with a .NET DLL from your VB6 code, using COM Interop. .NET has very good support for sockets.
You could probably get a 3rd party component that makes it easy from VB6. VB.NET is so much more fun though
|
|
|
|
|
I have a code in VB of a control ActiveX that it abstracted all complexity of Windows DLL.
Should I order where? (just the sources, without EXE ).
<willians@bb.com.br>
Willian S. Rodrigues
<willians@bb.com.br>
<willian.cpp@bol.com.br>
(VB, VC++, Qt, MFC, Cobol,Clipper, Pascal)
|
|
|
|
|
|