Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Control Position


HiI want to move controls on form with API.I get the position on the control with GetWindowRect hwnd, cRect. (it received the control position related to the screen).I add to the Top/Left some pixels, And then I set the new position with SetWindowPos.This is my code:public Function ChangeControlsTop(byval cHwnd as Long, byval TopStep as Long) as Long Dim ControlRect as RECT GetWindowRect cHwnd, ControlRect ControlRect.Top = ControlRect.Top + TopStep SetWindowPos cHwnd, 0, ControlRect.Left, ControlRect.Top, 100, 100, SWP_NOSIZEEnd FunctionThe problem is that the SetWindowPos change the control position related to his parent, and it possible that this control is in other control(like picturebox) etc.Is any body know how can I fit between the two position ???Thanks for help




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Paste With Position Control
Ok, this is likely stupid but I can't find an answer and I figured a guru here would know if from the top of his or her head

I am pasting text to a dropdown box as the user types characters into it, updating the dropdown as he goes along (that is the easy part)

To do this, I .clear the list with every character change, which means I have to clear the text, which means I have to replace it.

The pointer, then, is as the front of the text string instead of the end. What I need to do is to paste with the pointer at the end of the text string, so that the user can just keep typing

Anyone know how?

Thanks!

SelText Position In A Web Control
how i can find the SelText Start Postion and End Position in a Microsoft Web Control.i.e when i am in desgin mode whatever text i selected i want to display its Start x,y position and End x.y position in a contol.

Absolute Control Position
ok i want a function 2 find the absolute position of a control on the form.... for example if the control passed in is in 2 pic boxes it will return the twirps to the top left of the form

- i will be doing this kinda thing abit so i need a generic function -

thanks kris

Control The Position Of A Form
How would I go about forcing a form to go to a specific position if moved via the title bar?

Control Position On Screen
Any fast way to find a controls screen position other then getting the Left value of each parent all the way down to the form?

I want to replace the pixels in my picture box with the pixels of the DesktopDC but i gotta figure out the pixel position.

Absolute Control Position?
How can I know the absolute position of a control on a
form, using the upper left corner of the form as 1,1

These controls may be put inside other controls (nested)!

Would anybody help?

Any hint?

Thanks

Control Message Box Position
Is it possible to pop up a message box,
always in the bottom right corner of my app.!!

txt in adv.

How Can I Get The X,Y Position Of A Control In A Form?
How can i get the X,Y position of a control in a form?

Control Startup Position
Hello all. I was wondering if anyone could tell me if it is possible to control the startup position of a seperate app? I am using VLC's media player to stream a terrestrial digital TV signal. The preferences with that app allow me to set the size etc but not the startup position. The code i use to launch the app from within my VB6 app is:

Code: Shell Chr(34) & "C:Program FilesVideoLANVLCvlc.exe" & Chr(34) & " -vvv udp://@239.192.68.111:5000 -- width 776 -- height -100", vbNormalNoFocus

If it is not posssible to directly control the startup position can anyone suggest some sort of work around. Thanks people

----------------------------------------------------
Shrek and Donkey and on another whirlwind adventure!

Force A Control To Take Top Most Position On A Form.
I'm using a 3rd party control to view documents( VSPrinter).
I want to draw a line and have it sit on top of the VSPrinter control but the VSPrinter control always puts the line underneath it.

Any solutions to this problem?

Thanks.

Cursor Position In A TextBox Control
Hey Guys,
I was wondering if anyone knows how to determine the cursor position within a textbox control, or if not,suggest a work around for the following scenario:

I have an MSFlexGrid that I want to allow users to edit. Obviously, a bit of programming allows one to place a text box over the active cell in the grid. This is easy, and works without incident, but I want to add a bit more functionality by allowing the user to use the up/down left/right keys from within the textbox control to move around the grid. THe catch is that I only want the left/right keys to change the grid cell if the cursor is in the first column of the text, or the last column of the text respectively. Since there is no guarantee that any text will be HighLighted, I cannot use .SelStart.

Any thoughts would be helpful,

Thanks,

Hunter

Move Control To Mouse Position
Hello,

Can anyone show me how to move a control to the exact mouse position. I've been using the pointapi when I click on my form but the mouse won't move to the loaction of the cursor,

Cheers
Ross

How To Set The Position Of DataPointLabel In MSChart Control
I have a problem try to move the position of DataPointLabel in Pie chart.
I am not sure but I try to use offset property to change its position, but it doesn't work. The label still the same position.

