How to change paddingStart and paddingEnd of the new Google Slider view - slider

As the title says, I would like to control the padding start and padding end (the red rectangle)
I've scanned the doc but nothing come out.
https://material.io/components/sliders/android#discrete-slider
Do you guy have any idea to change it?

You have to by-pass the code here.
<dimen name="mtrl_slider_track_side_padding">0dp</dimen>

Related

VB.NET MENUSTRIP doesnt honor ImageScaling at runtime

I am trying to implement a 'Flag' w/ a menustrip.
I have an image list w/ a red flag and a black flag.
When I click the menu item, i want to toggle the image.
The problem I have is that once I change the image, it wants to do SizeToFit which makes the Icon roughly the height of text. I dont want that. I want the Image to be its actual size.
I have tried putting the statements in different orders, nothing i have tried seems to work.
Currently, I have the button set to the black flag at design time.
This code shows me trying to change to a Red flag.
tsbFlagPatient.Image = ilFlags.Images(1)
tsbFlagPatient.ImageScaling = ToolStripItemImageScaling.None
tsbFlagPatient.DisplayStyle = ToolStripItemDisplayStyle.Image
[If there is some better way to approach toggling the image, im open to that. That seems like a separate question. ]
I was unable to make ImageScrolling work.
Since I dont need text here, I used BackGround Image and set
BackgroundImageLayout = Stretch
This allows the images to be the right size.
You can turn AutoSize = false and then manually set Height, Width to fine tune your menu's size.
I did reconsider the ImageList and changed the images to being stored in the project Resources. This is the code to toggle the image
Public Sub SetFlagImage(flagSet As Boolean)
If flagSet = False Then
btnFlag.BackgroundImage = My.Resources.appbar_flag_wavy_black
btnFlag.BackgroundImage.Tag = "black"
Else
btnFlag.BackgroundImage = My.Resources.appbar_flag_wavy_red
btnFlag.BackgroundImage.Tag = "red"
End If
End Sub
This had no effect on the question posed here. In general, probably better than having an image list because all forms can access it.

Reset Datagridview SelectionBackColor

In my code I have need to turn the SelectionBackColor to red to notify the user of something. When that has been rectified I wish to set it again back to its default (Blue with white text). I use color.empty but this seams to not work correctly. It resets the color BUT subsequent repeat changes to SelectionBackColor are not implemented.
I use this to change it Me.DataGridView1.DefaultCellStyle.SelectionBackColor = Color.Red
and this to reset Me.DataGridView1.DefaultCellStyle.SelectionBackColor = Color.Empty
But as I said subsequent attempts to change the color fails, even when done on the same cell that worked the first time. As I said above it's as if Im not resenting correctly. OR is it that this can only be changed once? Unlikely though
EDIT:
I tried to change the color to green instead of empty and that has worked correctly, several times over changing the color from red to green as expected. So it is definitely an issue with the color.empty (trying to reset it to default) and not code or logic anywhere else.
Thanks for any thoughts you may have
Edit2: Is there a way to capture the default style and then recall it? So instead changing to green I change to the saved default style?
the answer I found by trial and error to reset the SelectionBackColor is to first capture it and then use it when resetting.
Dim GridBackcolor As Object
GridBackcolor = Me.DataGridView1.DefaultCellStyle.SelectionBackColor
'set another color
Me.DataGridView1.DefaultCellStyle.SelectionBackColor = Color.Red
'reset
Me.DataGridView1.DefaultCellStyle.SelectionBackColor = GridBackcolor
in case it helps anyone.
for me, the solution was to set:
.DefaultCellStyle.SelectionBackColor
AND
.DefaultCellStyle.SelectionForeColor
switch to custom colors and back worked allready....
BUT
the 2. switch dosent changed the selection color. also not the background and forecolor...
perhaps the datagridview "think" one of them (selectionforecolor, selectionbackcolor, background, forecolor) could be the "same" color and has a problem with switching them ... ?
cheers :-)

ToolStripTextBox image is not appearing

