In VB.NET, can we draw empty lines instead of blank area in non existent row of datagrid? - vb.net

EDITED:
I think we can just draw an image that resemble the grid using this article : drawing in a datagridview Currently creating a way to make the image drawn in tile mode. :)
Each time I develop a datacentric application using VB.NET regardless of how much the data displayed in the datagrid, I always want the grid to display full row of empty data, not just blank panel.
Can we achieve this using VB.NET design time property?
And also, we must not trigger the display of vertical scrollbar this way.. :)
Thanks

You might try doing a screen capture of the dgv when it is full of blank lines and use that as your background. However, you'll have a problem with the vertical lines if they resize the columns. In your picture you don't have any vertical lines so if you don't need them then just erase them and your problem is solved.
There's also the option of using the Virtual Mode. When you set that property to true then you can set the number of visible rows, but you are responsible for telling the dgv what each individual cell is supposed to contain: http://msdn.microsoft.com/en-us/library/2b177d6d.aspx
Or you can just add extra blank rows to whatever datasource you are setting your DGV to.
Use the ScrollBars property to turn the vertical scroll bar off.

Related

VB.NET flowlayoutpanel list of wrapped contents in one column

I'm struggling to figure out how do I make a flow layout panel that has strictly just one column and upon scrolling it adds the controls at the bottom of that column and not make a new column and so on while having it wrap the controls. I can get that If wrapcontents = false. For some reason in my case the scroll bar appears horizontally at the bottom and not vertically at the right side.
How do you make it as explained?

.net - vb.net Horizontal Scroll Bar on DataGridView

I have a DataGridView on a Windows Form that can have up to 25 columns and up to many thousands of rows. There are no defined columns in the DGV, these are dynamically generated in the code. No columns are frozen. The DGV works as expected in the version I inherited. Then I got my hands on it…
I am adding a toolbar to the form. The issue I am facing is that when I lower the top of the DGV to fit just below the toolbar and ensure the DGV fits on the form, I lose my horizontal scroll bar. I can scroll the thumb off the form, so it is no longer visible. My Document Count field shows as expected in the image below.
DGV no horizontal bar and thumb scrolled off form
Some potentially related field values from DGV Properties:
AutoSizeColumnsMode = None
AutoSizeRowsMode = None
Dock = None
ScrollBars = Both
Any input would be much appreciated.
Added a Screen Shot to help clarify the issue.
Design View of the form
Solved! Thanks #Luke #LarsTech for suggestions. Not sure why but recreating it solved the horizontal scroll bar issue. I deleted my grid and recreated it in the Designer just like the previous one. This time I used Dock Right instead of None or Fill. I did use BringToFront also, because SendToBack shrunk my toolbar to half the size. I lost my blank area on the right of the grid, but i can live with that.
Thank you so much for the help!

Using the Form Scrollbar to Control Image Transparency in Excel VBA

I'm struggling in making a form scrollbar to control the image transparency. To be specific, I've got two images that I'm linking to two buttons. Hide/show buttons, and I want the scrollbar to control the image transparency as shown in the image below. Your help would be appreciated. I can't wrap my head around to code it.
Here is a low-tech approach.
1) Create a rectangle and fill it with your picture. This doesn't require any VBA.
2) Insert the scrollbar and, using the properties, link your scrollbar to a cell with the default 0-100 range of the scrollbar's values. For example, in the following picture I linked it to J20:
Then, in a standard code module put:
Sub SetTransparency()
Sheets(1).Shapes("Rectangle 1").Fill.Transparency = Sheets(1).Range("J20") / 100
End Sub
(With of course things like Sheets(1), "Rectangle 1" and "J20" to be adjusted to match your situation)
Then - all you have to do is right click on the control and select Assign Macro to assign this macro to your control. It can be used like:
Possibly unfortunately (depending on your desires) the transparency doesn't change continuously as you scroll. AKAIK, you would need to use Active-X controls for that.

VariableSizedWrapGrid does not size correctly if control size modified in code

I am creating a UWP app and I am using the VariableSizedWrapGrid control. I am binding the Width of the a ComboBox in the grid to it the ComboBox width resizes based on the entries in the list. ( I am using a simple property exposed through my view model.) When I had the items in a StackPanel with a Horizontal orientation it worked fine. See picture below
The challenge of course is that on a smaller screen I need the fields to wrap around. So I switched the StackPanel to a VariableSizedWrapGrid. However, when I do that, the Grid does not seem to be handling the resizing of the ComboBox correctly as I get what is shown below. (See the ComboBox is now cut off
Any suggestions on how to resolve this would be greatly appreciated.
You are using the wrong Panel for the job. The one you're looking for is a WrapPanel (which doesn't exist actually though), but there are some implementations available, eg.: http://codepaste.net/8gr5go

live tiles in Windows Phone and Grids

I'm trying to create a live tile for my application, using a user control.
The user control contains a grid, an image and a rectangle filled with color.
Now here comes the funny part.
I want the rectangle to act as a background for the tile's title, and the image to fill the rest of the tile. And i said to myself, well, lets put some rows in that grid and set the like you usually set them in a WPF/SL application.
I then write the entire thing in a WBM and save it to isostore.
The problem is, the parser seems to ignore the presence of grid's rows. regardless of what I try, the rectangle is not shown, and the image covers the full tile, when it should only cover the first row. It is as if the grid didn't even existed.
Another funny aspect is that it doesn't matter if I use rows or columns, the result is the same.
Any ideas?
Are you using the following method?
Dynamic LiveTile - adding background image?
I recently implemented a Live Tile using a Grid with Rows and Columns for layout of some TextBlocks. I encountered similar challenges, so I placed the control that I was using for my Live Tile on a blank page in my app to better see what was happening. Does the control render correctly when displayed on a page (versus being rendered to a WriteableBitmap)?
Another idea. Instead of trying to position the Rectangle relative to the tile's Title, why not leave the Title property blank and put the same text in a TextBlock within the user control?
If you are careful about the font and positioning of the TextBlock, the text on the resulting background image can appear indistinguishable from text displayed from the Title property. I decided to follow this strategy myself. I found the font information in the following answer:
Font size and family for a tile's title
Otherwise, could you post an example of the XAML you are using?