With grphObj.Plot.SeriesCollection(i).DataPoints(-1).DataPointLabel
.LocationType = VtChLabelLocationTypeOutside
.LineStyle = VtChLabelLineStyleStraight
.Component = VtChLabelComponentPercent
.VtFont.Size = 10
.Offset.Set 10, 2
.PercentFormat = "0.00%"
End With

The offset.set is not work because when I debug I check (X,Y) value it still (0,0) rather than (10,2)

How To Control Line Position In A TextBox
I am using a textbox with MultiLine set to true. When the number of lines exceeds the height of the textbox the vertical scrollbar becomes active. How can I tell the topindex or the line position of a textbox?

Thanks,
sneakers

btw: I havent been using this forum for very long and was wondering how to mark a thread as resolved.

Position Form Based On Another Control
Hello, I am working on this game and need help with some form positioning. Since I have used the game so far on a Windows 2000 and XP I am seeing an issue. I have the main form and then another form opening up ontop of this form. The form that opens is positioned to cover a specific part of the main form. If I do the math on one computer, it looks different on the other because of the change of the borders and everything, the top/left get messed up.

I thought I would use a control on the form. Like setting a border around the area and then usign its top/left position but I can get that to work correctly. Can someone help me position 1 form based on a location of a control on another, so on any Operating System, they will line up correctly.

Please help.

Window Size/position Control
i have shelled explorer like this


Code:
Dim One
One = Shell("explorer.exe a:", vbNormalFocus)


Now i want to control its size and position, I will alse be shelling another window,


Code:
dim Two
Two = Shell("explorer.exe C:Documents and SettingsJonMy DocumentsJon", vbNormalFocus)


and i want One to be on the left half of the screen and Two to be on the right half of the screen.

Any suggestions?
Thanks

Position A Textbox On A Richtextbox Control
Hi

I have to design an interactive form where there are lots of explanatory texts and then some textbox controls that should naturally merge into the flow of text. For example a form would have the following:

Your name is <textbox> and address <textbox>.

I have tried using a RichTextbox control where the text contains a specific tag where I expect the textbox to be. I then get the character position of the tag using Find method. Once I get the position I use getLineFromChar to determine the line on which the tag appears. I then use the average height of a character to determine the pixel position of the tag and add this to the top property of the richtextbox. However, I can't find a way to determine the positon of the tag from the left of the richtextbox. This would enable me position my textbox at a particular position within the RTB during runtime.

Does anybody have any idea on how I can achieve this ? Or else, is there an altenative to using RTB ?

I cannot replace the textbox controls since the user should be able to edit the name and address.

Thanks

Cursor Position In Webbrowser Control
Hi,
Does anyone have an idea on how to get the cursor position from the WebBrowser control.

Thanks

Volume And Position Max For Mediaplayer Control
How do i set a slider's value to a max that corresponds to the end of a movie file? Also how do i set the volume on a slider?

Capturing Mouse X Position In A Control
I need a way to capture the X position of the mouse in a control.

I tried using the MouseMove Event but it doesn't seem to get the info i need.

I need to find out the X position as the user moves the mouse within the control.

Position Of Nodes In A Treeview Control
Is there any way to determine the position of a node in a group of child
nodes in a Treeview control? For example:



Days of Week

.... Monday

.... Tuesday

.... Wednesday



I would like to be able to programmatically determine that Monday is the
first child node, Tuesday the second and so on. Also, if I drag and drop
the child nodes, I need to be able to determine the node's new position.
For example (as the result of a drag and drop):



Days of Week

.... Wednesday

.... Tuesday

.... Monday



I now need to know that Wednesday is the first node, and so on.



Thanks for your help

Control The Position Of Components Depending On Others
Hello all,


I was wondering if it's possible to place components on a form
depending on the size of another component.
Let's say I have a datagrid that gets populated from a database.
Depending on the choices of the user, that qill create a query, and
depending on that query, the datagrid might have 10 rows or it might
only have 1. I want to place a radiobuttonlist as well as a label just
beneath the datagrid, but in the design view, I place it right under
the datagrid. And when the datagrid has many rows, my label gets mixed
in the datagrid. Or if it has only one row, the label is way underneath
it....at the bottom.
How can I control the position of components depending on others that
get populated at runtime ?????


I know one of u guys knows this......has to!!
thanks in advance!!
JMT

