-
? Characteristics of Me.DesktopBounds with Screen
I have tried to set the size of the one and only form of a project to be
the size of the primary screen workarea with the following:
Me.DesktopBounds = Screen.PrimaryScreen.WorkingArea
with both Beta @ and Professional, the form is not drawn at what I would
call (0,0).
It appears as if the form is displaced from the top of the screen by the
width of the task bar at the bottom of the screen. I have no controls
on the form, it is used to test this specific sizing of the from. I can
drag up the form, then the top of the form matches the top of the screen
and the bottom of the form meets the top of the task bar. This performance
is the same for WIN2K, NT4.0, NET Beta2, and NET Professional.
Have I missed something?
TIA
Pat
-
Re: ? Characteristics of Me.DesktopBounds with Screen
Pat:
I'm using:
Public Function TB_FillDesktop32(ByVal frm As Form, Optional ByRef
bAlreadyFull As Object = Nothing) As Boolean
' Move the form to fill the desktop work area
Dim lScreenLeft As Long
Dim lScreenTop As Long
Dim lScreenWidth As Long
Dim lScreenHeight As Long
TB_GetDesktopWorkArea(lScreenLeft, lScreenTop, lScreenWidth, lScreenHeight)
With frm
If lScreenLeft <> .Left Or lScreenTop <> .Top Or lScreenWidth <> .Width Or
lScreenHeight <> .Height Then
If IsNothing(bAlreadyFull) Then
If .WindowState <> vbNormal Then
..WindowState = vbNormal
End If
..SetBounds(lScreenLeft, lScreenTop, lScreenWidth, lScreenHeight)
TB_FillDesktop32 = True
End If
Else
If Not IsNothing(bAlreadyFull) Then
bAlreadyFull = True
End If
End If
End With
End Function
Public Function TB_GetDesktopWorkArea(ByRef lScreenLeft As Long, ByRef
lScreenTop As Long, _
ByRef lScreenWidth As Long, ByRef lScreenHeight As Long) As Boolean
' Get the desktop work area
Dim rectTemp As System.Drawing.Rectangle = Screen.GetWorkingArea(rectTemp)
lScreenLeft = rectTemp.Left
lScreenTop = rectTemp.Top
lScreenWidth = rectTemp.Width
lScreenHeight = rectTemp.Height
End Function
--
Cheers,
Larry Rebich
More tips link to:
http://www.buygold.net/tips
Please:
No personal e-mail questions :-)
"Patrick Ireland" <ireland@airmail.net> wrote in message
news:3cf18d68$1@10.1.10.29...
>
> I have tried to set the size of the one and only form of a project to be
> the size of the primary screen workarea with the following:
>
> Me.DesktopBounds = Screen.PrimaryScreen.WorkingArea
>
> with both Beta @ and Professional, the form is not drawn at what I would
> call (0,0).
>
> It appears as if the form is displaced from the top of the screen by the
> width of the task bar at the bottom of the screen. I have no controls
> on the form, it is used to test this specific sizing of the from. I can
> drag up the form, then the top of the form matches the top of the screen
> and the bottom of the form meets the top of the task bar. This
performance
> is the same for WIN2K, NT4.0, NET Beta2, and NET Professional.
>
> Have I missed something?
>
> TIA
>
> Pat
>
>
-
Re: ? Characteristics of Me.DesktopBounds with Screen
Larry,
Yea, I understand what you are doing. I was trying to use the example out
of the new book by Francesco Balena, "Programming Microsoft Visual Basic
.Net". His example is at the top of page 719. If his example would work
a single assignment statement would be easier. Something must be amiss,
in the past I have had a lot of success with his code. I guess for now I'll
use the long method that you provided.
TNX
Pat
-
Re: ? Characteristics of Me.DesktopBounds with Screen
Hi Pat,
you probably need to set the form's start-up position to manual, then set the
bounds.
Me.StartPosition = FormStartPosition.Manual
"Patrick Ireland" <ireland@airmail.net> wrote in message
news:3cf18d68$1@10.1.10.29...
>
> I have tried to set the size of the one and only form of a project to be
> the size of the primary screen workarea with the following:
>
> Me.DesktopBounds = Screen.PrimaryScreen.WorkingArea
>
> with both Beta @ and Professional, the form is not drawn at what I would
> call (0,0).
>
> It appears as if the form is displaced from the top of the screen by the
> width of the task bar at the bottom of the screen. I have no controls
> on the form, it is used to test this specific sizing of the from. I can
> drag up the form, then the top of the form matches the top of the screen
> and the bottom of the form meets the top of the task bar. This performance
> is the same for WIN2K, NT4.0, NET Beta2, and NET Professional.
>
> Have I missed something?
>
> TIA
>
> Pat
>
>
-
Re: ? Characteristics of Me.DesktopBounds with Screen
Bill,
That fixed it.
Thanks,
Pat
"Bill McCarthy" <bill_mcc@iprimus.com.au> wrote:
>Hi Pat,
>
>you probably need to set the form's start-up position to manual, then set
the
>bounds.
>Me.StartPosition = FormStartPosition.Manual
>
>
>
>
>
>
>
>"Patrick Ireland" <ireland@airmail.net> wrote in message
>news:3cf18d68$1@10.1.10.29...
>>
>> I have tried to set the size of the one and only form of a project to
be
>> the size of the primary screen workarea with the following:
>>
>> Me.DesktopBounds = Screen.PrimaryScreen.WorkingArea
>>
>> with both Beta @ and Professional, the form is not drawn at what I would
>> call (0,0).
>>
>> It appears as if the form is displaced from the top of the screen by the
>> width of the task bar at the bottom of the screen. I have no controls
>> on the form, it is used to test this specific sizing of the from. I can
>> drag up the form, then the top of the form matches the top of the screen
>> and the bottom of the form meets the top of the task bar. This performance
>> is the same for WIN2K, NT4.0, NET Beta2, and NET Professional.
>>
>> Have I missed something?
>>
>> TIA
>>
>> Pat
>>
>>
>
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|