I am creating a Windows Forms ListView, and set its SmallImageList to place an icon in the first column of each row. I have set the TextAlignment for the column header to "center", but the icons are left aligned - can anyone offer advice on how to center align these icons?
Thanks
I was able to achieve the desired effect by setting the ListViewItem's IndentCount.
On a .NET ListView, the contents of column 0 are always left-aligned. You cannot set the value of TextAlign to anything else. If you try, the .NET framework just ignores it.
Related
I've got a menu strip, inside which I want to embed my company logo and align it to the right.
My project is on a Windows Form Application, sorry for not including this before.
Several google-trips have found little, this is probably my not using the proper terminology.
What is the best way to do this? I'd also like it to be flexible, so preferably no fixed-position methods.
Thank you.
Dock a TableLayoutPanel to the Top of the Form. Make it have one row and two columns. Put your MenuStrip in the left column, and a PictureBox in the right column for the Logo. Set the right column to AutoSize, the Row to AutoSize, and the TableLayoutPanel to AutoSize. Also set the SizeMode of the PictureBox to Autosize.
I have a Windows form control that was built using Telerik RadTools for Windows Forms. The form is styled nicely using the "Office 2010 Silver" theme. However, at runtime, the theme seems to throw-off the alignment of some of my labels.
I have several rows of labels and textboxes on my form. I want the labels' right sides to all line up. This is easily done in the Visual Studio designer. However, I believe my Telerik theme is throwing things off because it slightly changes the font, which alters the labels' sizes as well. Since the designer only stores the x,y coordinates of my controls, the labels' right edges no longer line-up.
Is there a way to code around this?
I fixed this by doing the following on all labels:
Set AutoSize to false.
Set x-location to that of the widest label.
Set size equal to that of the widest label.
Set TextAlignment to right.
Since all labels will have the same width and the same starting (left) location, their positions will now be fixed. Setting the alignment to the right takes care of the problem.
I need to display data in the UI in a table format. I am using wpf (MVVM), VS 2010 and windows XP. I do not want to use the DataGrid or ListView. How can I achieve this?
What I have tried
Method 1:
I tried to use SharedSizeGroup but that didn't work. The main problem with using SharedSizeGroup is that even the row height is shared among all rows.
Method 2:
I tried to use UniformGrid but I was not completely successful. Using UniformGrid will not suite my application because each column data is of different width and I do not want each column to take the same width as the Max of all!
Can anyone please tell me how to use the normal grid to get the desired result? Is there any way to use SharedSizeGroup so that only the column width is shared but not the row height and each row occupies only desired space (i.e. same behavior as setting the height to auto) but not more than that?
Additional information: This grid has to be read-only and no row should be selectable in the UI.
I have created a silverlight application that has been placed on an entity form and currently it has been set to a fixed width. What i'm after is for the application, including the datagrid and pagers that are in it, to stretch to the width of the window.
So far i've been unable to find anything that works so I was hoping that someone would be able to help me with it?
Thanks
You Should Try To Column width And Row Hight "Auto" And Also You Should Try StackPanal To Fix This Problem
Try use Stackpanel in your silverlight page and place all of controls in stackpanel and set it's width to "Auto".
I'm a developer who's trying to get the hang of Blend. I've always used Blend to mess with control templates and such, but I'm trying to get the hang of using it for basic UI design, since I figure it's probably a bit faster than typing the XAML up manually in Visual Studio.
Right now I'm just trying to create a basic Grid, but I'm seeing two default behaviors that I'm hoping someone can show me how to change.
1) When I hover my mouse outside of the design surface, I see the temporary yellow line to show up, where the new Grid Column / Row will be when I click. The problem is that the newly created rows are set to heights like 0.2297* How do I get Blend to attach regular heights, like 250?
2) Ignoring 1), once I have some rows and columns, when I drag a button, or combo box, etc, onto one of the cells, it drops it exactly where I release the mouse, while adding some large margins to position it there. Is it possible to tell blend to just drop the control into the cell, and leave the margins alone?
Grids are awesome but it takes a bit of play to get proficient at working with them in Blend. Here are some tips to get you started (I cover this in detail in chapter 4 of my book).
1) When you use the snap lines to create rows and columns Blend automatically makes them relative (Star) sized, which is the behavior you are seeing. To change the row/column style to fixed (Pixel) sizes, click on the Padlock icons to the left and top of the desired rows and columns. Then, either edit the values in XAML or you can click near (but not on) the padlock to select the row or column. This will open the sizing properties in the Properties panel.
2) The short answer is "No". Blend will always add Margins when you draw the element in a cell unless you take care to draw them to the borders. This is too difficult and time consuming, so I just make sure I draw it somewhere inside my target cell. Now I can right-click the element and select "Auto Size > Fill" and the element will fill up the cell: no Margins, Width and Height set to Auto, and Horizontal and Vertical Alignments set to Stretch. [FWIW, addressing this is my number one feature request for Blend.]
I hope this helps.
To answer point 1) Blend is creating proportional grids so that the columns remain the same relative widths when you grow or shrink the grid rather than absolute grids. So if you want absolute grid widths you'll have to go in and edit the values by hand.
I find that it's easier to create the basic form in Blend and then tweak the values in the text editor - either in Visual Studio or Blend itself.
As for point 2) I've just tried this and as long as I click inside the column/row on the grid when placing a button it adds it to the correct column/row of the grid as expected. Select the button and then just double click inside the grid - this should add a button of default size where you clicked, but in the grid. (It would be much easier if I could see what you were doing).