KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

Proportionately resize listview when form is resized

 
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion
View previous topic :: View next topic  
Author Message
Mart
KiXforms Regular
KiXforms Regular


Joined: 03 Oct 2005
Posts: 57
Location: Rotterdam - Netherlands

PostPosted: Thu Nov 26, 2009 3:39 pm    Post subject: Proportionately resize listview when form is resized Reply with quote

Is it possible to automatically resize a listview when the form gets resized.
Lets say the listview has a width of the form width - x and a height of the form height - x is it then possible to keep the width of the listview at form width -x and the height at form height - x?

Code:

Break On
$System = CreateObject("Kixforms.System")
If Not $System
   $nul= MessageBox("KiXforms.Net Not Initiated. This Script Will Now Close.","Error",16)
   Quit()
EndIf
$nul = $System.Application.EnableVisualStyles

$Form1 = $System.Form()
$Form1.Left = 167
$Form1.StartPosition = 0  ;FormStartPosition_Manual
$Form1.Size = $System.Size(514,341) ;(Width,Height)
$Form1.Text = "Form1"
$Form1.Top = 133

$ListView1 = $System.ListView()
$ListView1.Height = $form1.Height - 120
$ListView1.Left = 10
$ListView1.Top = 10
$ListView1.Width = $form1.Width - 40
$ListView1.View = $System.View_Details
$nul = $Form1.Controls.Add($ListView1)

$ListView1Column0 = $ListView1.Columns.Add($System.ColumnHeader("Item Column",100,$System.HorizontalAlignment_Left))
$ListView1Column1 = $ListView1.Columns.Add($System.ColumnHeader("Column A",100,$System.HorizontalAlignment_Center))
$ListView1Column2 = $ListView1.Columns.Add($System.ColumnHeader("Column B",100,$System.HorizontalAlignment_Right))

$ListView1Item00 = $ListView1.Items.Add($System.ListViewItem("Item 1"))
$ListView1Item00.Font = $System.Font("Microsoft Sans Serif",8.25,0) ;Regular
$ListView1Item00.ForeColor = $System.Color.FromName("WindowText")
$ListView1Item01 = $ListView1.Items.Item(0).SubItems.Add($System.ListViewSubItem("Item 1A"))
$ListView1Item02 = $ListView1.Items.Item(0).SubItems.Add($System.ListViewSubItem("Item 1B"))

$ListView1Item10 = $ListView1.Items.Add($System.ListViewItem("Item 2"))
$ListView1Item10.Font = $System.Font("Microsoft Sans Serif",8.25,0) ;Regular
$ListView1Item10.ForeColor = $System.Color.FromName("WindowText")
$ListView1Item11 = $ListView1.Items.Item(1).SubItems.Add($System.ListViewSubItem("Item 2A"))
$ListView1Item12 = $ListView1.Items.Item(1).SubItems.Add($System.ListViewSubItem("Item 2B"))

$ListView1Item20 = $ListView1.Items.Add($System.ListViewItem("Item 3"))
$ListView1Item20.Font = $System.Font("Microsoft Sans Serif",8.25,0) ;Regular
$ListView1Item20.ForeColor = $System.Color.FromName("WindowText")
$ListView1Item21 = $ListView1.Items.Item(2).SubItems.Add($System.ListViewSubItem("Item 3A"))
$ListView1Item22 = $ListView1.Items.Item(2).SubItems.Add($System.ListViewSubItem("Item 3B"))

$Button1 = $System.Button()
$Button1.Left = 10
$Button1.Text = "Button1"
$Button1.Top = 250
$nul = $Form1.Controls.Add($Button1)

$Button2 = $System.Button()
$Button2.Left = 100
$Button2.Text = "Button2"
$Button2.Top = 250
$nul = $Form1.Controls.Add($Button2)

$StatusBar1 = $System.StatusBar()
$StatusBar1.Text = "StatusBar1"
$nul = $Form1.Controls.Add($StatusBar1)

$Form1.Show  ;Displays the Form

While $Form1.Visible
   $Nul = Execute($Form1.DoEvents())
Loop
Exit 0

_________________
Mart

- He's chained forever to a world that's departed.....It's not enough, it's not enough - Sorrow by Pink Floyd.
Back to top
View user's profile Send private message
Edwinbo
KiXforms Novice
KiXforms Novice


Joined: 20 Jun 2005
Posts: 2
Location: Leeuwarden, The Netherlands

PostPosted: Thu Nov 26, 2009 4:23 pm    Post subject: Reply with quote

Hi Mart,

If you add the code below, you will get the result you want.

Code:

$ListView1.Anchor = 15
$Button1.Anchor = 6
$Button2.Anchor = 6
Back to top
View user's profile Send private message
Mart
KiXforms Regular
KiXforms Regular


Joined: 03 Oct 2005
Posts: 57
Location: Rotterdam - Netherlands

PostPosted: Fri Nov 27, 2009 8:15 am    Post subject: Reply with quote

Hmmmmm.....I did see the Anchor attribute but had no idea what to do with it. Thanks for the tip, works great.

I'm using KiXtart a lot but not so much KiXforms these days.

_________________
Mart

- He's chained forever to a world that's departed.....It's not enough, it's not enough - Sorrow by Pink Floyd.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group