Text Position In Richtextbox Control
Hi Guys. I have spent the last few hours searching the internet trying to find out how to enter a string into the richtextbox control and have it display the string in the bottom left corner and stay in that position even if the form is maximised. Any subsiquent strings will scroll the control up.

Any ideas how to do this would be much appreciated.



Edited by - Gomjibar on 8/21/2004 7:05:43 AM

How To Get The Position Of Cursor In A Codemax Control
How to you get the cursor pos of the cursor in a codemax control.

I need it so I can use the command CodeMax.InsertText "Text", Pos as RECT

I know the position is a RECT, but Codemax does not have a command to retreave the curdor position, or I can't seem to finf it.

Any help would be great.

Window Position To Bottom Of Control
hi, i posted this question earlier, but maybe i didnt provide enough information. i have a window with a button on it. when the button in pressed another window opens up. how can i set the position of the new window to the bottom of the button control? any help would be appreciated. thanks!

User Control -- Way To Retrieve Position In Container?
I want my user control to be able to determine what its .Left and .Top position are in its container. Is there a way to do this?

-Amrazek

Determinig The Position Of A Control On Its Parent Form...
Im making a graphical button control and I quite like the idea of a floating image when the mouse is over the control, but I cant quite seem to locate the control on the parent, I'm using the GetCursorPos API function to locate the mouse position wherever it is, but I need to compare that to the controls x,y co-ords in its parent... I tried this:

ObjectXCoOrd = UserControl.CurrentX
ObjectYCoOrd = UserControl.CurrentY

But it returns a 0 value all the time... Any help please? Just a pointer in the right direction would be great.

Matt

Access: Fixed Position Under Can Grow Control?
On my Access Report, I have two columns of data (to make it fit on one page). on the right side at the top is a Can Grow text box. It works well and pushes the information on the right side down properly, but it ALSO pushes the information down on the left side, even though no part of it extends over these controls. Is there a way to fix a position of a control so that the Can Grow textbox does not change its position?

This question has been asked before with no answer, but hopefully I can get one this time:
http://www.xtremevbtalk.com/showthread.php?t=132668

Calender View Control Position On Screen
Hi All

I click a number of buttons to open a calender view

Can anyone tell me how to get my calender view to always open next to the button i pressed to open it

thanks

Gibbo

How To Control The Startup Position Of A Mdichild Form?
how can i control the startup position of a mdichild form ?

How To Get The Position Of Selected Record In MSH FlexGrid Control In Vb
how to get the absolute position in the MSH Flex Grid Control?

How To Save The Control Position In To Structure At Runtime
hi
I have picture box .inside the picturebox i have so many controls is there.
I want to store the all properties values in to structure at runtime.
because i am using structure for undo redo opertion.

Screen Position To Form Control Math.... HELP!
I am using the

Private Declare Function GetCursorPos Lib "user32" (lpPoint As _
POINTAPI) As Long

Private Type POINTAPI
x As Long
y As Long
End Type
Dim a As POINTAPI
Dim b As Long
Dim c As Long


API to read the position of the mouse.
Now I need my form to use twips since I dynamically am adjusting position of all form controls on form resize and I tried pixels and it was a mess.

Now I use the mouse position in conjunction with Microsoft HTML Object library pointing to the currently loaded page in the webbrowser control.

Say a link is on the page. I use the mouse X,Y to check if it is over a link.
BUT
The API returns positions that to not work with the browser.
I will be like 30 pixels above a link and it thinks I am on it.
I tried adjusting it and it still didn't work.

Is there some math solution to get the returned X and Y to be X and Y for the browser control? Wouldn't it have to account for different screen resolutions and form sizes?

The code attached is in VB 5.


Thank you for any help

Mike

Getting The Absolute Position Of A Control Without Knowing Its Parent
Is there anyway to get the screen coords of a control that doesn't have an hWnd and if you don't know its parent control? I am trying to work on a class and I need to know the top and left of a control relative to a screen (not the window) without passing an hWnd.

*** Resolved *** How To Know The Relative Position Of An Control In A Form?
Hi,

how can I know the Top, Left, Width (or Right), Height (or Bottom) position of a control in a form?

nice greetings
Franky

Get The Current Cursor Position From TextBox Control
I have a TextBox control (MSForms.TextBox) and I manipulate the characters before writing in the TextBox. How can I get the actual character position where I insert the character.

With Regards,
fazek

Control Text Position In Print Document
I want to print some text from a string. But the text printed at the left edge of the paper... how can i control the text position so that the text can be print to other area of the paper??