I am using WindowsForms and I am trying to put a Textbox into my main menu and add an Image. However I cannot get the image to appear. What am I missing here.
txtRequestEdit.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText
txtRequestEdit.Image = Properties.Resources.Wrench16 'This is a valid image.
txtRequestEdit is a System.Windows.Forms.ToolStripTextBox
EDIT- Here is an image of the menu. The item at the bottom of this menu is the txtRequestEdit control.
Strangely the no matter how you apply the image, it won't show on ToolStripTextBox. I think this is a bug because I found nothing about this behavior in the documents or on the web.
I will try doing this with a hack like owner-drawing the item or something else and will put the wrong answer here so the next person with this issue avoids this wrong path.
This is wrong:
Apparently the Image property "supports the .NET Framework infrastructure and is not intended to be used directly from your code.", so if (as you say) everything's OK and you've checked the image itself to be valid, using ImageList and ImageIndex may solve the problem (assuming the item lies inside a MenuStrip named menuStrip1:
txtRequestEdit.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText
menuStrip1.ImageList = New ImageList()
menuStrip1.ImageList.Images.Add(Properties.Resources.Wrench16)
txtRequestEdit.ImageIndex = 0

How to make a part of a label bold

I want to make bold just the "name" in the string, how to do it?
Dim name As String = Environment.UserName
LabelWelcome.Text = "Welcome " + name + ", ...!"
I don't believe this is do-able on default labels since there is no style formatting.
I suggest to use 2 labels or a rich text box control.
You can use two labels and put them side by side. One having the bold part and other having the simple text.
You can use the OnPaint() method for custom drawing also
I found this : http://pastebin.com/L4xScMjZ [Not made by me]
It's a class that highlights part of a label for you. It doesn't bold it, but you can highlight the important part in red or any color you want.
I'm sure you could turn this to make the highlighted part bold as well.
To use it, you create a new class and put that code in.
Build your project and there should be a new control called "Scrolling Label"
You can add that control to your project and edit the properties :
Highlight : # --> how many characters you want it to highlight from left to right
HighLightText --> The color of the highlighted text
This is a bit buggy so you might want to add "DoubleBuffer = True" in your form Load
For those who still Google this: You can make a function which replaces your characters with some unicodes. You can use most of WorksheetFunction.Unichar(119808) to WorksheetFunction.Unichar(120831)

MS Access Draw line around detail section that can grow

This really shouldn't be hard, I just can't figure out how to do it.
I am making a proposal report that needs to have a border around it. The problem is to get the vertical lines on the side. I can't figure out how to get a line to grow and shrink based on the height of the detail section.
I have used Crystal reports and sure wish Microsoft would learn a few things in regards to MS Access report writing!
I am very comfortable with VBA so have no fears there.
You were right, this isn't so hard. The trick is to use 2 variables, top and bottom. In the PageHeader_Format event you set top to Me.Height, and in the PageFooter_Format event you set the bottom to Me.Top - correction, where correction is a fixed amound you use to fix the right length. I´m not sure where this amount comes from, you just have to try a little bit.
In the Report_Page event you can then draw your line from top to bottom.
Another method that nobody has mentioned is the one using the Line method of the report, outlined in Knowledge Base article 210321. I've used this one for years, and it can be used to draw both lines and rectangles. It's quite handy for invoices that have variable height subreports for the invoice details, but need the vertical lines to change according to the height of the main report detail.
No VBA needed.
Make a dummy grouping that is unique to each detail. For that grouping, set footer to yes.
In your new group footer section that you just created, add your line.
In your detail section, select all the relevant fields that can grow and set Can Grow = Yes
Done!
Edit
Off-topic, I agree that Access Reports could learn a lesson or two from Crystal. But Crystal isn't perfect either. [/flamewar]
Try this one.
Right click on the detail bar and select properties. Set the special effect to “Sunken”. This will put kind of a border around the detail section that resizes with the detail section.
I have tried to get a line to dynamically resize but its catch 22, by the time you know the height of the section (In the On Print event) you cant make any changes!
use the page event coupled with me.line and scaleheight / scalewidth.
I draw a box around the whole page with the following. Play with it and see where you end up. It is very handy for making professional reports. If you want a line in a certain place on a report you can use the controls coordinates. like
me.line(Mycontrol.left,mycontrol.top) - (myothercontrol.left+myothercontrol.width, myother control.top + myothercontrol.height)
Private Sub Report_Page()
Me.Line (0, 0)-(scalewidth -30, scaleheight-30), 0, B
End Sub