I have a powershell 2.0 GUI which has a panel with a borderstyle of FixedSingle. The border renders black but I would like it to render it white but I am not seeing how to do that.
$dataPanel = New-Object Windows.Forms.TableLayoutPanel
$dataPanel.BorderStyle = "FixedSingle"
Thanks #gravity
Seems like an oversight that you can't change the border color! Either way I can do it then the following way:
$dataPanel = New-Object Windows.Forms.TableLayoutPanel
$dataPanel.BorderStyle = "None"
$dataPanel.add_paint({$whitePen = new-object System.Drawing.Pen([system.drawing.color]::white, 3)
$_.graphics.drawrectangle($whitePen,$this.clientrectangle)
})
Related
Wow, I've really fallen down the rabbit hole. I'm trying to have text on the background of part of a UI and a text field as another part, e.g. the birthday in:
I then want to repurpose that text filed to allow text entry. So I do something like:
myTextFieldName.editable = true
myTextFieldName.backgroundColor = NSColor.textBackgroundColor()
and I get something like:
Which is all well and good, but then I note the nice thin border around the text field below it. So I think, I need a border! I add one with:
myTextFieldName.bordered = true
...and I get:
Pow! What a hideous strange thick border! It doesn't look like the default text field border at all! For the life of me, I can't figure out how to make the border of my "activated" text field match that of the default. Any ideas?
Many thanks in advance!
Need to set border and border color:
myTextFieldName.wantsLayer = true
myTextFieldName.layer?.borderColor = NSColor(red:204.0/255.0, green:204.0/255.0, blue:204.0/255.0, alpha:1.0).cgColor
myTextFieldName.layer?.borderWidth = 1.0
myTextFieldName.layer?.cornerRadius = 0.0
Set corner radius if you want rounded corner.
You can add borders to NSTextfield and customise it according how you want it.
let border = CALayer()
border.borderColor = NSColor.gray.cgColor
border.autoresizingMask = [.layerHeightSizable, .layerWidthSizable]
border.borderWidth = 1.0
myTextFieldName.wantsLayer = true
myTextFieldName.layer?.addSublayer(border)
myTextFieldName.layer?.masksToBounds = true
I am working on a codename one application. I need to remove the border for Accordion component. (or) Is there anyway to change the Accordion's border color..
Can someone guide me...
The black border shown in the image
In your theme.res, just add a UIID with no border and set this UIID for accordeon.Otherwise , you can override accordeon UIID and set empty border like this :
And then uncheck derive and select border "empty"
To remove(hide) the border of an accordion from the code you can define it's border colour to be the same as the background colour and to be as narrow as possible.
Border border = Border.createCompoundBorder(Border.createLineBorder(1, 0xffffff), Border.createLineBorder(1, 0xffffff), Border.createLineBorder(1, 0xffffff), Border.createLineBorder(1, 0xffffff));
my_accordion = new Accordion(ifont_keyboard_right, ifont_keyboard_down);
my_accordion.getAllStyles().setBgColor(0xffffff);
my_accordion.getAllStyles().setBgTransparency(255);
my_accordion.getAllStyles().setPadding(0, 0, 0, 0);
my_accordion.getAllStyles().setMargin(0, 0, 0, 0);
my_accordion.getAllStyles().setBorder(border);
Does anyone know how to set the shape fill to transparent?
I tried the following code, but is not working.
$AppVisio = New-Object -ComObject Visio.Application
$AppVisio.Visible = $false
$docsObj = $AppVisio.Documents
$DocObj = $docsObj.Add("Basic Diagram.vst")
$pagsObj = $AppVisio.ActiveDocument.Pages
$pagObj = $pagsObj.Item(1)
$Shape = $AppVisio.ActiveWindow.Page.DrawRectangle(0.315, 0.397, 3.315, 8.015)
$Shape.FillStyle = "Transparent"
Thanks.
With Visio, most of the properties that effect appearance, size and position are stored in the ShapeSheet. So you need to find the right cell to address which, in this case, is FillForegndTrans. So your line should read:
$Shape.CellsU('FillForegndTrans').FormulaU = '50%'
If you're not familiar with the ShapeSheet, you might find this useful background:
http://visualsignals.typepad.co.uk/vislog/2007/10/just-for-starte.html
I am trying to set a colour to highlight a button. However, the modify_fg method only seems to set the focus ring's colour. modify_bg works as expected.
This is my code:
use Gtk2 qw/-init/;
my $window = Gtk2::Window->new;
$window->set_title("Window!");
my $button = Gtk2::Button->new("Coloured _button");
# does not affect text
$button->modify_fg(normal => Gtk2::Gdk::Color->new(0xffff, 0, 0));
$window->add($button);
$window->show_all;
Gtk2->main;
I'm also interested whether there is a standard colour for this sort of highlight, to blend in with the user's theme.
you can get the button's child label and modify its foreground, below is an example (python, let me know if there are troubles converting it to perl)
import gtk
class TestWindow:
def __init__(self):
window = gtk.Window(gtk.WINDOW_TOPLEVEL)
box = gtk.VBox()
button0 = gtk.Button("Test Button")
label0 = button0.get_children()[0]
label0.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse('red'))
button1 = gtk.Button(stock=gtk.STOCK_ABOUT)
alignment = button1.get_children()[0]
hbox = alignment.get_children()[0]
image, label1 = hbox.get_children()
label1.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse('blue'))
box.add(button0)
box.add(button1)
window.add(box)
window.set_size_request(200, 200)
window.show_all()
def close_application(self, widget, event, data=None):
gtk.main_quit()
return False
if __name__ == "__main__":
TestWindow()
gtk.main()
hope this helps, regards
All previous helped a lot...
All the following works ok!
my $beige = Gtk2::Gdk::Color->new (0xFFFF,0xFFFF,0xCCCC);
my $azul = Gtk2::Gdk::Color->new (0,0,0xCCCC);
my $rojo = Gtk2::Gdk::Color->new (0xCCCC,0,0);
$mw->modify_bg ("normal", $beige);
my $butOk = Gtk2::Button->new_with_label(" 🗹 ¡Ya Terminé!");
($butOk->get_children)[0]->modify_fg("normal", $azul);
($butOk->get_children)[0]->modify_font(Pango::FontDescription->from_string ("Serif Bold 27"));
my $imgBTN = Gtk2::Button->new();
my $img = Gtk2::Image->new_from_file("$imagen");
$imgBTN->set_property("image"=>$img);
I used a JpGraph in php. Everything ok but slice ($p1->SetSliceColors($color);) color not work. It all time default color.
Here is my used code. Please help me :
$data = array('40','50', '10');
$Legends = array('Loss','Win', 'Draw');
$labels = array("Loss\n(%.1f%%)","Win\n(%.1f%%)","Draw\n(%.1f%%)");
$color = array('red','red','red');
$graph = new PieGraph(550,350);
$graph->SetShadow();
$p1 = new PiePlot3D($data);
$p1->ExplodeSlice(1);
$p1->SetCenter(0.55);
$p1->SetLegends($Legends);
$graph->legend->Pos(0.5,0.1);
$p1->SetTheme("earth");
$p1->SetSliceColors($color);
// Setup the labels to be displayed
$p1->SetLabels($labels);
$p1->SetLabelPos(1);
$p1->SetLabelType(PIE_VALUE_PER);
$p1->value->Show();
$p1->value->SetFont(FF_FONT1,FS_NORMAL,9);
$p1->value->SetColor('navy');
$graph->Add($p1);
$graph->Stroke();
I had the same problem. Call the Add method before setting colors:
$p1 = new PiePlot3D($data);
$graph->Add($p1);
Changing the display settings of line/bar graphs
try
$graph = new PieGraph(550,350);
$graph->ClearTheme();
Leave out
$p1->SetTheme("earth");
SetSliceColors worked for me.