473,327 Members | 2,112 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Set Rich Text Box Control Margin

Guys,

Does anyone know how to set a RichTextControl Left Margin?

I tried using the API but it is not working. I must be doing something
wrong. Here is my code:

Private Const EC_LEFTMARGIN = &H1
Private Const EC_RIGHTMARGIN = &H2
Private Const EC_USEFONTINFO = &HFFFF&
Private Const EM_SETMARGINS = &HD3&
Private Const EM_GETMARGINS = &HD4&

Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA"
(ByVal hwnd As IntPtr, ByVal wMsg As Long, ByVal wParam As Long, ByVal
lParam As Long) As Long

Private Sub SetLeftMargin(ByVal lhWnd As IntPtr, ByVal lMargin As Long)
Dim lLongValue As Long
Dim Result As Long
Result = SendMessageLong(lhWnd, EM_SETMARGINS, EC_LEFTMARGIN,
lMargin)
End Sub

The call to the function is:
SetLeftMargin(Me.Handle, 100) 'Me = Richtextbox control

Any ideas?

Thanks!
Nov 20 '05 #1
3 7658
Change the all the Longs to Integers. Then it will work

"Juan Romero" <ju*********@bowne.com> wrote in message
news:es****************@TK2MSFTNGP10.phx.gbl...
Guys,

Does anyone know how to set a RichTextControl Left Margin?

I tried using the API but it is not working. I must be doing something
wrong. Here is my code:

Private Const EC_LEFTMARGIN = &H1
Private Const EC_RIGHTMARGIN = &H2
Private Const EC_USEFONTINFO = &HFFFF&
Private Const EM_SETMARGINS = &HD3&
Private Const EM_GETMARGINS = &HD4&

Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA"
(ByVal hwnd As IntPtr, ByVal wMsg As Long, ByVal wParam As Long, ByVal
lParam As Long) As Long

Private Sub SetLeftMargin(ByVal lhWnd As IntPtr, ByVal lMargin As Long)
Dim lLongValue As Long
Dim Result As Long
Result = SendMessageLong(lhWnd, EM_SETMARGINS, EC_LEFTMARGIN,
lMargin)
End Sub

The call to the function is:
SetLeftMargin(Me.Handle, 100) 'Me = Richtextbox control

Any ideas?

Thanks!

Nov 20 '05 #2
* "Juan Romero" <ju*********@bowne.com> scripsit:
Does anyone know how to set a RichTextControl Left Margin?

I tried using the API but it is not working. I must be doing something
wrong. Here is my code:

Private Const EC_LEFTMARGIN = &H1
Private Const EC_RIGHTMARGIN = &H2
Private Const EC_USEFONTINFO = &HFFFF&
Private Const EM_SETMARGINS = &HD3&
Private Const EM_GETMARGINS = &HD4&
Remove the '&' at the end of the constants. 'Long' is a 64-bit datatype
now.
Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA"
(ByVal hwnd As IntPtr, ByVal wMsg As Long, ByVal wParam As Long, ByVal
lParam As Long) As Long
'wMsg', 'wParam', and 'lParam' should be declared as 'Int32', the return
value should be an 'Int32' too.
Private Sub SetLeftMargin(ByVal lhWnd As IntPtr, ByVal lMargin As Long)
The same for 'lMargin'.
Dim lLongValue As Long
Dim Result As Long


Dito.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3
Thanks Man!

I wonder why that happens....

"yEaH rIgHt" <nospam@haha> wrote in message
news:10*************@corp.supernews.com...
Change the all the Longs to Integers. Then it will work

"Juan Romero" <ju*********@bowne.com> wrote in message
news:es****************@TK2MSFTNGP10.phx.gbl...
Guys,

Does anyone know how to set a RichTextControl Left Margin?

I tried using the API but it is not working. I must be doing something
wrong. Here is my code:

Private Const EC_LEFTMARGIN = &H1
Private Const EC_RIGHTMARGIN = &H2
Private Const EC_USEFONTINFO = &HFFFF&
Private Const EM_SETMARGINS = &HD3&
Private Const EM_GETMARGINS = &HD4&

Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hwnd As IntPtr, ByVal wMsg As Long, ByVal wParam As Long, ByVal
lParam As Long) As Long

Private Sub SetLeftMargin(ByVal lhWnd As IntPtr, ByVal lMargin As Long)
Dim lLongValue As Long
Dim Result As Long
Result = SendMessageLong(lhWnd, EM_SETMARGINS, EC_LEFTMARGIN,
lMargin)
End Sub

The call to the function is:
SetLeftMargin(Me.Handle, 100) 'Me = Richtextbox control

Any ideas?

Thanks!


Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: David Davis | last post by:
Woll2Woll has a product for Delphi called Infopower which has a rtf control with a built-in word processor. Does anyone know of a third party control that has the same capabilities. I don't have...
0
by: ray well | last post by:
hi, my app has two parallel rich text boxes containing the same content in 2 different languages. the lines parallel each other, line #3 in english contains the same content as line #3 in...
2
by: george.leithead | last post by:
Hi all, I have a very strange problem! In following Web page (which is generated from a CMS System), the navigation to the left 'dissapears' when you roll the mouse over the links? It does not...
18
by: Diogenes | last post by:
Hi All; I, like others, have been frustrated with designing forms that look and flow the same in both IE and Firefox. They simply did not scale the same. I have discovered, to my chagrin,...
9
by: Neil | last post by:
I need to implement a rich text box in an MDB file for a user base that consists of Access 2000 and Access 2002. Unfortunately, I'm using Access 2003 on my development machine. My understanding is...
5
by: ARC | last post by:
Just found out something interesting with Access 2007... In table design, if you set a memo field to the new rich text option, and put that control on a form, set the control to rich text, you can...
4
by: Neil | last post by:
Just found out that the Microsoft Rich Textbox does not support full text justification, since it's based on Version 1.0 of the RichEdit Window Class, and full text justification is only available...
16
by: Neil | last post by:
I posted a few days ago that it seems to me that the Access 2007 rich text feature does not support: a) full text justification; b) programmatic manipulation. I was hoping that someone might...
2
by: yuleball | last post by:
I want to properly "JUSTIFY" the text in rich textbox control. Which I mean to say is Right characters to be aligned to right margin and left characters to be aligned to left margin. An example is...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.