How To Position Selected Item To Top Of Listview Control
The codes below allows me to search for a particular item in the listview control by typing a search text. How can I position the selected item to the top of the listview control ?
Thanks in advance.

Private Sub txtSearch_Change()
Dim itmX As ListItem
Dim sSearch As String
Dim iTest As Integer

sSearch = txtSearch.Text

Set itmX = lstvFields.FindItem(sSearch, , , lvwPartial)
Set lstvFields.SelectedItem = itmX

If itmX Is Nothing Then
Exit Sub
Else
itmX.EnsureVisible ' Scroll ListView to show found ListItem.
itmX.Selected = True ' Select the ListItem.
lstvFields.SetFocus ' Return focus to the control to see
' selection.
End If
End Sub

How To Get The Record Position In The MSH Flex Grid Control
How to get the absolute position or selected record position in the MSH Flex
grid control.

VB.NET Custom Textbox Control Cursor Position
Hello,

I've created a custom control inherited from the Windows.Forms.Textbox control. Basically it's a textbox that pulses in color when it has the focus. It uses a bitmap (gradient) to paint the background of the textbox, therefore I have to override the method to paint the text to make it visible.

Everything works how I want it, except for the cursor position in the textbox. When I type something into the textbox (runtime), the blinking cursor doesn't position correctly. This also depends on the font(size) I use. For example: with a larger font the cursor appears 2 or 3 letters in front of where it's supposed to be and with smaller fonts it appears farther to the back than actually should be. This is only a visual problem because backspace, delete, etc. work correctly. Does anyone have a clue of which method/property to override or shadow?

This is the code I use to draw the text into the textbox:

CODEProtected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  Dim g As Graphics = e.Graphics
  g.Clear(Parent.BackColor)
  Draw(g)
End Sub

Protected Sub Draw(ByVal g As Graphics)
  DrawBackground(g)
  DrawText(g)
End Sub

Protected Sub DrawBackground(ByVal g As Graphics)
  If Focused Then
    DrawTextboxState(g, iaDefault)
  Else
    DrawTextboxState(g, iaNormal)
  End If
End Sub

Protected Sub DrawTextboxState(ByVal g As Graphics, ByVal ia As ImageAttributes)
  Dim tb As New TextureBrush(imgFill, New Rectangle(0, 0, imgFill.Width, imgFill.Height), ia)
  tb.WrapMode = WrapMode.Tile

  g.FillRectangle(tb, 0, 0, Me.Width, Me.Height)
  tb.Dispose()
End Sub

Protected Sub DrawText(ByVal g As Graphics)
  Dim layoutrect As New RectangleF(0, 0, Me.Width, Me.Height)
  Dim fmt As New StringFormat
  fmt.Alignment = StringAlignment.Near
  fmt.LineAlignment = StringAlignment.Near

  Dim textBrush As New SolidBrush(ForeColor)
  g.DrawString(Text, Font, textBrush, layoutrect, fmt)
  textBrush.Dispose()
End Sub

Control All New Window Position In Multi Monitors
Hi,

I have a software that put animation on PRIMARY monitor and on secondery there is my program that can edit the animation at the same time.

the PRIMARY monitor need to show ONLY the animation and nothing else (it run on fullscreen)

my problem is that every window you open on the secondery monitor (my computer,iexplorer...) open itself on PRIMARY monitor .

How can I set all the windows that will be opened to open them self on the Secondery monitor and not on the PRIMARY one.


position my software is not a problem, only set other windows postions.
There is no way to run my animation on the SECONDERY monitor.

Thanks ahead, Alon.

Control Position And Size Of Picture Inserted Into WORD
Hi guys...heres another problem I have...I have a code which sends values in textboxes and also pictures to WORD. This is the code:

Code:
Private Sub Command1_Click()
On Error GoTo WN_Err
Dim objWord As New Word.Application, objDocument As Word.Document
Dim strBK As String, strValue As String
Dim strWordTemplate As String
Dim i As Integer, intCount As Integer

strWordTemplate = "C:DemoTemplate.dot"
With objWord
.Documents.Add Template:=strWordTemplate, NewTemplate:=False
'Add the hello part
.Selection.GoTo What:=wdGoToBookmark, Name:="bkmHello"
.Selection.TypeText Text:=Me!Text1.Text

.Selection.InlineShapes.AddPicture "C:file.jpg", False, True
End With

WN_Exit:
Set objWord = Nothing
Exit Sub

