本文整理汇总了C#中System.Windows.Controls.Border类的典型用法代码示例。如果您正苦于以下问题:C# Border类的具体用法?C# Border怎么用?C# Border使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Border类属于System.Windows.Controls命名空间,在下文中一共展示了Border类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: PageHeader
public PageHeader()
{
Brush brush = new SolidColorBrush(Colors.DarkGray);
brush.Opacity = 0.60;
this.Background = brush;
Border frameBorder = new Border();
frameBorder.BorderBrush = Brushes.Gray;
frameBorder.BorderThickness = new Thickness(2);
DockPanel panelMain = new DockPanel();
panelMain.Margin = new Thickness(5, 5, 5, 5);
panelMain.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
txtText = new TextBlock();
txtText.FontSize = 32;
txtText.Margin = new Thickness(5, 0, 0, 0);
txtText.SetResourceReference(TextBlock.ForegroundProperty, "HeaderTextColor");
txtText.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
panelMain.Children.Add(txtText);
frameBorder.Child = panelMain;
this.Content = frameBorder;
}
开发者ID:rhgtvcx,项目名称:tap-desktop,代码行数:27,代码来源:PageHeader.cs
示例2: ModifyNewContent
protected override FrameworkElement ModifyNewContent(ITransitionControl container, FrameworkElement newContent)
{
if (newContent == null)
{
HideBackground(container);
container.Remove(_border);
return null;
}
ShowBackground(container);
_border = WrapInBorder(newContent);
_border.Opacity = 0;
SetPosition(_border);
newContent.SizeChanged += (sender, e) => SetPosition(_border);
var ctrl = container.AsControl();
ctrl.SizeChanged += (sender, e) => SetPosition(_border);
return _border;
}
开发者ID:RookieOne,项目名称:Chimera,代码行数:25,代码来源:ModalAnimationStrategy.cs
示例3: BorderHitTestTest
public void BorderHitTestTest()
{
Border border = new Border
{
Width = 200,
Height = 100,
BorderThickness = new Thickness(10, 20, 30, 40),
IsRootElement = true,
};
border.Measure(Size.Infinity);
border.Arrange(new Rect(border.DesiredSize));
BackgroundHitTestTest(border, null);
BorderHitTestTest(border, null);
border.Background = Brushes.Transparent;
border.BorderBrush = null;
BackgroundHitTestTest(border, border);
BorderHitTestTest(border, border);
border.Background = null;
border.BorderBrush = Brushes.Transparent;
BackgroundHitTestTest(border, null);
BorderHitTestTest(border, border);
border.Background = Brushes.Transparent;
border.BorderBrush = Brushes.Transparent;
BackgroundHitTestTest(border, border);
BorderHitTestTest(border, border);
}
开发者ID:highzion,项目名称:Granular,代码行数:34,代码来源:BorderTest.cs
示例4: CreateWidgetControl
public FrameworkElement CreateWidgetControl(IDiagram widgetViewModel, ContextMenu contextMenu)
{
var buttonHolder = widgetViewModel as DefaultWidgetViewModel;
var brd = new Border
{
DataContext = buttonHolder,
ContextMenu = contextMenu,
BorderBrush = System.Windows.Media.Brushes.Gray,
Background = System.Windows.Media.Brushes.White
};
var ret = new Button { DataContext = buttonHolder, ContextMenu = contextMenu, Content = "New Widget" };
brd.Child = ret;
var heightBinding = new Binding("Height") { Source = buttonHolder, Mode = BindingMode.TwoWay };
var widthBinding = new Binding("Width") { Source = buttonHolder, Mode = BindingMode.TwoWay };
var xBinding = new Binding("X") { Source = buttonHolder, Mode = BindingMode.TwoWay };
var yBinding = new Binding("Y") { Source = buttonHolder, Mode = BindingMode.TwoWay };
var transformBinding = new Binding("RenderTransform") { Source = buttonHolder, Mode = BindingMode.OneWay };
brd.SetBinding(InkCanvas.LeftProperty, xBinding);
brd.SetBinding(InkCanvas.TopProperty, yBinding);
brd.SetBinding(FrameworkElement.HeightProperty, heightBinding);
brd.SetBinding(FrameworkElement.WidthProperty, widthBinding);
brd.SetBinding(UIElement.RenderTransformProperty, transformBinding);
return brd;
}
开发者ID:neapolis,项目名称:SambaPOS-3,代码行数:29,代码来源:DefaultWidgetCreator.cs
示例5: KinectDance
public KinectDance(double layoutHeight, double layoutWidth, List<TextBlock> menus, Style mouseOverStyle, Border menuBorder,TextBox debugBox = null)
{
_layoutHeight = layoutHeight;
_layoutWidth = layoutWidth;
_debugBox = debugBox;
_menus = menus;
_menuBorder = menuBorder;
_mouseOverStyle = mouseOverStyle;
_kinect = KinectSensor.KinectSensors.FirstOrDefault();
if (_kinect == null) return;
//_kinect.SkeletonStream.TrackingMode = SkeletonTrackingMode.Seated;
_kinect.Start();
_kinect.ColorStream.Enable();
_kinect.SkeletonStream.Enable(new TransformSmoothParameters
{
Smoothing = 0.7f,
Correction = 0.3f,
Prediction = 0.4f,
JitterRadius = 0.5f,
MaxDeviationRadius = 0.5f
});
_kinect.SkeletonFrameReady += kinect_SkeletonFrameReady;
}
开发者ID:rudylee,项目名称:WpfApp,代码行数:27,代码来源:KinectDance.cs
示例6: InitGrid
private void InitGrid()
{
var first = true;
_gridPlace.ColumnDefinitions.Clear();
_gridPlace.RowDefinitions.Clear();
_gridPlace.Width = _place.GetLength(0)*10;
_gridPlace.Height = _place.GetLength(1)*10;
for (var i = 0; i < _place.GetLength(0); i++)
{
_gridPlace.ColumnDefinitions.Add(new ColumnDefinition());
for (var j = 0; j < _place.GetLength(1); j++)
{
if (first) _gridPlace.RowDefinitions.Add(new RowDefinition());
var border = new Border();
border.SetValue(Grid.RowProperty, i);
border.SetValue(Grid.ColumnProperty, j);
border.MouseLeftButtonUp += ChangeToSeat;
border.MouseRightButtonUp += ChangeToTable;
border.Style = _gridPlace.FindResource("Empty") as Style;
_gridPlace.Children.Add(border);
}
first = false;
}
}
开发者ID:Bumper03,项目名称:RestApp,代码行数:25,代码来源:RestaurantViewModel.cs
示例7: AddDrop
public static FlowDocument AddDrop(this StackPanel sp, Drop drop)
{
FlowDocumentParser fdp = new FlowDocumentParser() { TextAlignment = TextAlignment.Right };
fdp.AddBold(drop.Author.Name + " at " +
String.Format("{0:dd/MM/yyyy HH:mm}", drop.UpdatedAt));
fdp = new FlowDocumentParser(fdp.Doc);
fdp.AddMarkUp(drop.Content);
FlowDocumentScrollViewer fdsv = new FlowDocumentScrollViewer()
{
HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled,
Document = fdp.Doc,
VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
Foreground = new SolidColorBrush(Colors.White)
};
Border border = new Border()
{
BorderThickness = new Thickness(0, 5, 0, 5),
CornerRadius = new CornerRadius(10),
Padding = new Thickness(3),
Background = new SolidColorBrush(Colors.Black),
Cursor = Cursors.Hand,
Child = fdsv
};
fdp.Doc.PreviewMouseWheel += Bubbler;
fdsv.PreviewMouseWheel += Bubbler;
fdsv.SizeChanged += Resizer;
sp.Children.Add(border);
return fdp.Doc;
}
开发者ID:shurizzle,项目名称:FAGGUI,代码行数:35,代码来源:XamlHelpers.cs
示例8: showPopup2_Click
private void showPopup2_Click(object sender, RoutedEventArgs e)
{
if (p.IsOpen == true)
return;
Border border = new Border();
border.BorderBrush = new SolidColorBrush(Colors.White);
border.BorderThickness = new Thickness(2.0);
StackPanel panel1 = new StackPanel();
Button button1 = new Button();
button1.Content = "Close";
button1.Margin = new Thickness(5.0);
button1.Click += new RoutedEventHandler(button1_Click);
TextBlock textblock1 = new TextBlock();
textblock1.Text = "Premi il pulsante Close";
textblock1.Margin = new Thickness(5.0);
panel1.Children.Add(textblock1);
panel1.Children.Add(button1);
border.Child = panel1;
p = new Popup();
// Imposta la proprietà Child con il border che è il contenitore principale che contiene a sua volta uno stackpanel, un textblock ed un button.
p.Child = border;
//imposta la posizione del popup
p.VerticalOffset = 100;
p.HorizontalOffset = 50;
// apre il popup
p.IsOpen = true;
}
开发者ID:zetanove,项目名称:Esempi_Silverlight4,代码行数:31,代码来源:MessagesPage.xaml.cs
示例9: ChangeObjVisibilityWindow
public ChangeObjVisibilityWindow()
{
InitializeComponent();
var mainWin = DesignerMainWindow.GetInstance();
for (int i = 0; i < mainWin.canMainCanvas.Children.Count; i++)
{
UIElement elem = mainWin.canMainCanvas.Children[i];
var obj = elem as IObject;
if (obj == null) continue;
if (obj.Type == ObjectType.Area || obj.Type == ObjectType.DropContainer
|| obj.Type == ObjectType.FlashAnimation || obj.Type == ObjectType.Sound) continue;
var brdr = new Border
{
BorderBrush = Brushes.Black,
BorderThickness = new Thickness(0),
Margin = new Thickness(1, 3, 2, 3),
Width = 110,
Height = 110/1.66667
};
var element = elem as IObject;
IObject copy = element.DeepCopyWithObjectId();
copy.HorizontalAlignment = HorizontalAlignment.Center;
copy.VerticalAlignment = VerticalAlignment.Center;
if (copy.Height > copy.Width)
copy.Height = brdr.Height - 10;
else
copy.Width = brdr.Width - 15;
brdr.Child = copy as UIElement;
lbObjects.Items.Add(brdr);
}
}
开发者ID:undecimus,项目名称:komunikator,代码行数:35,代码来源:ChangeObjVisibilityWindow.xaml.cs
示例10: CreateCellContent
// bind cell to ticker
public override void CreateCellContent(C1FlexGrid grid, Border bdr, CellRange range)
{
// create binding for this cell
var r = grid.Rows[range.Row];
var c = grid.Columns[range.Column];
var pi = c.PropertyInfo;
if (r.DataItem is FinancialData &&
(pi.Name == "LastSale" || pi.Name == "Bid" || pi.Name == "Ask"))
{
// create stock ticker cell
StockTicker ticker = new StockTicker();
bdr.Child = ticker;
bdr.Padding = _thicknessEmpty;
// to show sparklines
ticker.Tag = r.DataItem;
ticker.BindingSource = pi.Name;
// traditional binding
var binding = new Binding(pi.Name);
binding.Source = r.DataItem;
binding.Mode = BindingMode.OneWay;
ticker.SetBinding(StockTicker.ValueProperty, binding);
}
else
{
// use default implementation
base.CreateCellContent(grid, bdr, range);
}
}
开发者ID:mdjabirov,项目名称:C1Decompiled,代码行数:31,代码来源:FinancialCellFactory.cs
示例11: WaveGraph
public WaveGraph(Canvas waveGraph, Border waveBorder, float[] soundData, int sampleRate)
{
float max;
int i;
this.waveGraph = waveGraph;
this.waveBorder = waveBorder;
this.soundData = soundData;
this.sampleRate = sampleRate;
max = soundData.Max(element => Math.Abs(element));
createAmplitudeLabels(max);
numberOfSeconds = (soundData.Length / sampleRate);
heightRatio = GRAPH_HEIGHT / (max * 2);
//DrawSecond(PIXEL_SECOND * 0, sampleRate * 0);
for (i = 0; i < numberOfSeconds; i++)
{
createSecondLabel(i);
DrawSecond(PIXEL_SECOND*i, sampleRate*i);
}
//create final second label
createSecondLabel(i);
//adjusts the canvas width based on number of seconds and space between end points
int newCanvasWidth = (numberOfSeconds * PIXEL_SECOND) + (XSTART * 2);
if (newCanvasWidth > canvasWidth)
{
waveBorder.Height += HSCROLLSIZE;
Console.WriteLine(canvasHeight);
waveGraph.Height = canvasHeight;
extendCanvas(newCanvasWidth);
}
//DrawGraph();
}
开发者ID:iamnilay3,项目名称:COMP3931-SoundEditor,代码行数:35,代码来源:WaveGraph.cs
示例12: AddActor
public void AddActor(string name)
{
var header = new Border
{
BorderBrush = Brushes.Black,
BorderThickness = new Thickness(1),
Margin = new Thickness(5),
CornerRadius = new CornerRadius(3),
Padding = new Thickness(15, 2, 15, 2),
Child = new TextBlock { Text = name },
SnapsToDevicePixels = true,
};
SeqDiagPanel.SetPosition(header,
Position.OneColumn(_column, 0));
LayoutRoot.Children.Add(header);
var line = new Line
{
StrokeThickness = 1,
Y1 = 0,
Y2 = 75,
X1 = 0,
X2 = 0,
MinHeight = 75,
Stroke = Brushes.Black,
Stretch = Stretch.Fill,
SnapsToDevicePixels = true,
};
SeqDiagPanel.SetPosition(line, Position.Body(_column));
LayoutRoot.Children.Add(line);
_column++;
}
开发者ID:marhoily,项目名称:TextToSeqDiag,代码行数:32,代码来源:SequenceDiagram.cs
示例13: RemovedItemAdorner
public RemovedItemAdorner(UIElement adornedPanel, FrameworkElement adornedElement)
: base(adornedPanel)
{
this.IsHitTestVisible = false;
Width = Math.Ceiling(adornedElement.ActualWidth);
Height = Math.Ceiling(adornedElement.ActualHeight);
var offset = VisualTreeHelper.GetOffset(adornedElement);
_border = new Border
{
Background = new VisualBrush(adornedElement),
Width = adornedElement.ActualWidth,
Height = adornedElement.ActualHeight,
RenderTransform = new TranslateTransform
{
X = offset.X,
Y = offset.Y,
}
};
// HACK: Need to figure out why this doesn't work
_border.Width = 50;
_border.Height = 40;
AddVisualChild(_border);
Loaded += RemovedItemAdorner_Loaded;
}
开发者ID:TheFabFab,项目名称:ObservableLinq,代码行数:30,代码来源:RemovedItemAdorner.cs
示例14: PageContent
public PageContent()
{
Brush brush = new SolidColorBrush(Colors.DarkGray);
brush.Opacity = 0.80;
this.Background = brush;
Border frameBorder = new Border();
frameBorder.BorderBrush = Brushes.Gray;
frameBorder.BorderThickness = new Thickness(2);
Grid panelMain = new Grid();
RowDefinition rowDefTop = new RowDefinition();
rowDefTop.Height = new GridLength(90, GridUnitType.Star);
panelMain.RowDefinitions.Add(rowDefTop);
RowDefinition rowDefBottom = new RowDefinition();
rowDefBottom.Height = new GridLength(10, GridUnitType.Star);
panelMain.RowDefinitions.Add(rowDefBottom);
panelContent = new StackPanel();
panelContent.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
panelContent.Margin = new Thickness(10, 10, 10, 10);
Grid.SetRow(panelContent, 0);
panelMain.Children.Add(panelContent);
frameBorder.Child = panelMain;
this.Content = frameBorder;
}
开发者ID:rhgtvcx,项目名称:tap-desktop,代码行数:32,代码来源:PageContent.cs
示例15: ShowTutorialHint
public static void ShowTutorialHint()
{
if (Properties.Settings.Default.showtutorial)
{
Properties.Settings.Default.showtutorial = false;
Properties.Settings.Default.Save();
MiscTools.FlashControl(Main.btnTutorial, Colors.Yellow, Main);
var tutHint = new Popup
{
VerticalOffset = -3,
PlacementTarget = Main.btnTutorial,
Placement = PlacementMode.Top,
IsOpen = true
};
var brd = new Border
{
BorderBrush =
new LinearGradientBrush(Colors.LightSlateGray, Colors.Black, .45),
BorderThickness = new Thickness(1),
Background =
new LinearGradientBrush(Colors.LightYellow, Colors.PaleGoldenrod, .25),
Child = new TextBlock
{
Margin = new Thickness(4),
FontSize = 12,
Text = "Click to start a short tutorial on how to use Elinor"
}
};
tutHint.Child = brd;
tutHint.MouseDown += delegate { tutHint.IsOpen = false; };
}
}
开发者ID:henrybond158,项目名称:elinor,代码行数:32,代码来源:Tutorial.cs
示例16: JumpToSlideWindow
public JumpToSlideWindow()
{
InitializeComponent();
var mainWin = DesignerMainWindow.GetInstance();
for (int i = 0; i < mainWin.lbThumbs.Items.Count; i++)
{
var vb = mainWin.lbThumbs.Items[i] as Viewbox;
var slideImg = (vb.Child as Border).Child as Image;
if (slideImg == null) continue;
var thumb = new Image {Source = slideImg.Source};
if (i == mainWin.GetCurrentSlideNr())
thumb.Opacity = 0.7;
thumb.Width = 110;
thumb.Height = thumb.Width/1.6666667;
var brdr = new Border
{
BorderBrush = Brushes.Black,
BorderThickness = new Thickness(2),
Margin = new Thickness(1, 3, 2, 3),
Child = thumb,
Tag = vb.Tag
};
lbSlides.Items.Add(brdr);
}
}
开发者ID:undecimus,项目名称:komunikator,代码行数:29,代码来源:JumpToSlideWindow.xaml.cs
示例17: KNTabView
public KNTabView()
: base()
{
TabHeight = 30.0;
SnapsToDevicePixels = true;
contentCanvas = new Border();
contentCanvas.Background = new SolidColorBrush(Color.FromRgb(245, 245, 245));
contentCanvas.BorderBrush = new SolidColorBrush(Color.FromArgb(25, 0, 0, 0));
contentCanvas.BorderThickness = new Thickness(1.0);
Canvas.SetZIndex(contentCanvas, kContentZIndex);
DropShadowEffect effect = new DropShadowEffect();
effect.BlurRadius = 3.0;
effect.Color = Colors.Black;
effect.Direction = 90.0;
effect.ShadowDepth = 0.0;
contentCanvas.Effect = effect;
this.Children.Add(contentCanvas);
this.AddObserverToKeyPathWithOptions(this, "TabHeight", 0, null);
this.AddObserverToKeyPathWithOptions(this, "ActiveItem", 0, null);
this.AddObserverToKeyPathWithOptions(this, "LeftControl", 0, null);
this.AddObserverToKeyPathWithOptions(this,
"Items",
KNKeyValueObservingOptions.KNKeyValueObservingOptionNew |
KNKeyValueObservingOptions.KNKeyValueObservingOptionOld,
null);
}
开发者ID:iKenndac,项目名称:KNControlsWPF,代码行数:32,代码来源:KNTabView.cs
示例18: OnElementChanged
protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
{
base.OnElementChanged(e);
if (e.OldElement == null)
{
var nativePhoneTextBox = (PhoneTextBox)Control.Children[0];
//var nativePasswordBox = (PhoneTextBox)Control.Children[1];
nativePhoneTextBox.Background = new SolidColorBrush(Colors.Yellow);
nativePhoneTextBox.BorderBrush = new SolidColorBrush(Colors.Transparent);
nativePhoneTextBox.Height = 100;
nativePhoneTextBox.Margin = new System.Windows.Thickness(2,-10,2,5);
nativePhoneTextBox.BorderThickness = new Thickness(0);
nativePhoneTextBox.GotFocus += GotFocusaAction;
nativePhoneTextBox.LostFocus += LostFocusAction;
var border = new Border();
border.CornerRadius = new CornerRadius(25);
border.BorderThickness = new System.Windows.Thickness(1);
border.BorderBrush = new SolidColorBrush(Colors.Brown);
border.Background = new SolidColorBrush(Colors.Yellow);
border.Margin = new System.Windows.Thickness(10);
var parent = nativePhoneTextBox.Parent as System.Windows.Controls.Grid;
if (parent != null)
{
parent.Children.Remove(nativePhoneTextBox);
parent.Children.Add(border);
border.Child = nativePhoneTextBox;
}
}
}
开发者ID:anubhavranjan,项目名称:Entry-Renderer,代码行数:32,代码来源:MyEntryRenderer.cs
示例19: BrowserMouseHelper
public BrowserMouseHelper(WebBrowser browser)
{
_browser = browser;
if (true)//browser.Source != null)
{
var border0 = VisualTreeHelper.GetChild(_browser, 0);
var border1 = VisualTreeHelper.GetChild(border0, 0);
var panZoom = VisualTreeHelper.GetChild(border1, 0);
var grid = VisualTreeHelper.GetChild(panZoom, 0);
border = VisualTreeHelper.GetChild(grid, 0) as Border;
if (border != null)
{
border.ManipulationStarted += Border_ManipulationStarted;
border.ManipulationDelta += Border_ManipulationDelta;
border.ManipulationCompleted += Border_ManipulationCompleted;
border.DoubleTap += Border_DoubleTap;
border.Hold += Border_Hold;
border.MouseLeftButtonDown += Border_MouseLeftButtonDown;
}
try
{
_browser.InvokeScript("execScript", MinifiedMouseScript);
}
catch (Exception)
{
Debug.WriteLine("BrowserHelper Failed to install mouse script in WebBrowser");
}
}
browser.Loaded += new RoutedEventHandler(browser_Loaded);
}
开发者ID:sanyaade-mobiledev,项目名称:SujiQ,代码行数:32,代码来源:BrowserMouseHelper.cs
示例20: OnApplyTemplate
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
_dragWidget = (Border)GetTemplateChild("PART_DragWidget");
if (_dragWidget != null)
{
_dragWidget.AddHandler(UIElement.MouseLeftButtonDownEvent, new MouseButtonEventHandler(HeaderLeftMouseButtonDown), true);
_dragWidget.AddHandler(UIElement.MouseLeftButtonUpEvent, new MouseButtonEventHandler(HeaderMouseLeftButtonUp), true);
_dragWidget.MouseMove += (o, e) => HeaderMouseMove(e);
}
CloseButton = (Button)GetTemplateChild("PART_CloseButton");
if (CloseButton != null)
CloseButton.Click += (o, e) => Close();
Overlay = GetTemplateChild("PART_Overlay") as Panel;
WindowRoot = GetTemplateChild("PART_WindowRoot") as Grid;
WindowRoot.RenderTransform = _moveTransform;
//TODO: move somewhere else
_parent = VisualTreeHelper.GetParent(this) as FrameworkElement;
_parent.SizeChanged += (o, ea) =>
{
Overlay.Height = ea.NewSize.Height;
Overlay.Width = ea.NewSize.Width;
};
ChangeVisualState();
}
开发者ID:DelvarWorld,项目名称:shadercomposer,代码行数:31,代码来源:ChildWindow.cs
注:本文中的System.Windows.Controls.Border类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论