本文整理汇总了C#中Window类的典型用法代码示例。如果您正苦于以下问题:C# Window类的具体用法?C# Window怎么用?C# Window使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Window类属于命名空间,在下文中一共展示了Window类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TreeViewDemo
public TreeViewDemo()
{
Application.Init ();
PopulateStore ();
Window win = new Window ("TreeView demo");
win.DeleteEvent += new DeleteEventHandler (DeleteCB);
win.SetDefaultSize (640,480);
ScrolledWindow sw = new ScrolledWindow ();
win.Add (sw);
TreeView tv = new TreeView (store);
tv.EnableSearch = true;
tv.HeadersVisible = true;
tv.HeadersClickable = true;
tv.AppendColumn ("Name", new CellRendererText (), "text", 0);
tv.AppendColumn ("Type", new CellRendererText (), "text", 1);
sw.Add (tv);
dialog.Destroy ();
dialog = null;
win.ShowAll ();
Application.Run ();
}
示例2: DropShadow
/// <summary>
/// The actual method that makes API calls to drop the shadow to the window
/// </summary>
/// <param name="window">Window to which the shadow will be applied</param>
/// <returns>True if the method succeeded, false if not</returns>
private static bool DropShadow(Window window)
{
try
{
WindowInteropHelper helper = new WindowInteropHelper(window);
int val = 2;
int ret1 = DwmSetWindowAttribute(helper.Handle, 2, ref val, 4);
if (ret1 == 0)
{
Margins m = new Margins { Bottom = 0, Left = 0, Right = 0, Top = 0 };
int ret2 = DwmExtendFrameIntoClientArea(helper.Handle, ref m);
return ret2 == 0;
}
else
{
return false;
}
}
catch (Exception ex)
{
// Probably dwmapi.dll not found (incompatible OS)
return false;
}
}
示例3: GameUpdate
private void GameUpdate(Window window)
{
if (window.IsTouching)
{
alien.position = window.TouchPosition;
if ((sprite001.position-window.TouchPosition).Length < 100)
{
window.Vibrate(1000);
}
}
else
{
window.CancelVibration();
}
alien.DrawTexture(alienTexture);
particleSystem001.Update(window);
sprite001.position.X += 10f * window.deltaTime;
sprite001.DrawSolidColor(1, 0, 0, 0.5f);
lineDrawer.Point2 = window.TouchPosition;
lineDrawer.DrawSolidColor(1f, 1f, 0f, 1f);
window.Update();
}
示例4: BusinessGraphicsForm
//static long nextTick = DateTime.Now.Ticks;
public BusinessGraphicsForm(BusinessGraphicsSourceDesign sourceDesign, Window window)
{
InitializeComponent();
if (window is ActiveWindow)
{
wnd = (ActiveWindow)window;
BackColor = wnd.BorderColorFrienly;
}
sourceDesign.Wnd = wnd;
sourceDesign.IsPlayerMode = true;
_sourceCopy = SourceDesignClone(sourceDesign);
this.sourceDesign = sourceDesign;
this.sourceDesign.InitializeChart(true);
Controls.Clear();
this.sourceDesign.AddChartToContainer(this, wnd);
FormClosing += BusinessGraphicsForm_FormClosing;
if (sourceDesign.ODBCRefreshInterval > 0)
{
int time = sourceDesign.ODBCRefreshInterval*1000;
if (((BusinessGraphicsResourceInfo) sourceDesign.ResourceDescriptor.ResourceInfo).ProviderType ==
ProviderTypeEnum.ODBC)
refreshTimer = new Timer(RefreshChart, "Timer", time, time);
}
//начал делать тут проверку, а она оказывается не нужна//
//nextTick += time;
}
示例5: IsometricCamera
public IsometricCamera(Device device, Window window)
: base(device, window)
{
base.Position = -Vector3D.UnitY;
ResetZoom();
leftDirection = Vector3D.Normalize(Vector3D.Cross(Vector3D.UnitY, -UpDirection));
}
示例6: ImproveBranchAndJump
/// <summary>
/// Improves the branch and jump.
/// </summary>
/// <param name="window">The window.</param>
/// <returns></returns>
private bool ImproveBranchAndJump(Window window)
{
if (window.Size < 3)
return false;
if (!(window.Previous.Instruction is Instructions.Jmp))
return false;
if (!(window.PreviousPrevious.Instruction is Instructions.Branch))
return false;
if (window.Previous.BasicBlock != window.PreviousPrevious.BasicBlock)
return false;
if (window.Current.BasicBlock == window.Previous.BasicBlock)
return false;
if (window.PreviousPrevious.BranchTargets[0] != window.Current.BasicBlock.Label)
return false;
Debug.Assert(window.PreviousPrevious.BranchTargets.Length == 1);
// Negate branch condition
window.PreviousPrevious.ConditionCode = GetOppositeConditionCode(window.PreviousPrevious.ConditionCode);
// Change branch target
window.PreviousPrevious.BranchTargets[0] = window.Previous.BranchTargets[0];
// Delete jump
window.DeletePrevious();
return true;
}
示例7: HelloWorld
public HelloWorld()
{
win = new Window();
win.Title = "Hello World";
win.Name = "EWL_WINDOW";
win.Class = "EWLWindow";
win.SizeRequest(200, 100);
win.DeleteEvent += winDelete;
win.Show();
lbl = new Entry();
//lbl.SetFont("/usr/share/fonts/ttf/western/Adeventure.ttf", 12);
//lbl.SetColor(255, 0 , 0 , 255);
//lbl.Style = "soft_shadow";
//lbl.SizeRequest(win.Width, win.Height);
//lbl.Disable();
lbl.ChangedEvent += new EwlEventHandler(txtChanged);
lbl.Text = "Enlightenment";
Console.WriteLine(lbl.Text);
Console.WriteLine(lbl.Text);
lbl.TabOrderPush();
win.Append(lbl);
lbl.Show();
}
示例8: Run
public void Run()
{
var capture = new VideoCapture();
capture.Set(CaptureProperty.FrameWidth, 640);
capture.Set(CaptureProperty.FrameHeight, 480);
capture.Open(-1);
if (!capture.IsOpened())
throw new Exception("capture initialization failed");
var fs = FrameSource.CreateCameraSource(-1);
var sr = SuperResolution.CreateBTVL1();
sr.SetInput(fs);
using (var normalWindow = new Window("normal"))
using (var srWindow = new Window("super resolution"))
{
var normalFrame = new Mat();
var srFrame = new Mat();
while (true)
{
capture.Read(normalFrame);
sr.NextFrame(srFrame);
if (normalFrame.Empty() || srFrame.Empty())
break;
normalWindow.ShowImage(normalFrame);
srWindow.ShowImage(srFrame);
Cv2.WaitKey(100);
}
}
}
示例9: Main9
public static int Main9 (string[] args)
{
Gtk.Application.Init ();
Window win = new Window ("Custom Widget Test");
win.DeleteEvent += new DeleteEventHandler (OnQuit);
VPaned paned = new VPaned ();
CustomWidget cw = new CustomWidget ();
cw.Label = "This one contains a button";
Button button = new Button ("Ordinary button");
cw.Add (button);
paned.Pack1 (cw, true, false);
cw = new CustomWidget ();
cw.Label = "And this one a TextView";
cw.StockId = Stock.JustifyLeft;
ScrolledWindow sw = new ScrolledWindow (null, null);
sw.ShadowType = ShadowType.In;
sw.HscrollbarPolicy = PolicyType.Automatic;
sw.VscrollbarPolicy = PolicyType.Automatic;
TextView textView = new TextView ();
sw.Add (textView);
cw.Add (sw);
paned.Pack2 (cw, true, false);
win.Add (paned);
win.ShowAll ();
Gtk.Application.Run ();
return 0;
}
示例10: Initialize
public override void Initialize () {
window = new Window(this);
window.IsToolTip = false;
window.FontFamily = this.FontFamily;
window.BorderThickness = new Thickness (0);
window.BorderBrush = Brushes.Transparent;
window.Background = Brushes.Transparent;//new SolidColorBrush(new System.Windows.Media.Color ( .2f, .2f, .2f ) * .9f); // new SolidColorBrush(/*new System.Windows.Media.Color ( .8f, .8f, .8f )*/ Colors.CornflowerBlue );
window.Left = (int)this.GetAbsoluteLeft() + this.ActualWidth + 2;
window.Top = (int)this.GetAbsoluteTop() + this.ActualHeight / 2f - this.ItemsPanel.ActualHeight / 2f;
window.Width = this.ItemsPanel.ActualWidth;
window.Height = this.ItemsPanel.ActualHeight;
window.LostFocus += delegate {
this.IsChecked = false;
};
this.ItemsPanel.BorderBrush = null;
this.ItemsPanel.BorderThickness = new Thickness();
this.ItemsPanel.Background = new SolidColorBrush(new System.Windows.Media.Color ( .5f, .5f, .5f ) * .95f );
this.ItemsPanel.Parent = window;
window.Content = this.ItemsPanel;
foreach (var item in items) {
this.ItemsPanel.Children.Add(item);
}
base.Initialize();
}
示例11: Main
public static void Main()
{
BusG.Init ();
Application.Init ();
tv = new TextView ();
ScrolledWindow sw = new ScrolledWindow ();
sw.Add (tv);
Button btn = new Button ("Click me");
btn.Clicked += OnClick;
Button btnq = new Button ("Click me (thread)");
btnq.Clicked += OnClickQuit;
VBox vb = new VBox (false, 2);
vb.PackStart (sw, true, true, 0);
vb.PackStart (btn, false, true, 0);
vb.PackStart (btnq, false, true, 0);
Window win = new Window ("D-Bus#");
win.SetDefaultSize (640, 480);
win.Add (vb);
win.Destroyed += delegate {Application.Quit ();};
win.ShowAll ();
bus = Bus.Session.GetObject<IBus> ("org.freedesktop.DBus", new ObjectPath ("/org/freedesktop/DBus"));
Application.Run ();
}
示例12: MainWindow
public MainWindow()
{
this.InitializeComponent();
this.addingWordWindow = new AddingWindow();
factory = TranslationObjectsFactory.GetFactoryInstance();
this.LoadItemsToList();
}
示例13: ConvertToBitmapSource
public ConvertToBitmapSource()
{
BitmapSource bs = null;
// OpenCVによる画像処理 (Threshold)
using (IplImage src = new IplImage(Const.ImageLenna, LoadMode.GrayScale))
using (IplImage dst = new IplImage(src.Size, BitDepth.U8, 1))
{
src.Smooth(src, SmoothType.Gaussian, 5);
src.Threshold(dst, 0, 255, ThresholdType.Otsu);
// IplImage -> BitmapSource
bs = dst.ToBitmapSource();
//bs = BitmapSourceConverter.ToBitmapSource(dst);
}
// WPFのWindowに表示してみる
Image image = new Image { Source = bs };
Window window = new Window
{
Title = "from IplImage to BitmapSource",
Width = bs.PixelWidth,
Height = bs.PixelHeight,
Content = image
};
Application app = new Application();
app.Run(window);
}
示例14: Get
public Window Get(FlowWindow window) {
Window result = null;
this.list.RemoveAll((info) => {
var w = Flow.FlowSystem.GetWindow(info.id);
return w == null || w.IsSocial() == false;
});
if (window.IsSocial() == false) return result;
foreach (var item in this.list) {
if (item.id == window.id) {
result = item;
break;
}
}
if (result == null) {
result = new Window(window);
this.list.Add(result);
}
return result;
}
示例15: FindWindow
public override Window.WindowItemBase FindWindow(Window.SearchCriteria criteria)
{
Window.WindowItemBase found = null;
if (criteria.IsEmpty)
return found;
if (!string.IsNullOrEmpty(criteria.ClassName) && !criteria.HasExcludes && !criteria.HasID && string.IsNullOrEmpty(criteria.Text))
found = new WindowItem(WindowsAPI.FindWindow(criteria.ClassName, criteria.Title));
else
{
foreach (var window in AllWindows)
{
if (window.Equals(criteria))
{
found = window;
break;
}
}
}
if (found != null && found.IsSpecified)
LastFound = found;
return found;
}