WN_Err:
MsgBox Err.Number & ": " & Err.Description, vbExclamation, "Word Error"
Resume WN_Exit
End Sub
The problem is what code should I add to control the size of the picture and the position of it. For strings I used bookmarks to state the position of the strings added. What should I do for pictures?

As usual any help will be appreciated...

Mouse Position Inside A Picture Box Or Image Control
I need help on retrieving the mouse position inside a picture box or image control. I can do it for the entire screen but I want to be able to do this in relation to the picture box. (Example: top left of picture box would be 0,0) If anyone can help me please post. I am using VB 5, but about to upgrade to 6 pretty soon. Thank you.

Webbrowser Control, Scroll Position And Input Boxes
I know how to set a position using HTML.parentWindow.scrollTo 0, HTML.body.offsetHeight, but how can I check if the position is already in the bottom?

My another question is: is it possible to detect keypress within the webbrowser control? Form's KeyPreview doesn't work and I'd like to capture and reset text in an input box.

Adjusting Control Size And Position With Mouse Click
Hi all

I'm trying to acheive the effect that outlook and that sort of program has where the small gap between 2 controls can be dragged horizontally and it resizes the controls either side of it so that there is always a small gap. Any ideas?

Thanks

Andy

How To Place Command Button In Different Position Using Control Array
hellow friends,

   In my program, when i click the command button, an array of command buttons using control arrays has to be displayed in different places of the screen.

  I am able to display an array of command buttons using control array in same line. but not in different positions.

can any one plz help to solve the problem.

Advance Thanks.

 also mail ur response to anjali_mca2003@yahoo.com

Control All New Window Position In Multi Monitors (any API That Helps?)
Hi,

I have a software that put animation on PRIMARY monitor and on secondery there is my program that can edit the animation at the same time.

the PRIMARY monitor need to show ONLY the animation and nothing else (it run on fullscreen)

my problem is that every window you open on the secondery monitor (my computer,iexplorer...) open itself on PRIMARY monitor .

How can I set all the windows that will be opened to open them self on the Secondery monitor and not on the PRIMARY one.


position my software is not a problem, only set other windows postions.
There is no way to run my animation on the SECONDERY monitor.

Thanks ahead, Alon.

Positioning A Control At Caret Position In A Reach Text Box - Mdi App - Help...
Hi all,
I need help with positioning a list box in a rich text box at the caret position.
The text box is in a from which is a member of an mdi form app.
In order to position the list box at the caret position, at first, I just used the GetCaretPos func and used the caret
Position strait to the list box top and left - but it didn't appear at the caret position - at all!
So, as someone suggested here, I transferred the caret position with ClienToScreen func to General screen coordinates, and tried to use these coordinates on the list box but still - the list box position will shift progrecively as the carets position will shift.
Can someone please give me some more detailed pointers to what I might be doing wrong - or that I didn't thougth of?…
Code samples will be appreciated - even very simplified…
Here is what I did - schematically…

Thanks In advance...

Dim Caretpos as POINTAPI
Dim Pos&
Pos = GetCaretPos form.whnd, Caretpos
ClientTosCreen Caretpos
List1.left = Caretpos.x
List1.top = Caretpos.y

{Resolved, Thanks}Control Position And Size Of Picture Inserted Into WORD
Hi guys...heres another problem I have...I have a code which sends values in textboxes and also pictures to WORD. This is the code:

Private Sub Command1_Click()
On Error GoTo WN_Err
Dim objWord As New Word.Application, objDocument As Word.Document
Dim strBK As String, strValue As String
Dim strWordTemplate As String
Dim i As Integer, intCount As Integer

strWordTemplate = "C:DemoTemplate.dot"
With objWord
    .Documents.Add Template:=strWordTemplate, NewTemplate:=False
'Add the hello part
    .Selection.GoTo What:=wdGoToBookmark, Name:="bkmHello"
    .Selection.TypeText Text:=Me!Text1.Text

    .Selection.InlineShapes.AddPicture "C:file.jpg", False, True
End With

WN_Exit:
    Set objWord = Nothing
    Exit Sub

WN_Err:
    MsgBox Err.Number & ": " & Err.Description, vbExclamation, "Word Error"
    Resume WN_Exit
End Sub

The problem is what code should I add to control the size of the picture and the position of it. For strings I used bookmarks to state the position of the strings added. What should I do for pictures?

As usual any help will be appreciated...



Edited by - boroangel on 1/29/2005 11:29:17 PM

Copyright © 2005-08 www.BigResource.com, All rights reserved