|
Maybe this is a stupid question, but how can a TextBox be owner-drawn? It doesn't have the "DrawMode" property as per ListBox for example....
|
|
|
|
|
Really ? In C++, all controls can be owner drawn. I guess you then need to start with an empty control. Man, that would suck. But I guarentee you, the text boxes built into Windows do not support this directly.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
well I suppose I have the option to build a new ActiveX control with Vb6 or C++ 6 as I have that version of visual studio as well as .NET ....but I was trying to keep everything in .NET if at all possible
I can't believe I can't find clearer examples of this on the internet, not managed to turn much up yet
thanks for the help anyway
|
|
|
|
|
Slow progress so far.
I've just started to try and capture the mouse selection by subclassing the textbox control and using WndProc (code is below)
So I've got to the point of trynig to draw a rectangle covering the area selected by the mouse but the rectangle appears way to the right and below where it should be. try puttin the control on a form, make it quite big and specify it as multi-line and you'll see what I mean.
I suspect the cursor position is not relative to my control, but I can;t figure it out for the life of me. Anyone have any ideas?
Public Class CSTextBox
Inherits System.Windows.Forms.TextBox
#Region " Component Designer generated code "
Public Sub New()
MyBase.New()
' This call is required by the Component Designer.
InitializeComponent()
End Sub
'Control overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
FileClose(1)
MyBase.Dispose(disposing)
End Sub
'Required by the Control Designer
Private components As System.ComponentModel.IContainer
' NOTE: The following procedure is required by the Component Designer
' It can be modified using the Component Designer. Do not modify it
' using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
#End Region
Protected Overrides Sub OnPaint(ByVal pe As System.Windows.Forms.PaintEventArgs)
MyBase.OnPaint(pe)
'Add your custom paint code here
End Sub
Private Const WM_MOUSEMOVE = &H200
Private Const WM_LBUTTONDOWN = &H201
Private Const WM_LBUTTONUP = &H202
Private startpoint As Point
Private endpoint As Point
Private selectionMode As Boolean = False
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
Select Case m.Msg
Case WM_LBUTTONDOWN
startpoint = Me.Cursor.Position
endpoint = startpoint
selectionMode = True
Case WM_MOUSEMOVE
MyBase.WndProc(m)
If selectionMode Then
endpoint = Me.Cursor.Position
End If
Case WM_LBUTTONUP
endpoint = Me.Cursor.Position
DrawRect()
selectionMode = False
Case Else
MyBase.WndProc(m)
End Select
End Sub
Private Sub DrawRect()
If selectionMode Then
Dim x As Long, y As Long, w As Long, h As Long
If startpoint.X <= endpoint.X Then
x = startpoint.X
w = endpoint.X - startpoint.X
Else
x = endpoint.X
w = startpoint.X - endpoint.X
End If
If startpoint.Y <= endpoint.Y Then
y = startpoint.Y
h = endpoint.Y - startpoint.Y
Else
y = endpoint.Y
h = startpoint.Y - endpoint.Y
End If
Me.CreateGraphics.DrawRectangle(New Pen(Color.Red), New Rectangle(x, y, w, h))
End If
End Sub
End Class
|
|
|
|
|
OK - I gave up!
Instead I used scintilla which has the functionalitiy I was looking for built in
www.scintilla.org
|
|
|
|
|
Hi everybody. I got a very frustrasting issue with a Visual Basic Application. I send WM_SETTEXT messages to it, and I can't catch them inside the code, even though I correctly subclassed the window and I'm catching every other message.
If I send the WM_SETTEXT from Visual Basic, I'm catching the message, if I send it from my Visual C++ DLL, I don't.
However, sending WM_USER from the Visual C++ DLL works. But my issue is that I want WM_SETTEXT to work : (.
<br />
Public Const WM_SETTEXT As Long = &HC<br />
Public Const WM_USER As Long = &H400<br />
<br />
Public Function ASDWndProc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long<br />
Dim sString As String<br />
<br />
If uMsg = WM_SETTEXT Then<br />
CopyMemory sString, lParam, Len(lParam)<br />
MsgBox sString, vbInformation + vbSystemModal, "This does not work, except when I'm Sending the message from the VB Application"<br />
Exit Function<br />
End If<br />
<br />
If uMsg = WM_USER + 9 Then<br />
MsgBox "This works", vbInformation + vbSystemModal, "Strange"<br />
Exit Function<br />
End If<br />
<br />
ASDWndProc = CallWindowProc(loOriginalWindowProcedureAddress, hWnd, uMsg, wParam, lParam)<br />
End Function
Thank you for your help!
-= E C H Y S T T A S =-
The Greater Mind Balance
|
|
|
|
|
I right-click the resource folder in solution explorer , and select Exclude from Project.
Then error happened , the project could not be built.
I try to create a new folder , but the name could not be resource because there is the same folder.
How to rebuild my project?
Thanks!
|
|
|
|
|
We would refer Type library and Dll files in some different ways in .net.
I like to know what happens in compilation and execution time of the different ways of declaration.
1. imports System.IO
2.Dim lobjConfig As New PrjConfigInfo.ClsConfigInfo()
3.Private Declare Function Trans_Ticket Lib "InlottPrint.dll" (ByVal lStrPrintStr As String) As Integer
4.Add by Reference in solution explorer in .net IDE.
I am totally confused with this.
Plz Expain Anybody.
Thanx in advance
Satish Chandra Kumar
satish_softin@rediffmail.com
InLott Technologies Pvt Ltd
Chennai
|
|
|
|
|
not sure i understand well, but here is what happens.
first, i don't proceed in the same order as you. here is mine :
1. Adding a reference to a project of the solution.
As it says, you create a link to the functions and classes within the dll you reference.
this way, you will be able to use and call them.
2. Importing a namespace.
that command allow you not to use the entiere namespace instead of retype it each time you call a member of that namespace (Console.WriteLine() instead of System.Console.WriteLine() for example)
3. Dim lobjConfig As New PrjConfigInfo.ClsConfigInfo()
Declares a variable lobjConfig of type PrjConfigInfo.ClsConfigInfo and initializes it with a reference of a new object of this type (with Default constructor New() ).
4. Private Declare Function Trans_Ticket Lib "InlottPrint.dll" (ByVal lStrPrintStr As String) As Integer
Hem, personnaly, i never use this... so, i cannot help you well on this
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
hi
as you know,there are *.gif files and
these pictures contain some move.
and the query.. how can i use this picture files
in vb6
thanks for all
|
|
|
|
|
Hi all,
Any one have sample code or any link of CRUD application.... using Data Grid.
plz share it...
thanx
Sajjad
|
|
|
|
|
Hi,
The following ling link have something related to ur thread
Just try.....
http://www.novicksoftware.com/Articles/crud-operations-using-sql-server-stored-procedures-part-1.htm
all the best
Satish Chandra Kumar
satish_softin@rediffmail.com
InLott Technologies Pvt Ltd
Chennai
|
|
|
|
|
Hi all,
I m develop a application with Asp.net(vb.net) and it uses SQL Server 2000 database.
In my application user add or update some Record in database.
I wanna , whenever user add the record,Time and date is captured....
or whenever user Update the record,Time and date is captured....
plz discuss in detail...
NOTE : I m not using Store Procdure
thanx in advance
Sajjad
|
|
|
|
|
well you have to put this question in SQL Forum. But Since you are here So the solution is you have put the date and time in table either same or different.
add two fields in your same table..
InsertedOn and ModifiedOn.
Now in InsertedOn put default value GetDate() (* SQL function). and do not insert this through your code. it will automatically populate when record will be inserted.
when user will modify any record from ASP then in update query put the new date in ModifiedOn to keep the record of last updated record. For Modification you can also write the trigger. On after insert and there you can use the getdate function to update the modified date.
Option 2.
Create a new table and put these values inserted on and modifiedON in this table when any event occur on ASP page. like adding or modifying the record.
|
|
|
|
|
|
hi
i want to know how i can access the mapped network drive. what thing i should know of the computer to which drive i want to access. if anybody can answer i shall be thankful.
ddd
|
|
|
|
|
|
The selectvalue of combobox is the bug.
For example,
Public Class DataModal
Dim m_ID As Long
Dim m_Name As String
Sub New(ByVal nID As Long, ByVal sName As String)
m_ID = nID
m_Name = sName
End Sub
Property ID() As Long
Get
Return m_ID
End Get
Set(ByVal value As Long)
m_ID = value
End Set
End Property
Property Name() As String
Get
Return m_Name
End Get
Set(ByVal value As String)
m_Name = value
End Set
End Property
End Class
IN a WinForm,
Private Sub ComboBox1_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles comboCustomer.SelectedValueChanged
Dim obj As New DataModal(0, "")
obj = comboBox1.SelectedValue 'Show Error here
obj.ID=combobox1.SelectedValue 'Show Error , too
SelectedCustomerID = obj.ID
obj = Nothing
End Sub
Now , there is no method to get the ID of selectvalue.
|
|
|
|
|
This is plainly a bug that cannot exist in the .NET framework. No-one at microsoft noticed that comboboxes were totally broken ?
What's the error, is it a null reference ? The only error I can see happening in both lines of code is if comboBox1 has become null for some reason, you'll get a null reference exception.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
In Step-by-step process, I found the combobox1.selectvalue has value.
When you use long type ,such as
Dim ID as long
ID=combobox1.selectvalue
The vs.net tell that selectvalue is a object which has a member ID 1 and name value "".
When you use obj type , such as
dim obj as new datamodal(0,"")
obj=combobox1.selectvalue
The vs.net tell that selectvalue is a long which value is 1.
I am sure of that.
(VS.net 2005 beta 1)
|
|
|
|
|
rushing wrote:
(VS.net 2005 beta 1)
Your beta is out of date, and seeing as you're using a beta, you should be reporting these sort of problems to Microsoft ( that's the reason they give out a beta ) AND you should have the sense to say what platform you're using when you make claims out bugs. In beta 1, combo boxes may well have bugs - it's a beta, for goodness sakes.
It sounds like you're getting very confused. You're saying there's no error now, it's finding the values OK ? The object you're finding could well be a nullable int ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
They are having error now.
The value could be get from vs.net platform , but could not be get from code or application.
My system is windows 2000 server.
|
|
|
|
|
rushing wrote:
The value could be get from vs.net platform , but could not be get from code or application.
OK, so intellisense can see it, but not your code. You've still not told me what the error you're getting is. Have you tried the 'object obj = ' line in your code and then checking the value/type of obj in the debugger ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
The error is :
a long type value could not be convert to an object
or
a object could not be convert to a long
|
|
|
|
|
There is no implicit cast between object and long - have you even tried explicitly casting it if it is in fact the "correct" value?
|
|
|
|