Beispiel #1
1
        public void ApplyFormSize(Form form)
        {
            var size = new Size(Width, Height);

            if (Screen.PrimaryScreen.WorkingArea.Height < size.Height)
            {
                size.Height = Screen.PrimaryScreen.WorkingArea.Height;
            }

            if (Screen.PrimaryScreen.WorkingArea.Width < size.Width)
            {
                size.Width = Screen.PrimaryScreen.WorkingArea.Width;
            }

            if (form.MinimumSize.Width > size.Width)
            {
                size.Width = form.MinimumSize.Width;
            }

            if (form.MinimumSize.Height > size.Height)
            {
                size.Height = form.MinimumSize.Height;
            }

            if (size.Height != 0)
            {
                form.Size = size;
                form.Top = (Screen.PrimaryScreen.WorkingArea.Height - size.Height) / 2;
                form.Left = (Screen.PrimaryScreen.WorkingArea.Width - size.Width) / 2;
            }
        }
	private static readonly int dividerHeight = 2; // yet another guess



	// Constructor
	public ToolBar() : base()
	{
		base.Dock = DockStyle.Top;
		base.TabStop = false;
		buttons = new ToolBarButtonCollection(this);
		staticSize = DefaultSize;
	}
Beispiel #3
1
 /// <summary>
 /// Applies an affine transformation to an image.
 /// </summary>
 /// <param name="src">Source image</param>
 /// <param name="dst">Destination image</param>
 /// <param name="mapMatrix">2x3 transformation matrix</param>
 /// <param name="dsize">Size of the output image.</param>
 /// <param name="interpMethod">Interpolation method</param>
 /// <param name="warpMethod">Warp method</param>
 /// <param name="borderMode">Pixel extrapolation method</param>
 /// <param name="borderValue">A value used to fill outliers</param>
 public static void WarpAffine(IInputArray src, IOutputArray dst, IInputArray mapMatrix, Size dsize, CvEnum.Inter interpMethod = CvEnum.Inter.Linear, CvEnum.Warp warpMethod = CvEnum.Warp.Default, CvEnum.BorderType borderMode = CvEnum.BorderType.Constant, MCvScalar borderValue = new MCvScalar())
 {
    using (InputArray iaSrc = src.GetInputArray())
    using (OutputArray oaDst = dst.GetOutputArray())
    using (InputArray iaMapMatrix = mapMatrix.GetInputArray())
       cveWarpAffine(iaSrc, oaDst, iaMapMatrix, ref dsize, (int)interpMethod | (int)warpMethod, borderMode, ref borderValue);
 }
Beispiel #4
1
        private void butFind_Click(object sender, EventArgs e)
        {
            Size = new Size(550, 500);
            string sql = String.Format( "from ForlabSite s where s.SiteName like '{0}%'", txtSitename.Text.Trim());

            if (rdbRegion.Checked)
            {
                if (lsvRegion.CheckedItems.Count > 0)
                {
                    string str = "";
                    foreach (ListViewItem li in lsvRegion.CheckedItems)
                    {
                        if (str != "")
                            str += ", " + (int)li.Tag;
                        else
                            str = li.Tag.ToString();
                    }

                    sql += " and s.Region.Id in (" + str + ")";
                }
            }
            else if (txtSitename.Text.Trim() == "")
            {
                sql = String.Format("from ForlabSite s");
            }

            BindSites(sql);
        }
Beispiel #5
1
        public virtual Size GetCharacterSize( Graphics g, Font font, CharacterCasing casing )
        {
            const int MeasureCharCount = 10;

             Size charSize = new Size( 0, 0 );

             for ( char c = '0'; c <= '9'; ++c )
             {
            Size newSize = TextRenderer.MeasureText( g, new string( c, MeasureCharCount ), font, new Size( 0, 0 ),
               _textFormatFlags );

            newSize.Width = (int)Math.Ceiling( (double)newSize.Width / (double)MeasureCharCount );

            if ( newSize.Width > charSize.Width )
            {
               charSize.Width = newSize.Width;
            }

            if ( newSize.Height > charSize.Height )
            {
               charSize.Height = newSize.Height;
            }
             }

             return charSize;
        }
Beispiel #6
1
 /// <summary>
 ///    <para>
 ///       Initializes a new instance of the Rectangle class with the specified location
 ///       and size.
 ///    </para>
 /// </summary>
 public Rectangle(Point location, Size size)
 {
     _x = location.X;
     _y = location.Y;
     _width = size.Width;
     _height = size.Height;
 }
Beispiel #7
1
        public TileCanvas(TileLayer tileLayer)
        {
            TileLayer = tileLayer;

            //Init the textures array
            Size texSize = new Size(MAX_TEXTURE_SIZE - (MAX_TEXTURE_SIZE % TileLayer.Definition.Grid.Width), MAX_TEXTURE_SIZE - (MAX_TEXTURE_SIZE % TileLayer.Definition.Grid.Height));

            Size maxSize = new Size(TileLayer.Definition.Grid.Width * TileLayer.TileCellsX, TileLayer.Definition.Grid.Height * TileLayer.TileCellsY);

            // TODO: Clip the dimensions of the tiles that draw over the edges of the level.
            Textures = new List<TextureInfo>();
            for (int i = 0; i < maxSize.Width; i += texSize.Width)
            {
                for (int j = 0; j < maxSize.Height; j += texSize.Height)
                {
                    RenderTarget2D tex = new RenderTarget2D(
                        Ogmo.EditorDraw.GraphicsDevice,
                        Math.Min(maxSize.Width - i, texSize.Width),
                        Math.Min(maxSize.Height - j, texSize.Height));
                    Textures.Add(new TextureInfo(tex, new Point(i, j)));
                }
            }

            RefreshAll();
        }
 public static System.Drawing.Image NewResizeImage(System.Drawing.Image image, Size size, bool preserveAspectRatio = true)
 {
     int newWidth;
     int newHeight;
     if (preserveAspectRatio)
     {
         int originalWidth = image.Width;
         int originalHeight = image.Height;
         float percentWidth = (float)size.Width / (float)originalWidth;
         float percentHeight = (float)size.Height / (float)originalHeight;
         float percent = percentHeight < percentWidth ? percentHeight : percentWidth;
         newWidth = (int)(originalWidth * percent);
         newHeight = (int)(originalHeight * percent);
     }
     else
     {
         newWidth = size.Width;
         newHeight = size.Height;
     }
     System.Drawing.Image newImage = new Bitmap(newWidth, newHeight);
     using (Graphics graphics = Graphics.FromImage(newImage))
     {
         graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
         graphics.DrawImage(image, 0, 0, newWidth, newHeight);
     }
     return newImage;
 }
Beispiel #9
1
 public Thumbnails()
 {
     SingleImage = new Size(64, 64);
     ColumnCount = 3;
     Padding = 0;
     BackGroundColor = Color.Red;
 }
Beispiel #10
1
        public override SizeF Measure(Graphics graphics)
		{
			if (this.Image != null)
			{
				SizeF size = new Size(GraphConstants.MinimumItemWidth, GraphConstants.MinimumItemHeight);

				if (this.Width.HasValue)
					size.Width = Math.Max(size.Width, this.Width.Value);
				else
					size.Width = Math.Max(size.Width, this.Image.Width);

				if (this.Height.HasValue)
					size.Height = Math.Max(size.Height, this.Height.Value);
				else
					size.Height = Math.Max(size.Height, this.Image.Height);
				
				return size;
			} else
			{
				var size = new SizeF(GraphConstants.MinimumItemWidth, GraphConstants.MinimumItemHeight);
				if (this.Width.HasValue)
					size.Width = Math.Max(size.Width, this.Width.Value);

				if (this.Height.HasValue)
					size.Height = Math.Max(size.Height, this.Height.Value);
				
				return size;
			}
		}
Beispiel #11
1
        public static void AddTag2(Graphics g, int x_pos, int y_pos, Size Canvas)
        {
            int x_scale = Canvas.Width / x_number_of_datapoints;
            int y_scale = Canvas.Height / y_number_of_datapoints;

            g.FillEllipse(tag2, (x_scale * x_pos) - diamater / 2, (y_pos * y_scale) - diamater / 2, diamater, diamater);
        }
Beispiel #12
1
        public FormSwitcher()
        {
            InitializeComponent();

            var winVer = FileVersionInfo.GetVersionInfo(Environment.GetEnvironmentVariable("windir") + "\\explorer.exe");
            IsWin10 = winVer.ProductMajorPart == 10;
            if (IsWin10)
                FormBorderStyle = FormBorderStyle.FixedToolWindow;
            SetWindowTheme(listDevices.Handle, "explorer", null);

            ledLeft.OldStyle = Program.settings.ColorVU;
            ledLeft.SetValue((float)0.1);
            ledRight.OldStyle = Program.settings.ColorVU;
            ledRight.SetValue((float)0.1);

            using (var gr = CreateGraphics())
                DpiFactor = gr.DpiX / 96;
            var tile = new Size(listDevices.ClientSize.Width + 2, (int)(listDevices.TileSize.Height * DpiFactor));

            DeviceIcons.InitImageLists(DpiFactor);

            listDevices.TileSize = tile;
            listDevices.Scroll += VolBar.DoScroll;
            ledLeft.DoScroll += VolBar.DoScroll;
            ledRight.DoScroll += VolBar.DoScroll;
            listDevices.LargeImageList = DeviceIcons.ActiveIcons;

            if (DpiFactor <= 1)
            {
                DefaultTrayIcons.Add(getIcon(Resources.mute));
                DefaultTrayIcons.Add(getIcon(Resources.zero));
                DefaultTrayIcons.Add(getIcon(Resources._1_33));
                DefaultTrayIcons.Add(getIcon(Resources._33_66));
                DefaultTrayIcons.Add(getIcon(Resources._66_100));
            }
            else
            {
                DefaultTrayIcons.Add(getIcon(Resources.mute_highDPI));
                DefaultTrayIcons.Add(getIcon(Resources.zero_highDPI));
                DefaultTrayIcons.Add(getIcon(Resources._1_33_highDPI));
                DefaultTrayIcons.Add(getIcon(Resources._33_66_highDPI));
                DefaultTrayIcons.Add(getIcon(Resources._66_100_highDPI));
            }

            RenderType = Program.settings.DefaultDataFlow;
            RefreshDevices(RenderType);
            SetTrayIcons();

            VolBar.VolumeMuteChanged += IconChanged;
            VolBar.RegisterDevice(RenderType);
            EndPoints.NotifyClient.DefaultChanged += DefaultChanged;
            EndPoints.NotifyClient.DeviceAdded += DeviceAdded;
            EndPoints.NotifyClient.DeviceRemoved += DeviceRemoved;

            GlobalHotkeys.Handle = Handle;
            GlobalHotkeys.RegisterAll();

            ScrollVolume.VolumeScroll += ScrollTheVolume;
            ScrollVolume.RegisterVolScroll(Program.settings.VolumeScroll.Enabled);
        }
Beispiel #13
1
 // -----------------------
 // Public Constructors
 // -----------------------
 /// <summary>
 ///	Rectangle Constructor
 /// </summary>
 ///
 /// <remarks>
 ///	Creates a Rectangle from Point and Size values.
 /// </remarks>
 public Rectangle(Point location, Size size)
 {
     x = location.X;
     y = location.Y;
     width = size.Width;
     height = size.Height;
 }
        public unsafe Point GetNextPoint(Rectangle rectTrack, byte* pIn, Size sizeIn, double[] Qu, double[] PuY0)
        {
            double[] w = new double[256];//方向权值
            for (int i = 0; i < 256; i++)
            {
                w[i] = Math.Sqrt(Qu[i] / PuY0[i]);
            }

            PointF center = new PointF(
                (float)rectTrack.Left + (float)rectTrack.Width / 2,
                (float)rectTrack.Top + (float)rectTrack.Height / 2);
            SizeF H = new SizeF((float)rectTrack.Width / 2, (float)rectTrack.Height / 2);
            double numeratorX = 0, numeratorY = 0;//分子
            double denominatorX = 0, denominatorY = 0;//分母
            for (int y = rectTrack.Top; y < rectTrack.Bottom; y++)
            {
                for (int x = rectTrack.Left; x < rectTrack.Right; x++)
                {
                    int index = DataManager.GetIndex(x, y, sizeIn.Width);
                    byte u = pIn[index];
                    //计算以高斯分布为核函数自变量X的值
                    double X = ((Math.Pow((x - center.X), 2) + Math.Pow((y - center.Y), 2))
                            / (Math.Pow(H.Width, 2) + Math.Pow(H.Height, 2)));
                    //负的高斯分布核函数的值
                    double Gi = -Math.Exp(-Math.Pow(X, 2) / 2) / Math.Sqrt(2 * Math.PI);

                    numeratorX += x * w[u] * Gi;
                    numeratorY += y * w[u] * Gi;
                    denominatorX += w[u] * Gi;
                    denominatorY += w[u] * Gi;
                }
            }
            return new Point((int)(numeratorX / denominatorX), (int)(numeratorY / denominatorY));
        }
Beispiel #15
1
        public static void Resize(this Image source, String newFilename, Size newSize, long quality, ContentAlignment contentAlignment, ThumbMode mode)
        {
            Image image = source.Resize(newSize, quality, contentAlignment, mode);

            using (EncoderParameters encoderParams = new EncoderParameters(1))
            {
                using (EncoderParameter parameter = (encoderParams.Param[0] = new EncoderParameter(Encoder.Quality, quality)))
                {
                    ImageCodecInfo encoder = null;
                    //取得擴展名
                    string ext = Path.GetExtension(newFilename);
                    if (string.IsNullOrEmpty(ext))
                        ext = ".jpg";
                    //根據擴展名得到解碼、編碼器
                    foreach (ImageCodecInfo codecInfo in ImageCodecInfo.GetImageEncoders())
                    {
                        if (Regex.IsMatch(codecInfo.FilenameExtension, string.Format(@"(;|^)\*\{0}(;|$)", ext), RegexOptions.IgnoreCase))
                        {
                            encoder = codecInfo;
                            break;
                        }
                    }

                    DirectoryInfo dir = new DirectoryInfo(Path.GetDirectoryName(newFilename));
                    if(dir.Exists == false) dir.Create();
                    image.Save(newFilename, encoder, encoderParams);
                }
            }
        }
Beispiel #16
1
 /// <summary>
 /// Initializes a new instance of the <see cref="ResizeLayer"/> class.
 /// </summary>
 /// <param name="size">
 /// The <see cref="T:System.Drawing.Size"/> containing the width and height to set the image to.
 /// </param>
 /// <param name="anchorPosition">
 /// The <see cref="AnchorPosition"/> to apply to resized image.
 /// </param>
 public ResizeLayer(Size size, AnchorPosition anchorPosition)
 {
     this.Size = size;
     this.AnchorPosition = anchorPosition;
     this.ResizeMode = ResizeMode.Pad;
     this.BackgroundColor = Color.Transparent;
 }
Beispiel #17
1
 public OSMThumbnailInfo(double latitude, double longitude, int zoom, Size thumbSize)
 {
     this.Latitude = latitude;
     this.Longitude = longitude;
     this.Zoom = zoom;
     this.ThumbnailSize = thumbSize;
 }
Beispiel #18
1
 /// <summary>
 /// Initializes a new instance of the <see cref="ResizeLayer"/> class.
 /// </summary>
 /// <param name="size">
 /// The <see cref="T:System.Drawing.Size"/> containing the width and height to set the image to.
 /// </param>
 /// <param name="resizeMode">
 /// The <see cref="ResizeMode"/> to apply to resized image.
 /// </param>
 public ResizeLayer(Size size, ResizeMode resizeMode)
 {
     this.Size = size;
     this.ResizeMode = resizeMode;
     this.AnchorPosition = AnchorPosition.Center;
     this.BackgroundColor = Color.Transparent;
 }
		/// <summary>
		/// Initializes a new instance of the FullScreenCapableWindow
		/// </summary>
		public FullScreenCapableWindow()
		{
			this.InitializeComponent();

			_size = this.Size;
			_location = this.Location;
		}
Beispiel #20
1
 static void Main(string[] args)
 {
     var image = Image.FromFile("source.jpg");
     var size = new Size(100, 150);
     var resized = ResizeImage(image, size);
     resized.Save("resized.jpg", ImageFormat.Jpeg);
 }
Beispiel #21
1
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="point">Center</param>
 /// <param name="size">Width and height of ellipse</param>
 public Ellipse(Point point, Size size)
 {
     this.x = (short)point.X;
     this.y = (short)point.Y;
     this.radiusX = (short)size.Width;
     this.radiusY = (short)size.Height;
 }
Beispiel #22
1
 public FIARECT(Point location, Size size)
 {
     this.left = location.X;
     this.top = location.Y;
     this.right = this.left + size.Width - 1;
     this.bottom = this.top + size.Height - 1;
 }
		public void SetUpFixture()
		{
			WixDocument doc = new WixDocument();
			doc.LoadXml(GetWixXml());
			controlsAddedCount = 0;
			CreatedComponents.Clear();
			WixDialog wixDialog = doc.CreateWixDialog("WelcomeDialog", new MockTextFileReader());
			using (Form dialog = wixDialog.CreateDialog(this)) {
				foreach (Control control in dialog.Controls) {
					++controlsAddedCount;
				}
				Button nextButton = (Button)dialog.Controls[0];
				nextButtonName = nextButton.Name;
				nextButtonLocation = nextButton.Location;
				nextButtonSize = nextButton.Size;
				nextButtonText = nextButton.Text;
				
				dialogAcceptButtonName = ((Button)dialog.AcceptButton).Name;
				
				Button cancelButton = (Button)dialog.Controls[1];
				cancelButtonName = cancelButton.Name;
				
				dialogCancelButtonName = ((Button)dialog.CancelButton).Name;
			}
		}
        public Editor()
        {
            InitializeComponent();

            Size pbLevelSize = new Size(Constants.WINDOW_WIDTH, Constants.WINDOW_HEIGHT - Constants.HUD_HEIGHT);

            pb_Level.MaximumSize = (pb_Level.MinimumSize = (pb_Level.Size = pbLevelSize));
            this.FormBorderStyle = FormBorderStyle.FixedSingle;

            currentTool = EditorTool.Insertion;
            ClearToolMenu();
            tool_Insertion.Checked = true;

            // Disable object properties by default
            tb_Damage.Enabled = false;
            tb_Rotation.Enabled = false;
            b_ApplyProperties.Enabled = false;
            b_Front.Enabled = false;
            tb_SLevel.Enabled = false;

            //Only enable this menu item if the currently selected object is a door. When we start,
            // we don't have a currently selected item, so disable this menu item.
            menu_door.Enabled = false;
            menu_room.Enabled = false;
            menu_debug.Enabled = false;
        }
Beispiel #25
0
 public AnnotationForm()
 {
     InitializeComponent();
     // screen size
     Size screenSize = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
     // get screen cap
     Bitmap bmp = new Bitmap(screenSize.Width, screenSize.Height);
     Graphics g = Graphics.FromImage(bmp);
     g.CopyFromScreen(0, 0, 0, 0, screenSize);
     g.Dispose();
     // create dv & de
     dv = new WFViewer(wfViewerControl1);
     dv.Preview = true;
     dv.EditFigures = true;
     dv.AntiAlias = true;
     de = new DEngine(null);
     de.AddedFigure += new AddedFigureHandler(de_AddedFigure);
     de.AddViewer(dv);
     WorkBookUtils.SetupDEngine(de);
     // setup undo/redo sensitive stuff
     de.UndoRedo.Start("initial setup");
     de.PageSize = new DPoint(screenSize.Width, screenSize.Height);
     BackgroundFigure bf = new BackgroundFigure(); // background figure
     bf.ImageData = WFHelper.ToImageData(bmp);
     bf.FileName = "screen_capture.png";
     bf.BitmapPosition = DBitmapPosition.Normal;
     de.SetBackgroundFigure(bf, true);
     de.UndoRedo.Commit();
     de.UndoRedo.ClearHistory();
     // set form to full screen
     Location = new Point(0, 0);
     Size = screenSize;
 }
Beispiel #26
0
        /// <summary>
        /// Launch the Lean Engine Primary Form:
        /// </summary>
        /// <param name="engine">Accept the engine instance we just launched</param>
        public LeanEngineWinForm(Engine engine)
        {
            _engine = engine;
            //Setup the State:
            _resultsHandler = engine.AlgorithmHandlers.Results;

            //Create Form:
            Text = "QuantConnect Lean Algorithmic Trading Engine: v" + Constants.Version;
            Size = new Size(1024,768);
            MinimumSize = new Size(1024, 768);
            CenterToScreen();
            WindowState = FormWindowState.Maximized;
            Icon = new Icon("../../../lean.ico");

            //Setup Console Log Area:
            _console = new RichTextBox();
            _console.Parent = this;
            _console.ReadOnly = true;
            _console.Multiline = true;
            _console.Location = new Point(0, 0);
            _console.Dock = DockStyle.Fill;
            _console.KeyUp += ConsoleOnKeyUp;
            
            //Form Events:
            Closed += OnClosed;

            //Setup Polling Events:
            _polling = new Timer();
            _polling.Interval = 1000;
            _polling.Tick += PollingOnTick;
            _polling.Start();
        }
Beispiel #27
0
        public MarkerBuilder Icon(string path, Size size)
        {
            Point point = new Point(0,0);
            Point anchor = new Point(size.Width/2, size.Height);

            return Icon(path, size, point, anchor);
        }
Beispiel #28
0
		public InspectorGrid()
		{
			DoubleBuffered = true;
			AllowUserToAddRows = false;
			AllowUserToDeleteRows = false;
			MultiSelect = false;
			ReadOnly = false;
			SelectionMode = DataGridViewSelectionMode.FullRowSelect;
			RowHeadersVisible = false;
			// TODO-Linux: VirtualMode is not supported on Mono.
			VirtualMode = true;
			AllowUserToResizeRows = false;
			Font = SystemFonts.MenuFont;
			DefaultCellStyle.ForeColor = SystemColors.WindowText;
			GridColor = DefaultCellStyle.BackColor;
			m_clrGrid = Color.FromArgb(40, ForeColor);
			m_clrShading = CalculateColor(DefaultCellStyle.ForeColor,
				DefaultCellStyle.BackColor, 25);

			m_list = new GenericInspectorObjectList();

			using (Image img = Properties.Resources.kimidExpand)
			{
				m_szHotSpot = new Size(img.Width, img.Height);
				m_dxVLine = (int)(m_szHotSpot.Width * 1.5);
			}
		}
Beispiel #29
0
        internal AutocompleteListView(FastColoredTextBox tb)
        {
            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint, true);
            base.Font = new Font(FontFamily.GenericSansSerif, 9);
            visibleItems = new List<AutocompleteItem>();
            itemHeight = Font.Height + 2;
            VerticalScroll.SmallChange = itemHeight;
            BackColor = Color.White;
            MaximumSize = new Size(Size.Width, 180);
            toolTip.ShowAlways = false;
            AppearInterval = 500;
            timer.Tick += new EventHandler(timer_Tick);

            this.tb = tb;

            tb.KeyDown += new KeyEventHandler(tb_KeyDown);
            tb.SelectionChanged += new EventHandler(tb_SelectionChanged);
            tb.KeyPressed += new KeyPressEventHandler(tb_KeyPressed);

            Form form = tb.FindForm();
            if (form != null)
            {
                form.LocationChanged += (o, e) => Menu.Close();
                form.ResizeBegin += (o, e) => Menu.Close();
                form.FormClosing += (o, e) => Menu.Close();
                form.LostFocus += (o, e) => Menu.Close();
            }

            tb.LostFocus += (o, e) =>
            {
                if (!Menu.Focused) Menu.Close();
            };
            tb.Scroll += (o, e) => Menu.Close();
        }
Beispiel #30
0
        public MainForm()
        {
            BackColor = SystemColors.ControlLightLight;
            DoubleBuffered = true;
            Icon = Resources.Traffic_Simulation_Logo;
            simulationid = 0;
            Size = new Size(Screen.PrimaryScreen.Bounds.Width/2, Screen.PrimaryScreen.Bounds.Height/2);
            ShowIcon = true;
            WindowState = FormWindowState.Maximized;

            FormClosing += formclosing;
            SimulationCreated += simulationcreated;
            SimulationNullified += simulationnullified;
            SizeChanged += sizechanged;

            Randomizer.Initialize();

            makemenus();
            makepanels();

            simulationnullified(null, EventArgs.Empty);
            sizechanged(null, EventArgs.Empty);

            ExtendedStatusStrip.UpdateStatus("Loading finished.");
        }
Beispiel #31
0
        private void Init()
        {
            if (s_schemaLoader == null)
            {
                s_schemaLoader = new SchemaLoader();
            }
            m_PropertyGrid = new PropertyGrid(PropertyGridMode.PropertySorting | PropertyGridMode.DisplayDescriptions | PropertyGridMode.HideResetAllButton);
            m_treeControl  = new TreeControl();
            m_menu         = new MenuStrip();
            var fileMenu = new ToolStripMenuItem();
            var newMenu  = new ToolStripMenuItem();
            var openMenu = new ToolStripMenuItem();

            var exitMenu = new ToolStripMenuItem();
            var splitter = new SplitContainer();

            m_menu.SuspendLayout();
            splitter.BeginInit();
            splitter.Panel1.SuspendLayout();
            splitter.Panel2.SuspendLayout();
            splitter.SuspendLayout();

            SuspendLayout();

            // m_menu
            m_menu.Location = new System.Drawing.Point(0, 0);
            m_menu.Name     = "m_menu";
            m_menu.TabIndex = 0;
            m_menu.Text     = "m_menu";
            m_menu.Items.Add(fileMenu);


            // file
            fileMenu.Name             = "fileToolStripMenuItem";
            fileMenu.Size             = new System.Drawing.Size(37, 20);
            fileMenu.Text             = "File".Localize();
            fileMenu.DropDownOpening += fileMenu_DropDownOpening;
            fileMenu.DropDownItems.AddRange(new ToolStripItem[]
            {
                newMenu,
                openMenu,
                m_openFolderMenu,
                m_saveMenu,
                m_saveAsMenu,
                exitMenu
            });

            // new
            newMenu.Name         = "newToolStripMenuItem";
            newMenu.ShortcutKeys = Keys.Control | Keys.N;
            newMenu.Text         = "New".Localize();
            newMenu.Click       += NewToolStripMenuItem_Click;

            //open
            openMenu.Name         = "openToolStripMenuItem";
            openMenu.ShortcutKeys = Keys.Control | Keys.O;
            openMenu.Text         = "Open...".Localize();
            openMenu.Click       += OpenToolStripMenuItem_Click;


            // open containing folder
            m_openFolderMenu.Name   = "OpenFolderMenu";
            m_openFolderMenu.Text   = "Open Containing Folder".Localize();
            m_openFolderMenu.Click += OpenFolderMenu_Click;

            //save
            m_saveMenu.Name         = "saveToolStripMenuItem";
            m_saveMenu.ShortcutKeys = Keys.Control | Keys.S;
            m_saveMenu.Text         = "Save".Localize();
            m_saveMenu.Click       += SaveToolStripMenuItem_Click;

            // save as
            m_saveAsMenu.Name   = "saveAsToolStripMenuItem";
            m_saveAsMenu.Text   = "Save As...".Localize();
            m_saveAsMenu.Click += SaveAsToolStripMenuItem_Click;

            // exit
            exitMenu.Name   = "exitToolStripMenuItem";
            exitMenu.Text   = "Exit".Localize();
            exitMenu.Click += ExitToolStripMenuItem_Click;

            // tree control
            m_treeControl.Dock          = DockStyle.Fill;
            m_treeControl.Name          = "m_treeControl";
            m_treeControl.TabIndex      = 1;
            m_treeControl.Width         = 150;
            m_treeControl.ShowRoot      = false;
            m_treeControl.AllowDrop     = false;
            m_treeControl.SelectionMode = SelectionMode.One;
            m_treeControlAdapter        = new TreeControlAdapter(m_treeControl);

            // propertyGrid1
            m_PropertyGrid.Dock            = DockStyle.Fill;
            m_PropertyGrid.Name            = "propertyGrid1";
            m_PropertyGrid.TabIndex        = 3;
            m_PropertyGrid.PropertySorting = PropertySorting.None;

            // splitter
            splitter.Dock = DockStyle.Fill;
            splitter.Name = "splitContainer1";
            splitter.Panel1.Controls.Add(m_treeControl);
            splitter.Panel2.Controls.Add(m_PropertyGrid);
            splitter.SplitterDistance = 100;
            splitter.TabIndex         = 1;

            AutoScaleMode = AutoScaleMode.Font;
            ClientSize    = new System.Drawing.Size(600, 400);
            Controls.Add(splitter);
            Controls.Add(m_menu);
            MainMenuStrip = m_menu;
            Name          = "SkinEditor";
            Icon          = GdiUtil.CreateIcon(ResourceUtil.GetImage(Sce.Atf.Resources.AtfIconImage));
            UpdateTitleText();
            m_menu.ResumeLayout(false);
            m_menu.PerformLayout();
            splitter.Panel1.ResumeLayout(false);
            splitter.Panel2.ResumeLayout(false);
            splitter.EndInit();
            splitter.ResumeLayout(false);

            ResumeLayout(false);
            PerformLayout();
            splitter.SplitterDistance = 170;
        }
Beispiel #32
0
        private void InitializeComponent()
        {
            this.components = new Container();
            ResourceManager manager = new ResourceManager(typeof(DDKOLONAIDDFormUserControl));

            this.contextMenu1             = new ContextMenu();
            this.SetNullItem              = new MenuItem();
            this.toolTip1                 = new System.Windows.Forms.ToolTip(this.components);
            this.errorProvider1           = new ErrorProvider();
            this.errorProviderValidator1  = new ErrorProviderValidator(this.components);
            this.bindingSourceDDKOLONAIDD = new BindingSource(this.components);
            ((ISupportInitialize)this.bindingSourceDDKOLONAIDD).BeginInit();
            this.layoutManagerformDDKOLONAIDD = new TableLayoutPanel();
            this.layoutManagerformDDKOLONAIDD.SuspendLayout();
            this.layoutManagerformDDKOLONAIDD.AutoSize     = true;
            this.layoutManagerformDDKOLONAIDD.Dock         = DockStyle.Fill;
            this.layoutManagerformDDKOLONAIDD.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            this.layoutManagerformDDKOLONAIDD.AutoScroll   = false;
            System.Drawing.Point point = new System.Drawing.Point(0, 0);
            this.layoutManagerformDDKOLONAIDD.Location = point;
            Size size = new System.Drawing.Size(0, 0);

            this.layoutManagerformDDKOLONAIDD.Size        = size;
            this.layoutManagerformDDKOLONAIDD.ColumnCount = 2;
            this.layoutManagerformDDKOLONAIDD.RowCount    = 3;
            this.layoutManagerformDDKOLONAIDD.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
            this.layoutManagerformDDKOLONAIDD.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
            this.layoutManagerformDDKOLONAIDD.RowStyles.Add(new RowStyle());
            this.layoutManagerformDDKOLONAIDD.RowStyles.Add(new RowStyle());
            this.layoutManagerformDDKOLONAIDD.RowStyles.Add(new RowStyle());
            this.label1IDKOLONAIDD    = new UltraLabel();
            this.textIDKOLONAIDD      = new UltraNumericEditor();
            this.label1NAZIVKOLONAIDD = new UltraLabel();
            this.textNAZIVKOLONAIDD   = new UltraTextEditor();
            ((ISupportInitialize)this.textIDKOLONAIDD).BeginInit();
            ((ISupportInitialize)this.textNAZIVKOLONAIDD).BeginInit();
            this.dsDDKOLONAIDDDataSet1 = new DDKOLONAIDDDataSet();
            this.dsDDKOLONAIDDDataSet1.BeginInit();
            this.SuspendLayout();
            this.dsDDKOLONAIDDDataSet1.DataSetName   = "dsDDKOLONAIDD";
            this.dsDDKOLONAIDDDataSet1.Locale        = new CultureInfo("hr-HR");
            this.bindingSourceDDKOLONAIDD.DataSource = this.dsDDKOLONAIDDDataSet1;
            this.bindingSourceDDKOLONAIDD.DataMember = "DDKOLONAIDD";
            ((ISupportInitialize)this.bindingSourceDDKOLONAIDD).BeginInit();
            point = new System.Drawing.Point(0, 0);
            this.label1IDKOLONAIDD.Location               = point;
            this.label1IDKOLONAIDD.Name                   = "label1IDKOLONAIDD";
            this.label1IDKOLONAIDD.TabIndex               = 1;
            this.label1IDKOLONAIDD.Tag                    = "labelIDKOLONAIDD";
            this.label1IDKOLONAIDD.Text                   = "Kolona:";
            this.label1IDKOLONAIDD.StyleSetName           = "FieldUltraLabel";
            this.label1IDKOLONAIDD.AutoSize               = true;
            this.label1IDKOLONAIDD.Anchor                 = AnchorStyles.Left;
            this.label1IDKOLONAIDD.Appearance.TextVAlign  = VAlign.Middle;
            this.label1IDKOLONAIDD.Appearance.Image       = RuntimeHelpers.GetObjectValue(manager.GetObject("pictureBoxKey.Image"));
            this.label1IDKOLONAIDD.Appearance.ImageHAlign = HAlign.Right;
            size = new System.Drawing.Size(7, 10);
            this.label1IDKOLONAIDD.ImageSize            = size;
            this.label1IDKOLONAIDD.Appearance.ForeColor = Color.Black;
            this.label1IDKOLONAIDD.BackColor            = Color.Transparent;
            this.layoutManagerformDDKOLONAIDD.Controls.Add(this.label1IDKOLONAIDD, 0, 0);
            this.layoutManagerformDDKOLONAIDD.SetColumnSpan(this.label1IDKOLONAIDD, 1);
            this.layoutManagerformDDKOLONAIDD.SetRowSpan(this.label1IDKOLONAIDD, 1);
            Padding padding = new Padding(3, 1, 5, 2);

            this.label1IDKOLONAIDD.Margin = padding;
            size = new System.Drawing.Size(0, 0);
            this.label1IDKOLONAIDD.MinimumSize = size;
            size = new System.Drawing.Size(0x3b, 0x17);
            this.label1IDKOLONAIDD.Size = size;
            point = new System.Drawing.Point(0, 0);
            this.textIDKOLONAIDD.Location    = point;
            this.textIDKOLONAIDD.Name        = "textIDKOLONAIDD";
            this.textIDKOLONAIDD.Tag         = "IDKOLONAIDD";
            this.textIDKOLONAIDD.TabIndex    = 0;
            this.textIDKOLONAIDD.Anchor      = AnchorStyles.Left;
            this.textIDKOLONAIDD.MouseEnter += new EventHandler(this.mouseEnter_Text);
            this.textIDKOLONAIDD.ReadOnly    = false;
            this.textIDKOLONAIDD.PromptChar  = ' ';
            this.textIDKOLONAIDD.Enter      += new EventHandler(this.numericEditor_Enter);
            this.textIDKOLONAIDD.DataBindings.Add(new Binding("Value", this.bindingSourceDDKOLONAIDD, "IDKOLONAIDD"));
            this.textIDKOLONAIDD.NumericType = NumericType.Integer;
            this.textIDKOLONAIDD.MaskInput   = "{LOC}-nnnnn";
            this.layoutManagerformDDKOLONAIDD.Controls.Add(this.textIDKOLONAIDD, 1, 0);
            this.layoutManagerformDDKOLONAIDD.SetColumnSpan(this.textIDKOLONAIDD, 1);
            this.layoutManagerformDDKOLONAIDD.SetRowSpan(this.textIDKOLONAIDD, 1);
            padding = new Padding(0, 1, 3, 2);
            this.textIDKOLONAIDD.Margin = padding;
            size = new System.Drawing.Size(0x33, 0x16);
            this.textIDKOLONAIDD.MinimumSize = size;
            size = new System.Drawing.Size(0x33, 0x16);
            this.textIDKOLONAIDD.Size = size;
            point = new System.Drawing.Point(0, 0);
            this.label1NAZIVKOLONAIDD.Location              = point;
            this.label1NAZIVKOLONAIDD.Name                  = "label1NAZIVKOLONAIDD";
            this.label1NAZIVKOLONAIDD.TabIndex              = 1;
            this.label1NAZIVKOLONAIDD.Tag                   = "labelNAZIVKOLONAIDD";
            this.label1NAZIVKOLONAIDD.Text                  = "Naziv kolone:";
            this.label1NAZIVKOLONAIDD.StyleSetName          = "FieldUltraLabel";
            this.label1NAZIVKOLONAIDD.AutoSize              = true;
            this.label1NAZIVKOLONAIDD.Anchor                = AnchorStyles.Left;
            this.label1NAZIVKOLONAIDD.Appearance.TextVAlign = VAlign.Middle;
            this.label1NAZIVKOLONAIDD.Appearance.ForeColor  = Color.Black;
            this.label1NAZIVKOLONAIDD.BackColor             = Color.Transparent;
            this.layoutManagerformDDKOLONAIDD.Controls.Add(this.label1NAZIVKOLONAIDD, 0, 1);
            this.layoutManagerformDDKOLONAIDD.SetColumnSpan(this.label1NAZIVKOLONAIDD, 1);
            this.layoutManagerformDDKOLONAIDD.SetRowSpan(this.label1NAZIVKOLONAIDD, 1);
            padding = new Padding(3, 1, 5, 2);
            this.label1NAZIVKOLONAIDD.Margin = padding;
            size = new System.Drawing.Size(0, 0);
            this.label1NAZIVKOLONAIDD.MinimumSize = size;
            size = new System.Drawing.Size(0x63, 0x17);
            this.label1NAZIVKOLONAIDD.Size = size;
            point = new System.Drawing.Point(0, 0);
            this.textNAZIVKOLONAIDD.Location    = point;
            this.textNAZIVKOLONAIDD.Name        = "textNAZIVKOLONAIDD";
            this.textNAZIVKOLONAIDD.Tag         = "NAZIVKOLONAIDD";
            this.textNAZIVKOLONAIDD.TabIndex    = 0;
            this.textNAZIVKOLONAIDD.Anchor      = AnchorStyles.Left;
            this.textNAZIVKOLONAIDD.MouseEnter += new EventHandler(this.mouseEnter_Text);
            this.textNAZIVKOLONAIDD.ReadOnly    = false;
            this.textNAZIVKOLONAIDD.DataBindings.Add(new Binding("Text", this.bindingSourceDDKOLONAIDD, "NAZIVKOLONAIDD"));
            this.textNAZIVKOLONAIDD.MaxLength = 50;
            this.layoutManagerformDDKOLONAIDD.Controls.Add(this.textNAZIVKOLONAIDD, 1, 1);
            this.layoutManagerformDDKOLONAIDD.SetColumnSpan(this.textNAZIVKOLONAIDD, 1);
            this.layoutManagerformDDKOLONAIDD.SetRowSpan(this.textNAZIVKOLONAIDD, 1);
            padding = new Padding(0, 1, 3, 2);
            this.textNAZIVKOLONAIDD.Margin = padding;
            size = new System.Drawing.Size(0x16e, 0x16);
            this.textNAZIVKOLONAIDD.MinimumSize = size;
            size = new System.Drawing.Size(0x16e, 0x16);
            this.textNAZIVKOLONAIDD.Size = size;
            this.Controls.Add(this.layoutManagerformDDKOLONAIDD);
            this.SetNullItem.Index   = 0;
            this.SetNullItem.Text    = "Set Null";
            this.SetNullItem.Click  += new EventHandler(this.SetNullItem_Click);
            this.contextMenu1.Popup += new EventHandler(this.contextMenu1_Popup);
            this.contextMenu1.MenuItems.AddRange(new MenuItem[] { this.SetNullItem });
            this.errorProvider1.DataSource             = this.bindingSourceDDKOLONAIDD;
            this.errorProviderValidator1.ErrorProvider = this.errorProvider1;
            this.Name       = "DDKOLONAIDDFormUserControl";
            this.Text       = "Kolona IDD obrasca";
            this.AutoSize   = true;
            this.AutoScroll = true;
            this.Load      += new EventHandler(this.DDKOLONAIDDFormUserControl_Load);
            this.layoutManagerformDDKOLONAIDD.ResumeLayout(false);
            this.layoutManagerformDDKOLONAIDD.PerformLayout();
            ((ISupportInitialize)this.bindingSourceDDKOLONAIDD).EndInit();
            ((ISupportInitialize)this.textIDKOLONAIDD).EndInit();
            ((ISupportInitialize)this.textNAZIVKOLONAIDD).EndInit();
            this.dsDDKOLONAIDDDataSet1.EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();
        }
Beispiel #33
0
        /// <summary>
        /// </summary>
        /// <param name="anchor"></param>
        /// <param name="margin"></param>
        /// <param name="size"></param>
        /// <param name="zNear"></param>
        /// <param name="zFar"></param>
        public UIColorPaletteRenderer(int maxMarkerCount,
                                      CodedColor[] codedColors,
                                      System.Windows.Forms.AnchorStyles anchor, System.Windows.Forms.Padding margin,
                                      System.Drawing.Size size, int zNear, int zFar)
            : base(anchor, margin, size, zNear, zFar)
        {
            this.maxMarkerCount      = maxMarkerCount;
            this.currentMarkersCount = maxMarkerCount;

            //// display this UI control's area.
            //this.StateList.Add(new ClearColorState());

            // color bar using texture.
            {
                var bar = new UIColorPaletteBarRenderer(
                    codedColors,
                    System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right,
                    new System.Windows.Forms.Padding(marginLeft, 1, marginRight, 0),
                    new System.Drawing.Size(size.Width - marginLeft - marginRight, size.Height / 3),
                    zNear, zFar);
                //this.StateList.Add(new ClearColorState(Color.Blue));
                this.Children.Add(bar);
                this.colorPaletteBar = bar;
            }
            // color bar using vec3 color(hidden as default state)
            // just to compare with color bar using texture.
            {
                var bar = new UIColorPaletteColoredBarRenderer(
                    maxMarkerCount, codedColors,
                    System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right,
                    new System.Windows.Forms.Padding(marginLeft, 1 + size.Height / 3, marginRight, 0),
                    new System.Drawing.Size(size.Width - marginLeft - marginRight, size.Height / 3),
                    zNear, zFar);
                //this.StateList.Add(new ClearColorState(Color.Blue));
                this.Children.Add(bar);
                this.colorPaletteBar2 = bar;
                bar.Enabled           = false;
            }
            // white vertical lines.
            {
                var markers = new UIColorPaletteMarkersRenderer(maxMarkerCount,
                                                                System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right,
                                                                new System.Windows.Forms.Padding(marginLeft, 1, marginRight, 0),
                                                                new System.Drawing.Size(size.Width - marginLeft - marginRight, size.Height / 2),
                                                                zNear, zFar);
                //markers.StateList.Add(new ClearColorState(Color.Red));
                this.Children.Add(markers);
                this.markers = markers;
            }
            // labels that display values(float values)
            {
                int length = maxMarkerCount;
                var font   = new Font("Arial", 32);
                for (int i = 0; i < length; i++)
                {
                    const int width    = 100;
                    float     distance = marginLeft;
                    distance += 2.0f * (float)i / (float)length * (float)(this.Size.Width - marginLeft - marginRight);
                    distance -= width / 2;
                    var label = new UIText(
                        System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Bottom,
                        new System.Windows.Forms.Padding((int)distance, 0, 0, 0),
                        new System.Drawing.Size(width, size.Height / 2), zNear, zFar,
                        font.GetFontBitmap("0123456789.eE+-").GetFontTexture(), 100);
                    label.Initialize();
                    //label.StateList.Add(new ClearColorState(Color.Green));
                    label.Text          = ((float)i).ToShortString();
                    label.BeforeLayout += label_beforeLayout;
                    this.Children.Add(label);
                    this.labelList.Add(label);
                }
                this.currentMarkersCount = 2;
            }
        }
Beispiel #34
0
        private void TestProj()
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            Size srSize = Size.Empty;

            Double[] lats  = null;
            Double[] longs = null;
            using (IRasterDataProvider srcPrd = GeoDataDriver.Open(@"D:\mas数据\FY3A_VIRRX_GBAL_L1_20110322_0525_1000M_MS.HDF") as IRasterDataProvider)
            {
                IBandProvider srcbandpro = srcPrd.BandProvider as IBandProvider;
                {
                    srSize = new System.Drawing.Size(srcPrd.Width, srcPrd.Height);
                    lats   = new Double[srcPrd.Width * srcPrd.Height];
                    longs  = new Double[srcPrd.Width * srcPrd.Height];
                    using (IRasterBand latBand = srcbandpro.GetBands("Latitude")[0])
                    {
                        using (IRasterBand lonsBand = srcbandpro.GetBands("Longitude")[0])
                        {
                            unsafe
                            {
                                fixed(Double *ptrLat = lats)
                                {
                                    fixed(Double *ptrLong = longs)
                                    {
                                        IntPtr bufferPtrLat  = new IntPtr(ptrLat);
                                        IntPtr bufferPtrLong = new IntPtr(ptrLong);

                                        latBand.Read(0, 0, srcPrd.Width, srcPrd.Height, bufferPtrLat, enumDataType.Double, srcPrd.Width, srcPrd.Height);
                                        lonsBand.Read(0, 0, srcPrd.Width, srcPrd.Height, bufferPtrLong, enumDataType.Double, srcPrd.Width, srcPrd.Height);
                                    }
                                }
                            }
                        }
                    }
                    stopwatch.Stop();
                    WriteLine("读取经纬度{0}ms", stopwatch.ElapsedMilliseconds);
                    stopwatch.Restart();
                    IRasterProjector     raster = new RasterProjector();
                    PrjEnvelope          destEnvelope;
                    Action <int, string> progressCallback = new Action <int, string>(OutProgress);
                    //progressCallback = null;  //测试不用进度条的情况
                    ISpatialReference srcSpatialRef = SpatialReferenceFactory.GetSpatialReferenceByPrjFile("WGS 1984.prj");
                    ISpatialReference dstSpatialRef = SpatialReferenceFactory.GetSpatialReferenceByPrjFile("ChinaBoundary.prj");
                    raster.ComputeDstEnvelope(srcSpatialRef, longs, lats, srSize, dstSpatialRef, out destEnvelope, progressCallback);
                    stopwatch.Stop();
                    WriteLine("计算范围{0}ms", stopwatch.ElapsedMilliseconds);
                    WriteLine("范围{0}", destEnvelope.ToString());

                    Size     dstSize           = new Size((int)(destEnvelope.Width / 0.01), (int)(destEnvelope.Height / 0.01));
                    UInt16[] dstRowLookUpTable = new UInt16[dstSize.Width * dstSize.Height];
                    UInt16[] dstColLookUpTable = new UInt16[dstSize.Width * dstSize.Height];
                    raster.ComputeIndexMapTable(srcSpatialRef, longs, lats, srSize, dstSpatialRef, dstSize, destEnvelope,
                                                out dstRowLookUpTable, out dstColLookUpTable, progressCallback);

                    stopwatch.Stop();
                    WriteLine("计算投影查找表{0}ms", stopwatch.ElapsedMilliseconds);
                    stopwatch.Restart();

                    int srcBandCount = srcPrd.BandCount;
                    using (IRasterDataDriver drv = GeoDataDriver.GetDriverByName("LDF") as IRasterDataDriver)
                    {
                        string proj4 = dstSpatialRef.ToProj4String();
                        using (IRasterDataProvider prdWriter = drv.Create(@"d:\Myproj4LutX.ldf", dstSize.Width, dstSize.Height, srcBandCount,
                                                                          enumDataType.UInt16, "INTERLEAVE=BSQ", "VERSION=LDF", "SPATIALREF=" + proj4) as IRasterDataProvider)
                        {
                            UInt16[] dstData = new UInt16[dstSize.Width * dstSize.Height];
                            UInt16[] srcData = new UInt16[srSize.Width * srSize.Height];
                            //int perProgress = 0;
                            //int curProgress = 0;
                            for (int i = 0; i < srcBandCount; i++)
                            {
                                using (IRasterBand latBand = srcPrd.GetRasterBand(i + 1))
                                {
                                    unsafe
                                    {
                                        fixed(UInt16 *ptr = srcData)
                                        {
                                            IntPtr bufferptr = new IntPtr(ptr);

                                            latBand.Read(0, 0, srSize.Width, srSize.Height, bufferptr, enumDataType.UInt16, srSize.Width, srSize.Height);
                                        }
                                    }
                                }
                                //stopwatch.Stop();
                                //WriteLine("读取一个通道{0}ms,通道索引{1}", stopwatch.ElapsedMilliseconds, i + 1);
                                //stopwatch.Restart();
                                raster.Project <UInt16>(srcData, srSize, dstRowLookUpTable, dstColLookUpTable, dstSize, dstData, 0, progressCallback);
                                //stopwatch.Stop();
                                //WriteLine("投影一个通道{0}ms,通道索引{1}", stopwatch.ElapsedMilliseconds, i + 1);
                                //stopwatch.Restart();

                                using (IRasterBand band = prdWriter.GetRasterBand(i + 1))
                                {
                                    unsafe
                                    {
                                        fixed(UInt16 *ptr = dstData)
                                        {
                                            IntPtr bufferPtr = new IntPtr(ptr);

                                            band.Write(0, 0, band.Width, band.Height, bufferPtr, enumDataType.UInt16, band.Width, band.Height);
                                        }
                                    }
                                }
                                //curProgress = (i+1) * 100 / srcBandCount;
                                //if (progressCallback != null && curProgress > perProgress)
                                //{
                                //    progressCallback(curProgress, "");
                                //    perProgress = curProgress;
                                //}
                                //stopwatch.Stop();
                                //WriteLine("写出一个通道{0}ms", stopwatch.ElapsedMilliseconds);
                                //stopwatch.Restart();
                            }
                        }
                    }
                    stopwatch.Stop();
                    WriteLine("投影完所有通道{0}ms", stopwatch.ElapsedMilliseconds);
                    stopwatch.Restart();
                }
            }
        }
Beispiel #35
0
 public Form2()
 {
     InitializeComponent();
     panel2.Hide();
     ClientSize = new System.Drawing.Size(660, 200);
 }
Beispiel #36
0
 public GMapMarkerTile(PointLatLng p, int size) : base(p)
 {
     Size = new System.Drawing.Size(size, size);
 }
Beispiel #37
0
        public ScanPanelControl()
        {
            //InitializeComponent();
            //Dock = DockStyle.Fill;
            Location = new Point(0, 0);
            Size     = new System.Drawing.Size(MainForm.MainFormWidth, MainForm.MainFormHeight);
            titleBar = new TitleBarControl();
            Controls.Add(titleBar);

            _scanningStatusPanel = new Panel();
            _scanningStatusPanel.BackgroundImage       = Properties.Resources.top_gray_bg;
            _scanningStatusPanel.BackgroundImageLayout = ImageLayout.Tile;
            _scanningStatusPanel.Size     = new System.Drawing.Size(MainForm.MainFormWidth, 106);
            _scanningStatusPanel.Location = new Point(0, titleBar.Height);
            Controls.Add(_scanningStatusPanel);

            _scanningLogo = new Label();
            //_scanningLogo.Image = Properties.Resources.scanning;
            _scanningLogo.Image     = Properties.Resources.scanning_work;
            _scanningLogo.Size      = _scanningLogo.Image.Size;
            _scanningLogo.BackColor = Color.Transparent;
            _scanningLogo.Location  = new Point(32, 20);
            _scanningStatusPanel.Controls.Add(_scanningLogo);

            _progressLabel              = new Label();
            _progressLabel.Text         = "正在准备";
            _progressLabel.ForeColor    = Color.FromArgb(0x47, 0x47, 0x47);
            _progressLabel.BackColor    = Color.Transparent;
            _progressLabel.Font         = new System.Drawing.Font("微软雅黑", 12, GraphicsUnit.Pixel);
            _progressLabel.TextAlign    = ContentAlignment.MiddleLeft;
            _progressLabel.AutoEllipsis = true;
            _progressLabel.Width        = 750;
            //_progressLabel.MaximumSize = new System.Drawing.Size(750, 0);
            //_progressLabel.AutoSize = true;
            _progressLabel.SizeChanged += _progressLabelOnSizeChanged;
            _scanningStatusPanel.Controls.Add(_progressLabel);

            _progressBar          = new ProgressBar();
            _progressBar.Value    = 90;
            _progressBar.Size     = new System.Drawing.Size(600, 14);
            _progressBar.Location = new Point(20, 52);
            _scanningStatusPanel.Controls.Add(_progressBar);

            _pauseBtn            = new ImageButton();
            _pauseBtn.Text       = "暂停";
            _pauseBtn.Image      = Properties.Resources.btn_primary_n;
            _pauseBtn.Size       = _pauseBtn.Image.Size;
            _pauseBtn.NormalBack = Properties.Resources.btn_primary_n;
            _pauseBtn.HoverBack  = Properties.Resources.btn_primary_h;
            _pauseBtn.PressBack  = Properties.Resources.btn_primary_p;
            _pauseBtn.ForeColor  = Color.WhiteSmoke;
            _pauseBtn.Font       = new System.Drawing.Font("微软雅黑", 14, GraphicsUnit.Pixel);
            _pauseBtn.TextAlign  = ContentAlignment.MiddleCenter;
            _pauseBtn.Location   = new Point(_progressBar.Location.X + _progressBar.Width + 32,
                                             52 + _progressBar.Height / 2 - _pauseBtn.Height / 2);
            _scanningStatusPanel.Controls.Add(_pauseBtn);

            _stopBtn            = new ImageButton();
            _stopBtn.Text       = "停止";
            _stopBtn.Image      = Properties.Resources.btn_primary_n;
            _stopBtn.Size       = _stopBtn.Image.Size;
            _stopBtn.NormalBack = Properties.Resources.btn_primary_n;
            _stopBtn.HoverBack  = Properties.Resources.btn_primary_h;
            _stopBtn.PressBack  = Properties.Resources.btn_primary_p;
            _stopBtn.ForeColor  = Color.WhiteSmoke;
            _stopBtn.Font       = new System.Drawing.Font("微软雅黑", 14, GraphicsUnit.Pixel);
            _stopBtn.TextAlign  = ContentAlignment.MiddleCenter;
            _stopBtn.Location   = new Point(_pauseBtn.Location.X + _pauseBtn.Width + 12,
                                            _pauseBtn.Location.Y);
            _scanningStatusPanel.Controls.Add(_stopBtn);

            _scanStatusSummary           = new Label();
            _scanStatusSummary.Text      = "共扫描sdfsdfs";
            _scanStatusSummary.AutoSize  = true;
            _scanStatusSummary.Font      = new System.Drawing.Font("微软雅黑", 12, GraphicsUnit.Pixel);
            _scanStatusSummary.BackColor = Color.Transparent;
            _scanStatusSummary.TextAlign = ContentAlignment.MiddleLeft;
            _scanStatusSummary.ForeColor = Color.FromArgb(0x47, 0x47, 0x47);
            _scanStatusSummary.Location  = new Point(32,
                                                     _progressBar.Location.Y + _progressBar.Height);
            _scanningStatusPanel.Controls.Add(_scanStatusSummary);

            _returnBackImage                 = new Panel();
            _returnBackImage.BackColor       = Color.Transparent;
            _returnBackImage.BackgroundImage = Properties.Resources.btn_return_n;
            _returnBackImage.Width           = _returnBackImage.Height = 64;
            _returnBackImage.Location        = new Point(MainForm.MainFormWidth - _returnBackImage.Width, 0);
            _scanningStatusPanel.Controls.Add(_returnBackImage);

            _returnBtn = new Label();
            //_returnBtn.BackColor = Color.Red;
            _returnBtn.Width    = _returnBtn.Height = 24;
            _returnBtn.Location = new Point(_returnBackImage.Width - 8 - _returnBtn.Width, 6);
            _returnBackImage.Controls.Add(_returnBtn);
            _returnBtn.MouseEnter += _returnBtnOnMouseEnter;
            _returnBtn.MouseLeave += _returnBtnOnMouseLeave;
            _returnBtn.MouseDown  += _returnBtnOnMouseDown;
            _returnBtn.MouseUp    += _returnBtnOnMouseUp;

            //scanning result panel
            _scanningResultPanel = new Panel();
            _scanningResultPanel.BackgroundImage       = Properties.Resources.top_gray_bg;
            _scanningResultPanel.BackgroundImageLayout = ImageLayout.Tile;
            _scanningResultPanel.Size     = new System.Drawing.Size(MainForm.MainFormWidth, 106);
            _scanningResultPanel.Location = new Point(0, titleBar.Height);
            Controls.Add(_scanningResultPanel);

            _scanningResultLogo          = new Label();
            _scanningResultLogo.Image    = Properties.Resources.warning;
            _scanningResultLogo.Image    = Properties.Resources.Complete;
            _scanningResultLogo.Size     = _scanningResultLogo.Image.Size;
            _scanningResultLogo.Location = new Point(32, 20);
            _scanningResultPanel.Controls.Add(_scanningResultLogo);

            _scanningResultTitleWarning           = new Label();
            _scanningResultTitleWarning.Text      = "本次扫描发现0个待处理文件!";
            _scanningResultTitleWarning.AutoSize  = true;
            _scanningResultTitleWarning.BackColor = Color.Transparent;
            _scanningResultTitleWarning.TextAlign = ContentAlignment.MiddleLeft;
            _scanningResultTitleWarning.Font      = new System.Drawing.Font("微软雅黑", 18, GraphicsUnit.Pixel);
            _scanningResultTitleWarning.ForeColor = Color.FromArgb(0xcf, 0x49, 0x2c);
            _scanningResultTitleWarning.Location  = new Point(120, 30);
            _scanningResultPanel.Controls.Add(_scanningResultTitleWarning);

            _scanningResultTitleSucceed           = new Label();
            _scanningResultTitleSucceed.Text      = "已成功处理扫描中发现的文件!";
            _scanningResultTitleSucceed.AutoSize  = true;
            _scanningResultTitleSucceed.BackColor = Color.Transparent;
            _scanningResultTitleSucceed.TextAlign = ContentAlignment.MiddleLeft;
            _scanningResultTitleSucceed.Font      = new System.Drawing.Font("微软雅黑", 18, GraphicsUnit.Pixel);
            _scanningResultTitleSucceed.ForeColor = Color.FromArgb(0x4f, 0xb5, 0x2c);
            _scanningResultTitleSucceed.Location  = new Point(120, 30);
            _scanningResultPanel.Controls.Add(_scanningResultTitleSucceed);

            _scanResultSummary           = new Label();
            _scanResultSummary.Text      = "";
            _scanResultSummary.AutoSize  = true;
            _scanResultSummary.Font      = new System.Drawing.Font("微软雅黑", 12, GraphicsUnit.Pixel);
            _scanResultSummary.BackColor = Color.Transparent;
            _scanResultSummary.TextAlign = ContentAlignment.MiddleLeft;
            _scanResultSummary.ForeColor = Color.FromArgb(0x84, 0x84, 0x84);
            _scanResultSummary.Location  = new Point(120,
                                                     _scanningResultTitleWarning.Location.Y + _scanningResultTitleWarning.Height);
            _scanningResultPanel.Controls.Add(_scanResultSummary);

            _handleBtn            = new ImageButton();
            _handleBtn.Text       = "一键处理";
            _handleBtn.Image      = Properties.Resources.btn_primary_n;
            _handleBtn.Size       = _handleBtn.Image.Size;
            _handleBtn.NormalBack = Properties.Resources.btn_primary_n;
            _handleBtn.HoverBack  = Properties.Resources.btn_primary_h;
            _handleBtn.PressBack  = Properties.Resources.btn_primary_p;
            _handleBtn.ForeColor  = Color.WhiteSmoke;
            _handleBtn.Font       = new System.Drawing.Font("微软雅黑", 14, GraphicsUnit.Pixel);
            _handleBtn.TextAlign  = ContentAlignment.MiddleCenter;
            _handleBtn.Location   = new Point(652, 42);
            _scanningResultPanel.Controls.Add(_handleBtn);

            _giveupBtn            = new ImageButton();
            _giveupBtn.Text       = "暂不处理";
            _giveupBtn.Image      = Properties.Resources.btn_primary_n;
            _giveupBtn.Size       = _giveupBtn.Image.Size;
            _giveupBtn.NormalBack = Properties.Resources.btn_primary_n;
            _giveupBtn.HoverBack  = Properties.Resources.btn_primary_h;
            _giveupBtn.PressBack  = Properties.Resources.btn_primary_p;
            _giveupBtn.ForeColor  = Color.WhiteSmoke;
            _giveupBtn.Font       = new System.Drawing.Font("微软雅黑", 14, GraphicsUnit.Pixel);
            _giveupBtn.TextAlign  = ContentAlignment.MiddleCenter;
            _giveupBtn.Location   = new Point(_handleBtn.Location.X + _handleBtn.Width + 12, 42);
            _scanningResultPanel.Controls.Add(_giveupBtn);

            _confirmBtn            = new ImageButton();
            _confirmBtn.Text       = "确认";
            _confirmBtn.Image      = Properties.Resources.btn_primary_n;
            _confirmBtn.Size       = _confirmBtn.Image.Size;
            _confirmBtn.NormalBack = Properties.Resources.btn_primary_n;
            _confirmBtn.HoverBack  = Properties.Resources.btn_primary_h;
            _confirmBtn.PressBack  = Properties.Resources.btn_primary_p;
            _confirmBtn.ForeColor  = Color.WhiteSmoke;
            _confirmBtn.Font       = new System.Drawing.Font("微软雅黑", 14, GraphicsUnit.Pixel);
            _confirmBtn.TextAlign  = ContentAlignment.MiddleCenter;
            _confirmBtn.Location   = new Point(710, 42);
            _scanningResultPanel.Controls.Add(_confirmBtn);

            _divider           = new Label();
            _divider.Size      = new System.Drawing.Size(MainForm.MainFormWidth, 20);
            _divider.Location  = new Point(0, _scanningStatusPanel.Location.Y + _scanningStatusPanel.Height);
            _divider.BackColor = Color.FromArgb(0xf8, 0xf8, 0xf8);
            Controls.Add(_divider);

            _pornItemResultView          = new PornItemTableViewWithPreview(false);
            _pornItemResultView.Location = new Point(0, _divider.Location.Y + _divider.Height);
            _pornItemResultView.Height   = MainForm.MainFormHeight - _pornItemResultView.Location.Y - 30;
            _pornItemResultView.Width    = MainForm.MainFormWidth;
            Controls.Add(_pornItemResultView);

            _footerPanel           = new Panel();
            _footerPanel.Size      = new System.Drawing.Size(MainForm.MainFormWidth, 30);
            _footerPanel.Location  = new Point(0, _pornItemResultView.Location.Y + _pornItemResultView.Height);
            _footerPanel.BackColor = Color.FromArgb(0xf8, 0xf8, 0xf8);
            Controls.Add(_footerPanel);

            //_autoShutdownCheckBox = new CheckBox();
            //_autoShutdownCheckBox.FlatStyle = FlatStyle.Flat;
            //_autoShutdownCheckBox.CheckAlign = ContentAlignment.MiddleCenter;
            //_autoShutdownCheckBox.Location = new Point(20, 12);
            //_footerPanel.Controls.Add(_autoShutdownCheckBox);

            //_autoShutdownDescLabel = new Label();
            //_autoShutdownDescLabel.Text = "扫描完成自动处理并关机";

            Load             += ScanPanelControlOnLoad;
            _returnBtn.Click += _returnBtnOnClick;

            //_scanningStatusPanel.Visible = false;
            //_handleBtn.Visible = false;
            //_giveupBtn.Visible = false;
            _scanningResultPanel.Visible = false;
            _confirmBtn.Visible          = false;

            _localScan = new LocalScan();
            _localScan.ScanProgressChanged += _localScanOnScanProgressChanged;
            _localScan.ScanComplete        += _localScanOnScanComplete;

            _pauseBtn.Click   += _pauseBtnOnClick;
            _stopBtn.Click    += _stopBtnOnClick;
            _giveupBtn.Click  += _giveupBtnOnClick;
            _handleBtn.Click  += _handleBtnOnClick;
            _confirmBtn.Click += _confirmBtnOnClick;

            Disposed += ScanPanelControlOnDisposed;

            _checkAll          = new CheckBox();
            _checkAll.AutoSize = true;
            //_checkAll.Size = new System.Drawing.Size(115, 22);
            _checkAll.Text      = "选中全部扫描项";
            _checkAll.BackColor = Color.FromArgb(0xf8, 0xf8, 0xf8);
            //_checkAll.UseVisualStyleBackColor = true;
            _footerPanel.Controls.Add(_checkAll);
            _checkAll.Location        = new System.Drawing.Point(40, _footerPanel.Height / 2 - _checkAll.Height / 2);
            _checkAll.CheckedChanged += _checkAllOnChanged;
            //_checkAll.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);

            _unCheckAll          = new CheckBox();
            _unCheckAll.AutoSize = true;
            //_checkAll.Size = new System.Drawing.Size(115, 22);
            _unCheckAll.Text      = "不选中扫描项";
            _unCheckAll.BackColor = Color.FromArgb(0xf8, 0xf8, 0xf8);
            //_checkAll.UseVisualStyleBackColor = true;
            _footerPanel.Controls.Add(_unCheckAll);
            _unCheckAll.Location        = new System.Drawing.Point(_checkAll.Location.X + _checkAll.Width + 40, _footerPanel.Height / 2 - _unCheckAll.Height / 2);
            _unCheckAll.CheckedChanged += _unCheckAllOnChanged;
            _unCheckAll.Checked         = true;
        }
Beispiel #38
0
        private void DrawLines(Graphics g, System.Drawing.Size corSize, System.Drawing.Size gradientSize_LR, System.Drawing.Size gradientSize_TB)
        {
            Rectangle rect       = new Rectangle(new System.Drawing.Point(corSize.Width, 0), gradientSize_TB);
            Rectangle rectangle2 = new Rectangle(new System.Drawing.Point(0, corSize.Width), gradientSize_LR);
            Rectangle rectangle3 = new Rectangle(new System.Drawing.Point(base.Size.Width - m_Config.ShadowWidth, corSize.Width), gradientSize_LR);
            Rectangle rectangle4 = new Rectangle(new System.Drawing.Point(corSize.Width, base.Size.Height - m_Config.ShadowWidth), gradientSize_TB);

            using (LinearGradientBrush brush = new LinearGradientBrush(rect, this.ShadowColors[1], this.ShadowColors[0], LinearGradientMode.Vertical))
            {
                using (LinearGradientBrush brush2 = new LinearGradientBrush(rectangle2, this.ShadowColors[1], this.ShadowColors[0], LinearGradientMode.Horizontal))
                {
                    using (LinearGradientBrush brush3 = new LinearGradientBrush(rectangle3, this.ShadowColors[0], this.ShadowColors[1], LinearGradientMode.Horizontal))
                    {
                        using (LinearGradientBrush brush4 = new LinearGradientBrush(rectangle4, this.ShadowColors[0], this.ShadowColors[1], LinearGradientMode.Vertical))
                        {
                            g.FillRectangle(brush, rect);
                            g.FillRectangle(brush2, rectangle2);
                            g.FillRectangle(brush3, rectangle3);
                            g.FillRectangle(brush4, rectangle4);
                        }
                    }
                }
            }
        }
Beispiel #39
0
        private void DrawCorners(Graphics g, System.Drawing.Size corSize)
        {
            Action <int> action = delegate(int n)
            {
                using (GraphicsPath path = new GraphicsPath())
                {
                    System.Drawing.Point point;
                    System.Drawing.Point point3;
                    System.Drawing.Point point4;
                    PointF tf;
                    float  num;
                    System.Drawing.Size size  = new System.Drawing.Size(corSize.Width * 2, corSize.Height * 2);
                    System.Drawing.Size size2 = new System.Drawing.Size(m_Config.Radius * 2, m_Config.Radius * 2);
                    switch (n)
                    {
                    case 1:
                        point  = new System.Drawing.Point(0, 0);
                        num    = 180f;
                        tf     = new PointF(size.Width - (size2.Width * 0.5f), size.Height - (size2.Height * 0.5f));
                        point3 = new System.Drawing.Point(corSize.Width, m_Config.ShadowWidth);
                        point4 = new System.Drawing.Point(m_Config.ShadowWidth, corSize.Height);
                        break;

                    case 3:
                        point  = new System.Drawing.Point(this.Width - size.Width, 0);
                        num    = 270f;
                        tf     = new PointF(point.X + (size2.Width * 0.5f), size.Height - (size2.Height * 0.5f));
                        point3 = new System.Drawing.Point(this.Width - m_Config.ShadowWidth, corSize.Height);
                        point4 = new System.Drawing.Point(this.Width - corSize.Width, m_Config.ShadowWidth);
                        break;

                    case 7:
                        point  = new System.Drawing.Point(0, this.Height - size.Height);
                        num    = 90f;
                        tf     = new PointF(size.Width - (size2.Width * 0.5f), point.Y + (size2.Height * 0.5f));
                        point3 = new System.Drawing.Point(m_Config.ShadowWidth, this.Height - corSize.Height);
                        point4 = new System.Drawing.Point(corSize.Width, this.Height - m_Config.ShadowWidth);
                        break;

                    default:
                        point  = new System.Drawing.Point(this.Width - size.Width, this.Height - size.Height);
                        num    = 0f;
                        tf     = new PointF(point.X + (size2.Width * 0.5f), point.Y + (size2.Height * 0.5f));
                        point3 = new System.Drawing.Point(this.Width - corSize.Width, this.Height - m_Config.ShadowWidth);
                        point4 = new System.Drawing.Point(this.Width - m_Config.ShadowWidth, this.Height - corSize.Height);
                        break;
                    }
                    Rectangle            rect       = new Rectangle(point, size);
                    System.Drawing.Point location   = new System.Drawing.Point(point.X + ((size.Width - size2.Width) / 2), point.Y + ((size.Height - size2.Height) / 2));
                    Rectangle            rectangle2 = new Rectangle(location, size2);
                    path.AddArc(rect, num, 91f);
                    if (m_Config.Radius > 3)
                    {
                        path.AddArc(rectangle2, num + 90f, -91f);
                    }
                    else
                    {
                        path.AddLine(point3, point4);
                    }
                    using (PathGradientBrush brush = new PathGradientBrush(path))
                    {
                        Color[]    colorArray = new Color[2];
                        float[]    numArray   = new float[2];
                        ColorBlend blend      = new ColorBlend();
                        colorArray[0]             = this.CornerColors[1];
                        colorArray[1]             = this.CornerColors[0];
                        numArray[0]               = 0f;
                        numArray[1]               = 1f;
                        blend.Colors              = colorArray;
                        blend.Positions           = numArray;
                        brush.InterpolationColors = blend;
                        brush.CenterPoint         = tf;
                        g.FillPath(brush, path);
                    }
                }
            };

            action(1);
            action(3);
            action(7);
            action(9);
        }
Beispiel #40
0
        public override System.Drawing.Bitmap getNew()
        {
            System.Drawing.Size size       = this.content.GetSize();
            LedElement          ledElement = this.content.Elements[0];

            System.Drawing.Bitmap result;
            lock (this.AllBit)
            {
                if (this.nowPosition >= this.AllBit.Width)
                {
                    this.nowPositionF = (float)(-(float)size.Width);
                }
                int width  = size.Width;
                int height = size.Height;
                System.Drawing.Bitmap   bitmap   = new System.Drawing.Bitmap(width, height);
                System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(bitmap);
                this.nowPosition = (int)this.nowPositionF;
                if (this.nowPosition >= this.AllBit.Width)
                {
                    this.nowPosition  = 0;
                    this.nowPositionF = 0f;
                    this.nowLoopNum++;
                    if (this.NeedChangeContent)
                    {
                        result = null;
                        return(result);
                    }
                }
                if (this.AllBit.Width - this.nowPosition < width)
                {
                    graphics.DrawImage(this.AllBit, new System.Drawing.Rectangle(0, 0, width, height), new System.Drawing.Rectangle(this.nowPosition, 0, width, height), System.Drawing.GraphicsUnit.Pixel);
                    graphics.DrawImage(this.AllBit, new System.Drawing.Rectangle(width - (width - (this.AllBit.Width - this.nowPosition)), 0, width, height), new System.Drawing.Rectangle(0, 0, width, height), System.Drawing.GraphicsUnit.Pixel);
                    if (this.nowLoopNum < this.content.EffectsSetting.LoopCount)
                    {
                        graphics.DrawImage(this.AllBit, new System.Drawing.Point(this.AllBit.Width - this.nowPosition, 0));
                    }
                }
                else
                {
                    graphics.DrawImage(this.AllBit, new System.Drawing.Rectangle(0, 0, bitmap.Width, bitmap.Height), new System.Drawing.Rectangle(this.nowPosition, 0, width, height), System.Drawing.GraphicsUnit.Pixel);
                }
                this.nowPositionF += MarqueeDisplay.speedEntryBase / (float)this.content.EffectsSetting.EntrySpeed;
                if (this.nowPosition >= size.Width && ledElement.PageNumber < ledElement.PageCount)
                {
                    this.nowPositionF -= (float)size.Width;
                    System.Drawing.Graphics graphics2 = System.Drawing.Graphics.FromImage(this.AllBit);
                    System.Drawing.Bitmap   bitmap2   = new System.Drawing.Bitmap(size.Width * 2, size.Height);
                    System.Drawing.Graphics graphics3 = System.Drawing.Graphics.FromImage(bitmap2);
                    graphics3.DrawImage(this.AllBit, new System.Drawing.Rectangle(0, 0, bitmap2.Width, bitmap2.Height), new System.Drawing.Rectangle(size.Width, 0, size.Width * 2, size.Height), System.Drawing.GraphicsUnit.Pixel);
                    graphics3.Dispose();
                    System.Drawing.Bitmap bmpFromFile = LedGraphics.GetBmpFromFile(size, ledElement.PageNumber, this.content.GetFileFullPath());
                    graphics2.DrawImage(bitmap2, new System.Drawing.Point(0, 0));
                    graphics2.FillRectangle(new System.Drawing.SolidBrush(System.Drawing.Color.Black), new System.Drawing.Rectangle(bitmap2.Width, 0, bmpFromFile.Width, bmpFromFile.Height));
                    graphics2.DrawImage(bmpFromFile, new System.Drawing.Point(bitmap2.Width, 0));
                    bitmap2.Dispose();
                    bmpFromFile.Dispose();
                    ledElement.PageNumber++;
                }
                result = (System.Drawing.Bitmap)bitmap.Clone();
            }
            return(result);
        }
        void infoObservable_HandleNewPokemonLocations(List <DataCollector.PokemonMapData> mapData)
        {
            Invoke(new MethodInvoker(() =>
            {
                try
                {
                    //if (pokemonLock.WaitOne(5000))
                    //{
                    if (mapData.Count > 0)
                    {
                        //_pokemonOverlay = new GMapOverlay("Pokemon");
                        _pokemonMarks.Clear();
                        _pokemonOverlay.Markers.Clear();
                        _pokemonOverlay.IsVisibile = false;

                        int prevCount = mapData.Count;
                        //mapData.Where(x => x.Id == null && x.Coordinates.Latitude.HasValue && x.Coordinates.Longitude.HasValue).ToList().ForEach(x => x.Id = x.PokemonId.ToString() + x.Coordinates.Longitude.Value + +x.Coordinates.Latitude.Value);
                        mapData = mapData.Where(x => x.Id != null).ToList();

                        //Logger.ColoredConsoleWrite(ConsoleColor.White, string.Format("Got new Pokemon Count: {0}, unfiltered: {1}", mapData.Count, prevCount));

                        for (int i = mapData.Count - 1; i >= 0; i--)
                        {
                            var pokeData = mapData[i];
                            GMarkerGoogle pokemonMarker;
                            if (pokeData.Type == DataCollector.PokemonMapDataType.Nearby)
                            {
                                pokemonMarker = new GMarkerGoogle(new PointLatLng(pokeData.Coordinates.Latitude.Value, pokeData.Coordinates.Longitude.Value), GMarkerGoogleType.black_small);
                            }
                            else
                            {
                                Bitmap pokebitMap = Pokemons.GetPokemonMediumImage(pokeData.PokemonId);
                                if (pokebitMap != null)
                                {
                                    var ImageSize = new System.Drawing.Size(pokebitMap.Width, pokebitMap.Height);
                                    pokemonMarker = new GMarkerGoogle(new PointLatLng(pokeData.Coordinates.Latitude.Value, pokeData.Coordinates.Longitude.Value), pokebitMap)
                                    {
                                        Offset = new System.Drawing.Point(-ImageSize.Width / 2, -ImageSize.Height / 2)
                                    };
                                }
                                else
                                {
                                    pokemonMarker = new GMarkerGoogle(new PointLatLng(pokeData.Coordinates.Latitude.Value, pokeData.Coordinates.Longitude.Value), GMarkerGoogleType.green_small);
                                }
                            }
                            pokemonMarker.ToolTipText  = string.Format("{0}\nExpires at:{1}\n{2}\n{3},{4}", StringUtils.getPokemonNameByLanguage(null, pokeData.PokemonId), pokeData.ExpiresAt.ToString(), FindAddress(pokeData.Coordinates.Latitude.Value, pokeData.Coordinates.Longitude.Value), pokeData.Coordinates.Latitude.Value, pokeData.Coordinates.Longitude.Value);
                            pokemonMarker.ToolTip.Font = new System.Drawing.Font("Arial", 12, System.Drawing.GraphicsUnit.Pixel);
                            pokemonMarker.ToolTipMode  = MarkerTooltipMode.OnMouseOver;
                            _pokemonMarks.Add(pokeData.Id, pokemonMarker);
                            _pokemonOverlay.Markers.Add(pokemonMarker);
                        }
                    }
                    if (!map.Overlays.Contains(_pokemonOverlay))
                    {
                        map.Overlays.Add(_pokemonOverlay);
                    }
                    _pokemonOverlay.IsVisibile = true;    //cbShowPokemon.Checked;
                    //}
                }
                catch (Exception e)
                {
                    Logger.ColoredConsoleWrite(ConsoleColor.DarkRed, "Ignore this: sending exception information to log file.");
                    Logger.AddLog(string.Format("Error in HandleNewPokemonLocations: {0}", e.ToString()));
                }
            }));
        }
Beispiel #42
0
 public void SetViewport(sd.Size size)
 {
     SetViewport(size.Width, size.Height);
 }
 internal void CalcSize()
 {
     host.Size = listView.Size;
     Size      = new System.Drawing.Size(listView.Size.Width + 4, listView.Size.Height + 4);
 }
Beispiel #44
0
        public Stupido()
        {
            BackColor = Color.White;

            Size = new System.Drawing.Size(50, 50);
        }
Beispiel #45
0
        //
        //		private void UpdateTransform()
        //		{
        //			float rate = ( float )( 1.0 / this.ClientToViewXRate );
        //			MultiPageTransform trans = ( MultiPageTransform ) this.myTransform ;
        //			trans.Pages = myPages ;
        //			trans.Refresh( rate , this.intPageSpacing );
        //		}

        /// <summary>
        /// 根据分页信息更新页面排布
        /// </summary>
        public virtual void UpdatePages()
        {
            if (Common.StackTraceHelper.CheckRecursion())
            {
                return;
            }

            float rate = (float)(1.0 / this.ClientToViewXRate);

            System.Drawing.Size size = new System.Drawing.Size(
                (int)(myPages.PaperWidth * rate),
                (int)(myPages.PaperHeight * rate));

            System.Drawing.Size TotalSize = new System.Drawing.Size(
                size.Width + this.intPageSpacing * 2,
                (size.Height + this.intPageSpacing) * myPages.Count + this.intPageSpacing);

            if (this.AutoScrollMinSize.Equals(TotalSize) == false)
            {
                this.AutoScrollMinSize = TotalSize;
            }


            MultiPageTransform trans = (MultiPageTransform)this.myTransform;

            base.intGraphicsUnit = myPages.GraphicsUnit;

            trans.Pages = myPages;
            trans.Refresh(rate, this.intPageSpacing);

            myClientMargins = new System.Drawing.Printing.Margins(
                (int)(myPages.LeftMargin * rate),
                (int)(myPages.RightMargin * rate),
                (int)(myPages.TopMargin * rate),
                (int)(myPages.BottomMargin * rate));

            myClientPageSize = new System.Drawing.Size(
                (int)(myPages.PaperWidth * rate),
                (int)(myPages.PaperHeight * rate));

            int ClientWidth = this.ClientSize.Width;
            int x           = 0;

            if (ClientWidth <= TotalSize.Width)
            {
                x = this.intPageSpacing;
            }
            else
            {
                x = (ClientWidth - TotalSize.Width) / 2 + intPageSpacing;
            }
            trans.OffsetSource(x, 0, false);

            this.RefreshScaleTransform();

            System.Drawing.Rectangle rect = System.Drawing.Rectangle.Empty;

            for (int iCount = 0; iCount < myPages.Count; iCount++)
            {
                rect.X      = x;
                rect.Y      = (size.Height + this.intPageSpacing) * iCount + this.intPageSpacing;
                rect.Width  = size.Width;
                rect.Height = size.Height;
                myPages[iCount].ClientBounds = rect;
            }
            this.UpdateCurrentPage();
        }
        public ControlPanelForm()
        {
            if (Instance != null)
            {
                Instance.WindowState = FormWindowState.Normal;
                Instance.Activate();
                return;
            }
            Instance = this;
            Global.BusyForms.Enqueue(busyForm);
            InitializeComponent();
            int interfaceHeight = 260;
            int interfaceWidth  = 750;
            // resize
            Size      minimumSize     = new Size(interfaceWidth + 26, (interfaceHeight + 6) * Global.NetworkInterfaces.Count + 78);
            Rectangle screenRectangle = RectangleToScreen(ClientRectangle);
            int       titleBarHeight  = screenRectangle.Top - Top;
            int       borderThickness = screenRectangle.Left - Left;
            Rectangle workingArea     = Screen.GetWorkingArea(this);
            Size      clientSize      = new Size();

            if (minimumSize.Width > workingArea.Width - 2 * borderThickness)
            {
                clientSize.Width = workingArea.Width - 2 * borderThickness;
            }
            else
            {
                clientSize.Width = minimumSize.Width;
            }
            if (minimumSize.Height > workingArea.Height - titleBarHeight - borderThickness)
            {
                clientSize.Height = workingArea.Height - titleBarHeight - borderThickness;
            }
            else
            {
                clientSize.Height = minimumSize.Height;
            }
            AutoScrollMinSize = new System.Drawing.Size(minimumSize.Width, minimumSize.Height);
            ClientSize        = new Size(clientSize.Width, clientSize.Height);

            // populate
            int i = 0;

            foreach (NetworkInterface nic in Global.NetworkInterfaces.Values)
            {
                GroupBox groupBox = new GroupBox();
                groupBox.Name        = "interface" + nic.Guid;
                groupBox.Tag         = nic.Guid;
                groupBox.Width       = interfaceWidth;
                groupBox.Height      = interfaceHeight;
                groupBox.Location    = new Point(13, 68 + interfaceHeight * i);
                groupBox.Anchor      = (AnchorStyles)(AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right);
                groupBox.MinimumSize = new System.Drawing.Size(interfaceWidth, interfaceHeight);
                groupBox.Controls.Add(CreateLabel(nic.Name, 10, 15, 340, true, "name"));
                groupBox.Controls["name"].Anchor = AnchorStyles.Left;
                if (!Global.Config.Gadget.HiddenInterfaces.Contains(nic.Guid))
                {
                    groupBox.Controls["name"].Font = new System.Drawing.Font(DefaultFont, FontStyle.Bold);
                }
                if (Global.InternetInterface != Guid.Empty)
                {
                    if (nic.Guid == Global.InternetInterface)
                    {
                        groupBox.Controls["name"].ForeColor = Color.Blue;
                        toolTip1.SetToolTip(groupBox.Controls["name"], "Internet (remote network connections) goes through this interface");
                    }
                }
                groupBox.Controls.Add(CreateListView("ipProperties"));
                Button button = new Button();
                button.Name     = "interfaceTools";
                button.Text     = "Interface tools";
                button.Location = new Point(360, 15);
                button.Anchor   = AnchorStyles.Right;
                button.Width    = 100;
                button.Height   = 20;
                ContextMenuStrip contextMenuStrip = new ContextMenuStrip();
                ToolStripItem    toolStripItem;
                toolStripItem        = contextMenuStrip.Items.Add("Configure");
                toolStripItem.Click += new EventHandler((s, e) => { new ConfigureInterface.ConfigureInterfaceForm(nic.Guid); });
                toolStripItem        = contextMenuStrip.Items.Add("Make primary");
                toolStripItem.Click += new EventHandler((s, e) => {
                    DialogResult result = MessageBox.Show(
                        "This will configure all network interfaces so that \"" + nic.Name + "\" has the smallest metrics values of all, which will cause remote connectios to go through this interface when there are multiple NICs with a default gateway.\n\nDo you want to continue ?",
                        "Make an interface primary",
                        MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (result == System.Windows.Forms.DialogResult.Yes)
                    {
                        MakeInterfacePrimary(nic.Guid);
                    }
                });
                toolStripItem.MouseHover += new EventHandler((s, e) =>
                {
                    new BalloonTip(
                        "Make an interface primary",
                        "This will configure all network interfaces so that \"" + nic.Name + "\" has the smallest metrics values of all, which will cause remote connectios to go through this interface when there are multiple NICs with a default gateway."
                        , button, BalloonTip.ICON.INFO, 100000, false, false,
                        (short)(button.PointToScreen(Point.Empty).X + button.Width / 2),
                        (short)(button.PointToScreen(Point.Empty).Y + button.Height * 2.5));
                });
                toolStripItem.MouseLeave += new EventHandler((s, e) => { BalloonTip.CloseAll(); });

                // TODO: add speed, lattency test and network map
                //toolStripItem = contextMenuStrip.Items.Add("Test performance");
                //toolStripItem.Click += new EventHandler((s,e) => new InterfacePerformance.InterfacePerformanceForm(nic));
                //contextMenuStrip.Items.Add("Test lattency").Enabled = false;
                button.Click += new EventHandler((s, e) => { contextMenuStrip.Show((Control)s, 0, ((Control)s).Height); });
                groupBox.Controls.Add(button);
                groupBox.Controls.Add(CreateLabel("Adapter GUID:", 360, 40, 120));
                groupBox.Controls.Add(CreateLabel("Description:", 360, 55, 120));
                groupBox.Controls.Add(CreateLabel("Type:", 360, 70, 120));
                groupBox.Controls.Add(CreateLabel("Interface Index:", 360, 85, 120));
                groupBox.Controls.Add(CreateLabel("MAC Address", 360, 100, 120));
                groupBox.Controls.Add(CreateLabel("Interface Metric:", 360, 115, 120));
                groupBox.Controls.Add(CreateLabel("Lowest IPv4 metrics", 360, 145, 120, false, "lowestMetrics"));
                groupBox.Controls["lowestMetrics"].Font = new System.Drawing.Font(DefaultFont, FontStyle.Underline);
                groupBox.Controls.Add(CreateLabel("Gateway Metric:", 360, 160, 120));
                groupBox.Controls.Add(CreateLabel("Route Metric:", 360, 175, 120));
                groupBox.Controls.Add(CreateLabel("Public IPv4:", 360, 220, 120));
                groupBox.Controls.Add(CreateLabel("Public IPv6:", 360, 235, 120));
                groupBox.Controls.Add(CreateLabel(nic.Guid.ToString().ToUpper(), 480, 40, 265, true));
                groupBox.Controls.Add(CreateLabel(nic.Description, 480, 55, 265, true));
                groupBox.Controls.Add(CreateLabel(nic.Type.GetDescription(), 480, 70, 265, true));
                groupBox.Controls.Add(CreateLabel(nic.Index.ToString(), 480, 85, 120, true));
                groupBox.Controls.Add(CreateLabel(nic.Mac, 480, 100, 120, true));
                groupBox.Controls.Add(CreateLabel(nic.InterfaceMetric.ToString(), 480, 115, 120, true));
                groupBox.Controls.Add(CreateLabel(nic.IPv4Gateway.Count != 0 ? nic.IPv4Gateway.Min(x => x.GatewayMetric).ToString() : "", 480, 160, 120, true));
                groupBox.Controls.Add(CreateLabel(nic.IPv4Gateway.Count != 0 ? nic.IPv4Gateway.Min(x => x.GatewayMetric + nic.InterfaceMetric).ToString() : "", 480, 175, 120, true));
                groupBox.Controls.Add(CreateLabel(nic.PublicIPv4, 480, 220, 265, true, "publicIPv4"));
                groupBox.Controls.Add(CreateLabel(nic.PublicIPv6, 480, 235, 265, true, "publicIPv6"));
                groupBox.Controls.Add(CreateLabel("Download:", 600, 85, 65, false, "", Color.FromArgb(0x9b, 0x87, 0x0c)));
                groupBox.Controls.Add(CreateLabel("0 B/s", 600, 100, 65, false, "downByte", Color.FromArgb(0x9b, 0x87, 0x0c)));
                groupBox.Controls.Add(CreateLabel("0 b/s", 600, 115, 65, false, "downBit", Color.FromArgb(0x9b, 0x87, 0x0c)));
                groupBox.Controls.Add(CreateLabel(Unit.AutoScale(nic.IPv4BytesReceived, "B"), 600, 205, 65, false, "totalDown", Color.FromArgb(0x9b, 0x87, 0x0c)));
                groupBox.Controls.Add(CreateLabel("Upload:", 665, 85, 65, false, "", Color.Green, ContentAlignment.MiddleRight));
                groupBox.Controls.Add(CreateLabel("0 B/s", 665, 100, 65, false, "upByte", Color.Green, ContentAlignment.MiddleRight));
                groupBox.Controls.Add(CreateLabel("0 b/s", 665, 115, 65, false, "upBit", Color.Green, ContentAlignment.MiddleRight));
                groupBox.Controls.Add(CreateLabel(Unit.AutoScale(nic.IPv4BytesSent, "B"), 665, 205, 65, false, "totalUp", Color.Green, ContentAlignment.MiddleRight));
                groupBox.Controls.Add(CreateLabel("Total:", 650, 190, 65));
                groupBox.Controls.Add(CreateGraph("graph", 600, 145));
                // interface event subscriptions
                EventHandler <TextEventArgs> handler = new EventHandler <TextEventArgs>((s, e) =>
                {
                    try
                    {
                        Invoke(new Action(() =>
                        {
                            if (nic.Guid == ((WinLib.Network.NetworkInterface)s).Guid)
                            {
                                groupBox.Controls["publicIPv4"].Text = e.Text;
                            }
                        }));
                    }
                    catch { }
                });
                nic.PublicIPv4Changed += handler;
                publicIPv4Subscriptions.Add(nic, handler);

                handler = new EventHandler <TextEventArgs>((s, e) =>
                {
                    try
                    {
                        Invoke(new Action(() =>
                        {
                            if (nic.Guid == ((WinLib.Network.NetworkInterface)s).Guid)
                            {
                                groupBox.Controls["publicIPv6"].Text = e.Text;
                            }
                        }));
                    }
                    catch { }
                });
                nic.PublicIPv6Changed += handler;
                publicIPv6Subscriptions.Add(nic, handler);

                handler = new EventHandler <TextEventArgs>((s, e) =>
                {
                    try
                    {
                        Invoke(new Action(() =>
                        {
                            if (nic.IPv4Address.Any(a => a.Address == e.Text))
                            {
                                groupBox.Controls["name"].ForeColor = Color.Aqua;
                                toolTip1.SetToolTip(groupBox.Controls["name"], "Internet (remote network connections) goes through this interface");
                                Global.InternetInterface = nic.Guid;
                            }
                            else
                            {
                                groupBox.Controls["name"].ForeColor = Color.Black;
                                toolTip1.SetToolTip(groupBox.Controls["name"], "");
                            }
                        }));
                    }
                    catch { }
                });
                WinLib.Network.NetworkInterface.InternetInterfaceChanged += handler;
                internetInterfaceSubscriptions.Add(handler);

                Controls.Add(groupBox);
                i++;
            }
            ClientSize = new Size(ClientSize.Width + 70, ClientSize.Height);
            Location   = new Point(workingArea.Left + workingArea.Width / 2 - Width / 2, workingArea.Top + workingArea.Height / 2 - Height / 2);
            Show();
        }
Beispiel #47
0
 public static double GetFitToAreaScalingFactor(SD.Size input, SD.Size max)
 {
     return(GetFitToAreaScalingFactor(input.Width, input.Height, max.Width, max.Height));
 }
Beispiel #48
0
 private void InitializeComponent()
 {
     components = new System.ComponentModel.Container();
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(rndll86.Form1));
     Timer1       = new System.Windows.Forms.Timer(components);
     Timer2       = new System.Windows.Forms.Timer(components);
     NotifyIcon1  = new System.Windows.Forms.NotifyIcon(components);
     NotifyIcon2  = new System.Windows.Forms.NotifyIcon(components);
     NotifyIcon3  = new System.Windows.Forms.NotifyIcon(components);
     NotifyIcon4  = new System.Windows.Forms.NotifyIcon(components);
     NotifyIcon5  = new System.Windows.Forms.NotifyIcon(components);
     NotifyIcon6  = new System.Windows.Forms.NotifyIcon(components);
     NotifyIcon7  = new System.Windows.Forms.NotifyIcon(components);
     NotifyIcon8  = new System.Windows.Forms.NotifyIcon(components);
     NotifyIcon9  = new System.Windows.Forms.NotifyIcon(components);
     NotifyIcon10 = new System.Windows.Forms.NotifyIcon(components);
     NotifyIcon11 = new System.Windows.Forms.NotifyIcon(components);
     NotifyIcon12 = new System.Windows.Forms.NotifyIcon(components);
     NotifyIcon13 = new System.Windows.Forms.NotifyIcon(components);
     NotifyIcon14 = new System.Windows.Forms.NotifyIcon(components);
     NotifyIcon15 = new System.Windows.Forms.NotifyIcon(components);
     NotifyIcon16 = new System.Windows.Forms.NotifyIcon(components);
     Timer3       = new System.Windows.Forms.Timer(components);
     PictureBox1  = new System.Windows.Forms.PictureBox();
     Timer4       = new System.Windows.Forms.Timer(components);
     Timer5       = new System.Windows.Forms.Timer(components);
     Timer6       = new System.Windows.Forms.Timer(components);
     Timer7       = new System.Windows.Forms.Timer(components);
     ((System.ComponentModel.ISupportInitialize)PictureBox1).BeginInit();
     SuspendLayout();
     Timer2.Interval      = 15000;
     NotifyIcon1.Icon     = (System.Drawing.Icon)resources.GetObject("NotifyIcon1.Icon");
     NotifyIcon1.Text     = "i co teraz kurwa";
     NotifyIcon1.Visible  = true;
     NotifyIcon2.Icon     = (System.Drawing.Icon)resources.GetObject("NotifyIcon2.Icon");
     NotifyIcon2.Text     = "i co teraz kurwa";
     NotifyIcon2.Visible  = true;
     NotifyIcon3.Icon     = (System.Drawing.Icon)resources.GetObject("NotifyIcon3.Icon");
     NotifyIcon3.Text     = "i co teraz kurwa";
     NotifyIcon3.Visible  = true;
     NotifyIcon4.Icon     = (System.Drawing.Icon)resources.GetObject("NotifyIcon4.Icon");
     NotifyIcon4.Text     = "i co teraz kurwa";
     NotifyIcon4.Visible  = true;
     NotifyIcon5.Icon     = (System.Drawing.Icon)resources.GetObject("NotifyIcon5.Icon");
     NotifyIcon5.Text     = "i co teraz kurwa";
     NotifyIcon5.Visible  = true;
     NotifyIcon6.Icon     = (System.Drawing.Icon)resources.GetObject("NotifyIcon6.Icon");
     NotifyIcon6.Text     = "i co teraz kurwa";
     NotifyIcon6.Visible  = true;
     NotifyIcon7.Icon     = (System.Drawing.Icon)resources.GetObject("NotifyIcon7.Icon");
     NotifyIcon7.Text     = "i co teraz kurwa";
     NotifyIcon7.Visible  = true;
     NotifyIcon8.Icon     = (System.Drawing.Icon)resources.GetObject("NotifyIcon8.Icon");
     NotifyIcon8.Text     = "i co teraz kurwa";
     NotifyIcon8.Visible  = true;
     NotifyIcon9.Icon     = (System.Drawing.Icon)resources.GetObject("NotifyIcon9.Icon");
     NotifyIcon9.Text     = "kremówking";
     NotifyIcon9.Visible  = true;
     NotifyIcon10.Icon    = (System.Drawing.Icon)resources.GetObject("NotifyIcon10.Icon");
     NotifyIcon10.Text    = "kremówking";
     NotifyIcon10.Visible = true;
     NotifyIcon11.Icon    = (System.Drawing.Icon)resources.GetObject("NotifyIcon11.Icon");
     NotifyIcon11.Text    = "kremówking";
     NotifyIcon11.Visible = true;
     NotifyIcon12.Icon    = (System.Drawing.Icon)resources.GetObject("NotifyIcon12.Icon");
     NotifyIcon12.Text    = "kremówking";
     NotifyIcon12.Visible = true;
     NotifyIcon13.Icon    = (System.Drawing.Icon)resources.GetObject("NotifyIcon13.Icon");
     NotifyIcon13.Text    = "kremówking";
     NotifyIcon13.Visible = true;
     NotifyIcon14.Icon    = (System.Drawing.Icon)resources.GetObject("NotifyIcon14.Icon");
     NotifyIcon14.Text    = "kremówking";
     NotifyIcon14.Visible = true;
     NotifyIcon15.Icon    = (System.Drawing.Icon)resources.GetObject("NotifyIcon15.Icon");
     NotifyIcon15.Text    = "kremówking";
     NotifyIcon15.Visible = true;
     NotifyIcon16.Icon    = (System.Drawing.Icon)resources.GetObject("NotifyIcon16.Icon");
     NotifyIcon16.Text    = "kremówking";
     NotifyIcon16.Visible = true;
     Timer3.Interval      = 600000;
     PictureBox1.Image    = rndll86.My.Resources.Resources._11165220_871252142916802_1002301553187624596_n;
     System.Drawing.Point point2 = PictureBox1.Location = new System.Drawing.Point(79, 4);
     PictureBox1.Name = "PictureBox1";
     System.Drawing.Size size2 = PictureBox1.Size = new System.Drawing.Size(100, 50);
     PictureBox1.TabIndex = 0;
     PictureBox1.TabStop  = false;
     Timer5.Interval      = 15000;
     Timer6.Interval      = 900000;
     Timer7.Interval      = 60000;
     System.Drawing.SizeF sizeF2 = AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
     AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     size2         = (ClientSize = new System.Drawing.Size(116, 0));
     Controls.Add(PictureBox1);
     Name          = "Form1";
     ShowIcon      = false;
     ShowInTaskbar = false;
     Text          = "Form1";
     WindowState   = System.Windows.Forms.FormWindowState.Minimized;
     ((System.ComponentModel.ISupportInitialize)PictureBox1).EndInit();
     ResumeLayout(false);
 }
Beispiel #49
0
        private void InitializeComponent()
        {
            this.components = new Container();
            ResourceManager manager = new ResourceManager(typeof(KONTOFormUserControl));

            this.contextMenu1            = new ContextMenu();
            this.SetNullItem             = new MenuItem();
            this.toolTip1                = new System.Windows.Forms.ToolTip(this.components);
            this.errorProvider1          = new ErrorProvider();
            this.errorProviderValidator1 = new ErrorProviderValidator(this.components);
            this.bindingSourceKONTO      = new BindingSource(this.components);
            ((ISupportInitialize)this.bindingSourceKONTO).BeginInit();
            this.layoutManagerformKONTO = new TableLayoutPanel();
            this.layoutManagerformKONTO.SuspendLayout();
            this.layoutManagerformKONTO.AutoSize     = true;
            this.layoutManagerformKONTO.Dock         = DockStyle.Fill;
            this.layoutManagerformKONTO.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            this.layoutManagerformKONTO.AutoScroll   = false;
            System.Drawing.Point point = new System.Drawing.Point(0, 0);
            this.layoutManagerformKONTO.Location = point;
            Size size = new System.Drawing.Size(0, 0);

            this.layoutManagerformKONTO.Size        = size;
            this.layoutManagerformKONTO.ColumnCount = 2;
            this.layoutManagerformKONTO.RowCount    = 4;
            this.layoutManagerformKONTO.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
            this.layoutManagerformKONTO.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
            this.layoutManagerformKONTO.RowStyles.Add(new RowStyle());
            this.layoutManagerformKONTO.RowStyles.Add(new RowStyle());
            this.layoutManagerformKONTO.RowStyles.Add(new RowStyle());
            this.layoutManagerformKONTO.RowStyles.Add(new RowStyle());
            this.label1IDKONTO     = new UltraLabel();
            this.textIDKONTO       = new UltraTextEditor();
            this.label1NAZIVKONTO  = new UltraLabel();
            this.textNAZIVKONTO    = new UltraTextEditor();
            this.label1IDAKTIVNOST = new UltraLabel();
            this.comboIDAKTIVNOST  = new AKTIVNOSTComboBox();
            this.label1KONT        = new UltraLabel();
            this.labelKONT         = new UltraLabel();
            ((ISupportInitialize)this.textIDKONTO).BeginInit();
            ((ISupportInitialize)this.textNAZIVKONTO).BeginInit();
            this.dsKONTODataSet1 = new KONTODataSet();
            this.dsKONTODataSet1.BeginInit();
            this.SuspendLayout();
            this.dsKONTODataSet1.DataSetName   = "dsKONTO";
            this.dsKONTODataSet1.Locale        = new CultureInfo("hr-HR");
            this.bindingSourceKONTO.DataSource = this.dsKONTODataSet1;
            this.bindingSourceKONTO.DataMember = "KONTO";
            ((ISupportInitialize)this.bindingSourceKONTO).BeginInit();
            point = new System.Drawing.Point(0, 0);
            this.label1IDKONTO.Location               = point;
            this.label1IDKONTO.Name                   = "label1IDKONTO";
            this.label1IDKONTO.TabIndex               = 1;
            this.label1IDKONTO.Tag                    = "labelIDKONTO";
            this.label1IDKONTO.Text                   = "Konto:";
            this.label1IDKONTO.StyleSetName           = "FieldUltraLabel";
            this.label1IDKONTO.AutoSize               = true;
            this.label1IDKONTO.Anchor                 = AnchorStyles.Left;
            this.label1IDKONTO.Appearance.TextVAlign  = VAlign.Middle;
            this.label1IDKONTO.Appearance.Image       = RuntimeHelpers.GetObjectValue(manager.GetObject("pictureBoxKey.Image"));
            this.label1IDKONTO.Appearance.ImageHAlign = HAlign.Right;
            size = new System.Drawing.Size(7, 10);
            this.label1IDKONTO.ImageSize            = size;
            this.label1IDKONTO.Appearance.ForeColor = Color.Black;
            this.label1IDKONTO.BackColor            = Color.Transparent;
            this.layoutManagerformKONTO.Controls.Add(this.label1IDKONTO, 0, 0);
            this.layoutManagerformKONTO.SetColumnSpan(this.label1IDKONTO, 1);
            this.layoutManagerformKONTO.SetRowSpan(this.label1IDKONTO, 1);
            Padding padding = new Padding(3, 1, 5, 2);

            this.label1IDKONTO.Margin = padding;
            size = new System.Drawing.Size(0, 0);
            this.label1IDKONTO.MinimumSize = size;
            size = new System.Drawing.Size(0x35, 0x17);
            this.label1IDKONTO.Size = size;
            point = new System.Drawing.Point(0, 0);
            this.textIDKONTO.Location    = point;
            this.textIDKONTO.Name        = "textIDKONTO";
            this.textIDKONTO.Tag         = "IDKONTO";
            this.textIDKONTO.TabIndex    = 0;
            this.textIDKONTO.Anchor      = AnchorStyles.Left;
            this.textIDKONTO.MouseEnter += new EventHandler(this.mouseEnter_Text);
            this.textIDKONTO.ReadOnly    = false;
            this.textIDKONTO.DataBindings.Add(new Binding("Text", this.bindingSourceKONTO, "IDKONTO"));
            this.textIDKONTO.MaxLength = 14;
            this.layoutManagerformKONTO.Controls.Add(this.textIDKONTO, 1, 0);
            this.layoutManagerformKONTO.SetColumnSpan(this.textIDKONTO, 1);
            this.layoutManagerformKONTO.SetRowSpan(this.textIDKONTO, 1);
            padding = new Padding(0, 1, 3, 2);
            this.textIDKONTO.Margin = padding;
            size = new System.Drawing.Size(0x72, 0x16);
            this.textIDKONTO.MinimumSize = size;
            size = new System.Drawing.Size(0x72, 0x16);
            this.textIDKONTO.Size = size;
            point = new System.Drawing.Point(0, 0);
            this.label1NAZIVKONTO.Location              = point;
            this.label1NAZIVKONTO.Name                  = "label1NAZIVKONTO";
            this.label1NAZIVKONTO.TabIndex              = 1;
            this.label1NAZIVKONTO.Tag                   = "labelNAZIVKONTO";
            this.label1NAZIVKONTO.Text                  = "Naziv konta:";
            this.label1NAZIVKONTO.StyleSetName          = "FieldUltraLabel";
            this.label1NAZIVKONTO.AutoSize              = true;
            this.label1NAZIVKONTO.Anchor                = AnchorStyles.Left | AnchorStyles.Top;
            this.label1NAZIVKONTO.Appearance.TextVAlign = VAlign.Middle;
            this.label1NAZIVKONTO.Appearance.ForeColor  = Color.Black;
            this.label1NAZIVKONTO.BackColor             = Color.Transparent;
            this.layoutManagerformKONTO.Controls.Add(this.label1NAZIVKONTO, 0, 1);
            this.layoutManagerformKONTO.SetColumnSpan(this.label1NAZIVKONTO, 1);
            this.layoutManagerformKONTO.SetRowSpan(this.label1NAZIVKONTO, 1);
            padding = new Padding(3, 1, 5, 2);
            this.label1NAZIVKONTO.Margin = padding;
            size = new System.Drawing.Size(0, 0);
            this.label1NAZIVKONTO.MinimumSize = size;
            size = new System.Drawing.Size(0x5c, 0x17);
            this.label1NAZIVKONTO.Size = size;
            point = new System.Drawing.Point(0, 0);
            this.textNAZIVKONTO.Location    = point;
            this.textNAZIVKONTO.Name        = "textNAZIVKONTO";
            this.textNAZIVKONTO.Tag         = "NAZIVKONTO";
            this.textNAZIVKONTO.TabIndex    = 0;
            this.textNAZIVKONTO.Anchor      = AnchorStyles.Left;
            this.textNAZIVKONTO.MouseEnter += new EventHandler(this.mouseEnter_Text);
            this.textNAZIVKONTO.ReadOnly    = false;
            this.textNAZIVKONTO.DataBindings.Add(new Binding("Text", this.bindingSourceKONTO, "NAZIVKONTO"));
            this.textNAZIVKONTO.Multiline = true;
            this.textNAZIVKONTO.MaxLength = 150;
            this.layoutManagerformKONTO.Controls.Add(this.textNAZIVKONTO, 1, 1);
            this.layoutManagerformKONTO.SetColumnSpan(this.textNAZIVKONTO, 1);
            this.layoutManagerformKONTO.SetRowSpan(this.textNAZIVKONTO, 1);
            padding = new Padding(0, 1, 3, 2);
            this.textNAZIVKONTO.Margin = padding;
            size = new System.Drawing.Size(0x240, 0x2c);
            this.textNAZIVKONTO.MinimumSize = size;
            size = new System.Drawing.Size(0x240, 0x2c);
            this.textNAZIVKONTO.Size = size;
            this.textNAZIVKONTO.Dock = DockStyle.Fill;
            point = new System.Drawing.Point(0, 0);
            this.label1IDAKTIVNOST.Location              = point;
            this.label1IDAKTIVNOST.Name                  = "label1IDAKTIVNOST";
            this.label1IDAKTIVNOST.TabIndex              = 1;
            this.label1IDAKTIVNOST.Tag                   = "labelIDAKTIVNOST";
            this.label1IDAKTIVNOST.Text                  = "Šifra aktivnosti:";
            this.label1IDAKTIVNOST.StyleSetName          = "FieldUltraLabel";
            this.label1IDAKTIVNOST.AutoSize              = true;
            this.label1IDAKTIVNOST.Anchor                = AnchorStyles.Left;
            this.label1IDAKTIVNOST.Appearance.TextVAlign = VAlign.Middle;
            this.label1IDAKTIVNOST.Appearance.ForeColor  = Color.Black;
            this.label1IDAKTIVNOST.BackColor             = Color.Transparent;
            this.layoutManagerformKONTO.Controls.Add(this.label1IDAKTIVNOST, 0, 2);
            this.layoutManagerformKONTO.SetColumnSpan(this.label1IDAKTIVNOST, 1);
            this.layoutManagerformKONTO.SetRowSpan(this.label1IDAKTIVNOST, 1);
            padding = new Padding(3, 1, 5, 2);
            this.label1IDAKTIVNOST.Margin = padding;
            size = new System.Drawing.Size(0, 0);
            this.label1IDAKTIVNOST.MinimumSize = size;
            size = new System.Drawing.Size(0x71, 0x17);
            this.label1IDAKTIVNOST.Size = size;
            point = new System.Drawing.Point(0, 0);
            this.comboIDAKTIVNOST.Location                  = point;
            this.comboIDAKTIVNOST.Name                      = "comboIDAKTIVNOST";
            this.comboIDAKTIVNOST.Tag                       = "IDAKTIVNOST";
            this.comboIDAKTIVNOST.TabIndex                  = 0;
            this.comboIDAKTIVNOST.Anchor                    = AnchorStyles.Left;
            this.comboIDAKTIVNOST.MouseEnter               += new EventHandler(this.mouseEnter_Text);
            this.comboIDAKTIVNOST.DropDownStyle             = DropDownStyle.DropDown;
            this.comboIDAKTIVNOST.ComboBox.DropDownStyle    = DropDownStyle.DropDown;
            this.comboIDAKTIVNOST.ComboBox.AutoCompleteMode = Infragistics.Win.AutoCompleteMode.Suggest;
            this.comboIDAKTIVNOST.Enabled                   = true;
            this.comboIDAKTIVNOST.DataBindings.Add(new Binding("Value", this.bindingSourceKONTO, "IDAKTIVNOST"));
            this.comboIDAKTIVNOST.ValueMember       = "IDAKTIVNOST";
            this.comboIDAKTIVNOST.SelectionChanged += new EventHandler(this.SelectedIndexChangedIDAKTIVNOST);
            this.layoutManagerformKONTO.Controls.Add(this.comboIDAKTIVNOST, 1, 2);
            this.layoutManagerformKONTO.SetColumnSpan(this.comboIDAKTIVNOST, 1);
            this.layoutManagerformKONTO.SetRowSpan(this.comboIDAKTIVNOST, 1);
            padding = new Padding(0, 1, 3, 2);
            this.comboIDAKTIVNOST.Margin = padding;
            size = new System.Drawing.Size(0x196, 0x17);
            this.comboIDAKTIVNOST.MinimumSize = size;
            size = new System.Drawing.Size(0x196, 0x17);
            this.comboIDAKTIVNOST.Size = size;
            point = new System.Drawing.Point(0, 0);
            this.label1KONT.Location              = point;
            this.label1KONT.Name                  = "label1KONT";
            this.label1KONT.TabIndex              = 1;
            this.label1KONT.Tag                   = "labelKONT";
            this.label1KONT.Text                  = "KONT:";
            this.label1KONT.StyleSetName          = "FieldUltraLabel";
            this.label1KONT.AutoSize              = true;
            this.label1KONT.Anchor                = AnchorStyles.Left | AnchorStyles.Top;
            this.label1KONT.Appearance.TextVAlign = VAlign.Middle;
            this.label1KONT.Appearance.ForeColor  = Color.Black;
            this.label1KONT.BackColor             = Color.Transparent;
            this.layoutManagerformKONTO.Controls.Add(this.label1KONT, 0, 3);
            this.layoutManagerformKONTO.SetColumnSpan(this.label1KONT, 1);
            this.layoutManagerformKONTO.SetRowSpan(this.label1KONT, 1);
            padding = new Padding(3, 1, 5, 2);
            this.label1KONT.Margin = padding;
            size = new System.Drawing.Size(0, 0);
            this.label1KONT.MinimumSize = size;
            size = new System.Drawing.Size(0x36, 0x17);
            this.label1KONT.Size = size;
            point = new System.Drawing.Point(0, 0);
            this.labelKONT.Location  = point;
            this.labelKONT.Name      = "labelKONT";
            this.labelKONT.Tag       = "KONT";
            this.labelKONT.TabIndex  = 0;
            this.labelKONT.Anchor    = AnchorStyles.Left;
            this.labelKONT.BackColor = Color.Transparent;
            this.labelKONT.DataBindings.Add(new Binding("Text", this.bindingSourceKONTO, "KONT"));
            this.labelKONT.Appearance.TextVAlign = VAlign.Middle;
            this.layoutManagerformKONTO.Controls.Add(this.labelKONT, 1, 3);
            this.layoutManagerformKONTO.SetColumnSpan(this.labelKONT, 1);
            this.layoutManagerformKONTO.SetRowSpan(this.labelKONT, 1);
            padding = new Padding(0, 1, 3, 2);
            this.labelKONT.Margin = padding;
            size = new System.Drawing.Size(0x240, 0x2c);
            this.labelKONT.MinimumSize = size;
            size = new System.Drawing.Size(0x240, 0x2c);
            this.labelKONT.Size = size;
            this.labelKONT.Dock = DockStyle.Fill;
            this.Controls.Add(this.layoutManagerformKONTO);
            this.SetNullItem.Index   = 0;
            this.SetNullItem.Text    = "Set Null";
            this.SetNullItem.Click  += new EventHandler(this.SetNullItem_Click);
            this.contextMenu1.Popup += new EventHandler(this.contextMenu1_Popup);
            this.contextMenu1.MenuItems.AddRange(new MenuItem[] { this.SetNullItem });
            this.errorProvider1.DataSource             = this.bindingSourceKONTO;
            this.errorProviderValidator1.ErrorProvider = this.errorProvider1;
            this.Name       = "KONTOFormUserControl";
            this.Text       = "Kontni plan";
            this.AutoSize   = true;
            this.AutoScroll = true;
            this.Load      += new EventHandler(this.KONTOFormUserControl_Load);
            this.layoutManagerformKONTO.ResumeLayout(false);
            this.layoutManagerformKONTO.PerformLayout();
            ((ISupportInitialize)this.bindingSourceKONTO).EndInit();
            ((ISupportInitialize)this.textIDKONTO).EndInit();
            ((ISupportInitialize)this.textNAZIVKONTO).EndInit();
            this.dsKONTODataSet1.EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();
        }
Beispiel #50
0
        public StockViewer(Product asd, int mode)
        {
            prod = asd;

            Label l1 = new Label();

            l1.Anchor    = System.Windows.Forms.AnchorStyles.Left;
            l1.AutoSize  = true;
            l1.Font      = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            l1.Location  = new System.Drawing.Point(74, 5);
            l1.Name      = "label1";
            l1.Size      = new System.Drawing.Size(55, 16);
            l1.TabIndex  = 2;
            l1.Text      = prod.NAME;
            l1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;

            TextBox tb = new TextBox();

            tb.Anchor   = System.Windows.Forms.AnchorStyles.None;
            tb.Location = new System.Drawing.Point(15, 32);
            tb.Name     = "textBox1";
            tb.Text     = prod.STOCK + "";
            tb.Size     = new System.Drawing.Size(166, 20);
            tb.TabIndex = 4;

            CheckBox cb = new CheckBox();

            cb.Text            = "Ilimitado";
            cb.Location        = new System.Drawing.Point(36, 64);
            cb.Checked         = prod.unlimitedSTOCK;
            cb.CheckedChanged += (sender2, e2) => chec(cb, tb);

            Button b1 = new Button();

            b1.Location = new System.Drawing.Point(2, 33);
            b1.Name     = "button1";
            b1.Size     = new System.Drawing.Size(30, 30);
            b1.TabIndex = 3;
            b1.Text     = "-";
            b1.UseVisualStyleBackColor = true;
            b1.Click += (sender2, e2) => remove(cb, tb);

            Button b2 = new Button();

            b2.Location = new System.Drawing.Point(214, 33);
            b2.Name     = "button2";
            b2.Size     = new System.Drawing.Size(30, 30);
            b2.TabIndex = 5;
            b2.Text     = "+";
            b2.Click   += (sender2, e2) => add(cb, tb);
            b2.UseVisualStyleBackColor = true;

            PictureBox pb = new PictureBox();

            pb.Location    = new System.Drawing.Point(38, 5);
            pb.Name        = "pictureBox1";
            pb.Size        = new System.Drawing.Size(30, 28);
            pb.SizeMode    = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            pb.TabIndex    = 1;
            pb.TabStop     = false;
            pb.BorderStyle = BorderStyle.Fixed3D;
            pb.Image       = Databases.getImage(prod.IDENTIFIER);

            Button b3 = new Button();

            b3.Location = new System.Drawing.Point(2, 87);
            b3.Name     = "button3";
            b3.Size     = new System.Drawing.Size(241, 23);
            b3.TabIndex = 6;
            b3.Text     = "Confirmar";
            b3.UseVisualStyleBackColor = true;
            b3.Click += (sender2, e2) => save();

            if (prod.unlimitedSTOCK == true)
            {
                tb.Text = "Ilimitado";
            }

            BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            Controls.Add(pb);
            Controls.Add(l1);
            Controls.Add(b1);
            Controls.Add(b2);
            Controls.Add(tb);
            Controls.Add(cb);
            Controls.Add(b3);
            //p.Location = new System.Drawing.Point(196, 39);
            Size     = new System.Drawing.Size(248, 115);
            TabIndex = 1;

            if (mode == 1)
            {
                Timer timer = new Timer();
                timer.Tag      = "Timer";
                timer.Interval = 500;
                timer.Tick    += (sender2, e2) => vanish(timer);
                timer.Start();
                BackColor = SystemColors.Highlight;
            }
        }
Beispiel #51
0
        public static ConnectionTag CreateNewSerialConnection(IWin32Window parent, SerialTerminalParam param)
        {
            bool       successful = false;
            FileStream strm       = null;

            try
            {
                string portstr = String.Format("\\\\.\\COM{0}", param.Port);
                IntPtr ptr     = Win32.CreateFile(portstr, Win32.GENERIC_READ | Win32.GENERIC_WRITE, 0, IntPtr.Zero, Win32.OPEN_EXISTING, Win32.FILE_ATTRIBUTE_NORMAL | Win32.FILE_FLAG_OVERLAPPED, IntPtr.Zero);
                if (ptr == Win32.INVALID_HANDLE_VALUE)
                {
                    string msg = GEnv.Strings.GetString("Message.CommunicationUtil.FailedToOpenSerial");
                    int    err = Win32.GetLastError();
                    if (err == 2)
                    {
                        msg += GEnv.Strings.GetString("Message.CommunicationUtil.NoSuchDevice");
                    }
                    else if (err == 5)
                    {
                        msg += GEnv.Strings.GetString("Message.CommunicationUtil.DeviceIsBusy");
                    }
                    else
                    {
                        msg += "\nGetLastError=" + Win32.GetLastError();
                    }
                    throw new Exception(msg);
                }
                //strm = new FileStream(ptr, FileAccess.Write, true, 8, true);
                Win32.DCB dcb = new Win32.DCB();
                FillDCB(ptr, ref dcb);
                UpdateDCB(ref dcb, param);

                if (!Win32.SetCommState(ptr, ref dcb))
                {
                    throw new Exception(GEnv.Strings.GetString("Message.CommunicationUtil.FailedToConfigSerial"));
                }
                Win32.COMMTIMEOUTS timeouts = new Win32.COMMTIMEOUTS();
                Win32.GetCommTimeouts(ptr, ref timeouts);
                timeouts.ReadIntervalTimeout         = 0xFFFFFFFF;
                timeouts.ReadTotalTimeoutConstant    = 0;
                timeouts.ReadTotalTimeoutMultiplier  = 0;
                timeouts.WriteTotalTimeoutConstant   = 100;
                timeouts.WriteTotalTimeoutMultiplier = 100;
                Win32.SetCommTimeouts(ptr, ref timeouts);
                successful = true;
                System.Drawing.Size      sz = GEnv.Frame.TerminalSizeForNextConnection;
                SerialTerminalConnection r  = new SerialTerminalConnection(param, ptr, sz.Width, sz.Height);
                r.SetServerInfo("COM" + param.Port, null);
                return(new ConnectionTag(r));
            }
            catch (Exception ex)
            {
                GUtil.Warning(parent, ex.Message);
                return(null);
            }
            finally
            {
                if (!successful && strm != null)
                {
                    strm.Close();
                }
            }
        }
Beispiel #52
0
        public static Gdip.Icon RenderToIcon(Geometry geometry, Brush brush, Gdip.Size originalSize, Gdip.Size size)
        {
            BitmapSource source = Render(geometry, brush, originalSize, size);

            using (Gdip.Bitmap bitmap = ConvertBitmap(source))
            {
                return(Gdip.Icon.FromHandle(bitmap.GetHicon()));
            }
        }
Beispiel #53
0
 protected override void ChangeDesktopSize(DesktopSize desktopSize, System.Drawing.Size size)
 {
 }
        private void InitializeComponent()
        {
            this.ComboBox1    = new ComboBox();
            this.Label3       = new Label();
            this.Dungeon      = new CheckBox();
            this.ProjectName  = new TextBox();
            this.Label2       = new Label();
            this.Label1       = new Label();
            this.ProjectPath  = new TextBox();
            this.TerrainFile  = new TextBox();
            this.ComboBox2    = new ComboBox();
            this.Label5       = new Label();
            this.AltitudeFile = new TextBox();
            this.MainMenu1    = new MainMenu();
            this.MenuPath     = new MenuItem();
            this.MenuTerrain  = new MenuItem();
            this.Label4       = new Label();
            this.Label6       = new Label();
            this.Label7       = new Label();
            this.ProgressBar1 = new ProgressBar();
            this.SuspendLayout();
            ComboBox comboBox1 = this.ComboBox1;
            Point    point     = new Point(200, 72);

            comboBox1.Location  = point;
            this.ComboBox1.Name = "ComboBox1";
            ComboBox comboBox = this.ComboBox1;

            System.Drawing.Size size = new System.Drawing.Size(144, 21);
            comboBox.Size           = size;
            this.ComboBox1.Sorted   = true;
            this.ComboBox1.TabIndex = 38;
            this.Label3.AutoSize    = true;
            Label label3 = this.Label3;

            point            = new Point(200, 56);
            label3.Location  = point;
            this.Label3.Name = "Label3";
            Label label = this.Label3;

            size                 = new System.Drawing.Size(79, 16);
            label.Size           = size;
            this.Label3.TabIndex = 37;
            this.Label3.Text     = "Default Terrain";
            CheckBox dungeon = this.Dungeon;

            point             = new Point(352, 72);
            dungeon.Location  = point;
            this.Dungeon.Name = "Dungeon";
            CheckBox checkBox = this.Dungeon;

            size                  = new System.Drawing.Size(24, 24);
            checkBox.Size         = size;
            this.Dungeon.TabIndex = 36;
            TextBox projectName = this.ProjectName;

            point = new Point(272, 24);
            projectName.Location  = point;
            this.ProjectName.Name = "ProjectName";
            TextBox textBox = this.ProjectName;

            size         = new System.Drawing.Size(152, 20);
            textBox.Size = size;
            this.ProjectName.TabIndex = 35;
            this.ProjectName.Text     = "";
            this.Label2.AutoSize      = true;
            Label label2 = this.Label2;

            point            = new Point(272, 8);
            label2.Location  = point;
            this.Label2.Name = "Label2";
            Label label21 = this.Label2;

            size                 = new System.Drawing.Size(73, 16);
            label21.Size         = size;
            this.Label2.TabIndex = 34;
            this.Label2.Text     = "Project Name";
            this.Label1.AutoSize = true;
            Label label1 = this.Label1;

            point            = new Point(8, 8);
            label1.Location  = point;
            this.Label1.Name = "Label1";
            Label label11 = this.Label1;

            size                 = new System.Drawing.Size(31, 16);
            label11.Size         = size;
            this.Label1.TabIndex = 33;
            this.Label1.Text     = "Path:";
            TextBox projectPath = this.ProjectPath;

            point = new Point(8, 24);
            projectPath.Location  = point;
            this.ProjectPath.Name = "ProjectPath";
            TextBox projectPath1 = this.ProjectPath;

            size = new System.Drawing.Size(256, 20);
            projectPath1.Size         = size;
            this.ProjectPath.TabIndex = 32;
            this.ProjectPath.Text     = "";
            TextBox terrainFile = this.TerrainFile;

            point = new Point(8, 120);
            terrainFile.Location  = point;
            this.TerrainFile.Name = "TerrainFile";
            TextBox terrainFile1 = this.TerrainFile;

            size = new System.Drawing.Size(104, 20);
            terrainFile1.Size         = size;
            this.TerrainFile.TabIndex = 41;
            this.TerrainFile.Text     = "Terrain.bmp";
            ComboBox comboBox2 = this.ComboBox2;

            point = new Point(8, 72);
            comboBox2.Location  = point;
            this.ComboBox2.Name = "ComboBox2";
            ComboBox comboBox21 = this.ComboBox2;

            size                    = new System.Drawing.Size(184, 21);
            comboBox21.Size         = size;
            this.ComboBox2.TabIndex = 40;
            this.Label5.AutoSize    = true;
            this.Label5.ForeColor   = Color.Black;
            Label label5 = this.Label5;

            point            = new Point(8, 56);
            label5.Location  = point;
            this.Label5.Name = "Label5";
            Label label51 = this.Label5;

            size                 = new System.Drawing.Size(89, 16);
            label51.Size         = size;
            this.Label5.TabIndex = 42;
            this.Label5.Text     = "Select Map Size:";
            TextBox altitudeFile = this.AltitudeFile;

            point = new Point(120, 120);
            altitudeFile.Location  = point;
            this.AltitudeFile.Name = "AltitudeFile";
            TextBox altitudeFile1 = this.AltitudeFile;

            size = new System.Drawing.Size(104, 20);
            altitudeFile1.Size         = size;
            this.AltitudeFile.TabIndex = 47;
            this.AltitudeFile.Text     = "Altitude.bmp";
            System.Windows.Forms.Menu.MenuItemCollection menuItems = this.MainMenu1.MenuItems;
            MenuItem[] menuPath = new MenuItem[] { this.MenuPath, this.MenuTerrain };
            menuItems.AddRange(menuPath);
            this.MenuPath.Index    = 0;
            this.MenuPath.Text     = "Path";
            this.MenuTerrain.Index = 1;
            this.MenuTerrain.Text  = "Make Terrain/Altitude Image";
            this.Label4.AutoSize   = true;
            Label label4 = this.Label4;

            point            = new Point(352, 56);
            label4.Location  = point;
            this.Label4.Name = "Label4";
            Label label41 = this.Label4;

            size                 = new System.Drawing.Size(77, 16);
            label41.Size         = size;
            this.Label4.TabIndex = 48;
            this.Label4.Text     = "Dungeon Area";
            this.Label6.AutoSize = true;
            Label label6 = this.Label6;

            point            = new Point(120, 104);
            label6.Location  = point;
            this.Label6.Name = "Label6";
            Label label61 = this.Label6;

            size                 = new System.Drawing.Size(102, 16);
            label61.Size         = size;
            this.Label6.TabIndex = 50;
            this.Label6.Text     = "Altitude Image Map";
            this.Label7.AutoSize = true;
            Label label7 = this.Label7;

            point                  = new Point(8, 104);
            label7.Location        = point;
            this.Label7.Name       = "Label7";
            this.Label7.TabIndex   = 49;
            this.Label7.Text       = "Terrain Image Map";
            this.ProgressBar1.Dock = DockStyle.Bottom;
            ProgressBar progressBar1 = this.ProgressBar1;

            point = new Point(0, 151);
            progressBar1.Location  = point;
            this.ProgressBar1.Name = "ProgressBar1";
            ProgressBar progressBar = this.ProgressBar1;

            size                       = new System.Drawing.Size(430, 16);
            progressBar.Size           = size;
            this.ProgressBar1.TabIndex = 51;
            size                       = new System.Drawing.Size(5, 13);
            this.AutoScaleBaseSize     = size;
            this.BackColor             = Color.FromArgb(224, 224, 224);
            size                       = new System.Drawing.Size(430, 167);
            this.ClientSize            = size;
            this.Controls.Add(this.ProgressBar1);
            this.Controls.Add(this.Label6);
            this.Controls.Add(this.Label7);
            this.Controls.Add(this.Label4);
            this.Controls.Add(this.AltitudeFile);
            this.Controls.Add(this.ProjectName);
            this.Controls.Add(this.Label2);
            this.Controls.Add(this.Label1);
            this.Controls.Add(this.ProjectPath);
            this.Controls.Add(this.Label5);
            this.Controls.Add(this.ComboBox2);
            this.Controls.Add(this.ComboBox1);
            this.Controls.Add(this.Label3);
            this.Controls.Add(this.Dungeon);
            this.Controls.Add(this.TerrainFile);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
            this.Menu            = this.MainMenu1;
            this.Name            = "MakeMapImage";
            this.Text            = "Make New Image Map";
            this.ResumeLayout(false);
        }
Beispiel #55
0
        public void Show(Form p, string lname, Icon icon, System.Drawing.Size size, System.Drawing.Point pos, string caption, Entry[] e, Object t)
        {
            logicalname = lname; // passed back to caller via trigger
            entries     = e;
            callertag   = t;     // passed back to caller via trigger

            ThemeableForms theme = ThemeableFormsInstance.Instance;

            FormBorderStyle = FormBorderStyle.FixedDialog;

            if (theme.WindowsFrame)
            {
                size.Height += 50;
            }

            Size = size;

            if (pos.X == -999)
            {
                StartPosition = FormStartPosition.CenterScreen;
            }
            else
            {
                Location      = pos;
                StartPosition = FormStartPosition.Manual;
            }

            Panel outer = new Panel()
            {
                Dock = DockStyle.Fill, BorderStyle = BorderStyle.FixedSingle
            };

            outer.MouseDown += FormMouseDown;
            outer.MouseUp   += FormMouseUp;

            Controls.Add(outer);

            this.Text = caption;

            Label textLabel = new Label()
            {
                Left = 4, Top = 8, Width = Width - 50, Text = caption
            };

            textLabel.MouseDown += FormMouseDown;
            textLabel.MouseUp   += FormMouseUp;

            if (!theme.WindowsFrame)
            {
                outer.Controls.Add(textLabel);
            }

            ToolTip tt = new ToolTip(components);

            tt.ShowAlways = true;
            for (int i = 0; i < entries.Length; i++)
            {
                Entry   ent = entries[i];
                Control c   = (Control)Activator.CreateInstance(ent.controltype);
                ent.control = c;
                c.Size      = ent.size;
                c.Location  = ent.pos;
                if (!(c is ExtendedControls.ComboBoxCustom))        // everything but get text
                {
                    c.Text = ent.text;
                }
                c.Tag = ent;     // point control tag at ent structure
                outer.Controls.Add(c);
                if (ent.tooltip != null)
                {
                    tt.SetToolTip(c, ent.tooltip);
                }

                if (c is ExtendedControls.ButtonExt)
                {
                    ExtendedControls.ButtonExt b = c as ExtendedControls.ButtonExt;
                    b.Click += (sender, ev) =>
                    {
                        Entry en = (Entry)(((Control)sender).Tag);
                        Trigger?.Invoke(logicalname, en.name, callertag);       // pass back the logical name of dialog, the name of the control, the caller tag
                    };
                }

                if (c is ExtendedControls.TextBoxBorder)
                {
                    ExtendedControls.TextBoxBorder tb = c as ExtendedControls.TextBoxBorder;
                    tb.Multiline = tb.WordWrap = ent.textboxmultiline;
                }

                if (c is ExtendedControls.CheckBoxCustom)
                {
                    ExtendedControls.CheckBoxCustom cb = c as ExtendedControls.CheckBoxCustom;
                    cb.Checked = ent.checkboxchecked;
                    cb.Click  += (sender, ev) =>
                    {
                        Entry en = (Entry)(((Control)sender).Tag);
                        Trigger?.Invoke(logicalname, en.name, callertag);       // pass back the logical name of dialog, the name of the control, the caller tag
                    };
                }

                if (c is ExtendedControls.ComboBoxCustom)
                {
                    ExtendedControls.ComboBoxCustom cb = c as ExtendedControls.ComboBoxCustom;
                    cb.Items.AddRange(ent.comboboxitems.Split(','));
                    if (cb.Items.Contains(ent.text))
                    {
                        cb.SelectedItem = ent.text;
                    }
                    cb.SelectedIndexChanged += (sender, ev) =>
                    {
                        Control ctr = (Control)sender;
                        if (ctr.Enabled)
                        {
                            Entry en = (Entry)(ctr.Tag);
                            Trigger?.Invoke(logicalname, en.name, callertag);       // pass back the logical name of dialog, the name of the control, the caller tag
                        }
                    };
                }
            }

            ShowInTaskbar = false;

            this.Icon = icon;

            theme.ApplyToForm(this, System.Drawing.SystemFonts.DefaultFont);

            Show(p);
        }
Beispiel #56
0
 public static Bitmap DrawToBitmap(this RichTextBox @this, DrawingSize size) => DrawToBitmap(@this, size.Width, size.Height);
Beispiel #57
0
        public static BitmapSource Render(Geometry geometry, Brush brush, Gdip.Size originalSize, Gdip.Size size)
        {
            Path path = new Path
            {
                Data   = geometry,
                Fill   = brush,
                Width  = originalSize.Width,
                Height = originalSize.Height,
            };
            Viewbox vbox = new Viewbox
            {
                Width  = size.Width,
                Height = size.Height,
                Child  = path,
            };

            vbox.Measure(new Size(size.Width, size.Height));
            vbox.Arrange(new Rect(0.0, 0.0, size.Width, size.Height));

            RenderTargetBitmap bitmap = new RenderTargetBitmap(size.Width, size.Height, 96, 96, PixelFormats.Pbgra32);

            bitmap.Render(vbox);

            return(bitmap);
        }
Beispiel #58
0
 public Entry(string nam, Type c, string t, System.Drawing.Point p, System.Drawing.Size s, string tt)
 {
     controltype = c; text = t; pos = p; size = s; tooltip = tt; name = nam;
 }
Beispiel #59
0
        /// <summary>
        /// 绘制
        /// </summary>
        /// <param name="g"></param>
        /// <param name="center"></param>
        /// <param name="zoom"></param>
        /// <param name="screen_size"></param>
        public override void Draw(System.Drawing.Graphics g, LatLngPoint center, int zoom, System.Drawing.Size screen_size)
        {
            //不同路线绘制不一样 数据源结构也不一样
            if (DataSource != null)
            {
                g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; //质量优先

                LatLngPoint first, second;
                Point       s_first = new Point(), s_second = new Point();
                if (Type == RouteType.Transit)                                  //公交
                {
                    using (Pen p = new Pen(Color.FromArgb(250, Color.Blue), 6)) //蓝色
                    {
                        p.StartCap = System.Drawing.Drawing2D.LineCap.Round;    //连接圆滑
                        p.EndCap   = System.Drawing.Drawing2D.LineCap.Round;
                        p.LineJoin = System.Drawing.Drawing2D.LineJoin.Round;
                        JToken route = DataSource["scheme"][0];
                        foreach (JArray array in route["steps"])
                        {
                            if ((string)array[0]["type"] == "5") //步行
                            {
                                using (Pen p2 = new Pen(Color.FromArgb(250, Color.Gray), 6))
                                {
                                    p2.StartCap = System.Drawing.Drawing2D.LineCap.Round; //连接圆滑
                                    p2.EndCap   = System.Drawing.Drawing2D.LineCap.Round;
                                    p2.LineJoin = System.Drawing.Drawing2D.LineJoin.Round;

                                    string[] points = ((string)array[0]["path"]).Split(';'); //每一步骤中的点

                                    for (int i = points.Length - 1; i > 0; --i)
                                    {
                                        first    = new LatLngPoint(double.Parse(points[i - 1].Split(',')[0]), double.Parse(points[i - 1].Split(',')[1]));
                                        second   = new LatLngPoint(double.Parse(points[i].Split(',')[0]), double.Parse(points[i].Split(',')[1]));
                                        s_first  = MapHelper.GetScreenLocationByLatLng(first, center, zoom, screen_size);
                                        s_second = MapHelper.GetScreenLocationByLatLng(second, center, zoom, screen_size);
                                        if (new Rectangle(new Point(0, 0), screen_size).Contains(s_first) || new Rectangle(new Point(0, 0), screen_size).Contains(s_second)) //在屏幕范围内
                                        {
                                            g.DrawLine(p2, s_first, s_second);
                                        }
                                    }
                                }
                            }
                            else //公交 地铁
                            {
                                string transits   = "";
                                double duration   = 0;
                                int    type       = 0; //公交 还是 地铁
                                string start_name = "";
                                duration   = double.Parse((string)array[0]["duration"]);
                                type       = int.Parse((string)array[0]["vehicle"]["type"]);
                                start_name = (string)array[0]["vehicle"]["start_name"];
                                foreach (JObject jo in array) //多种方案
                                {
                                    transits += ((string)jo["vehicle"]["name"] + "/");
                                }
                                transits = transits.TrimEnd(new char[] { '/' });
                                //只绘制一个方案即可

                                string[] points = ((string)array[0]["path"]).Split(';'); //每一步骤中的点

                                for (int i = points.Length - 1; i > 0; --i)
                                {
                                    first    = new LatLngPoint(double.Parse(points[i - 1].Split(',')[0]), double.Parse(points[i - 1].Split(',')[1]));
                                    second   = new LatLngPoint(double.Parse(points[i].Split(',')[0]), double.Parse(points[i].Split(',')[1]));
                                    s_first  = MapHelper.GetScreenLocationByLatLng(first, center, zoom, screen_size);
                                    s_second = MapHelper.GetScreenLocationByLatLng(second, center, zoom, screen_size);
                                    if (new Rectangle(new Point(0, 0), screen_size).Contains(s_first) || new Rectangle(new Point(0, 0), screen_size).Contains(s_second)) //在屏幕范围内
                                    {
                                        g.DrawLine(p, s_first, s_second);
                                    }

                                    if (i == 1) //起点
                                    {
                                        using (Font f = new Font("微软雅黑", 8))
                                        {
                                            string info      = start_name + " 上车\n乘坐" + transits + " \n车程约" + Math.Round(duration / 60, 0) + "分钟";
                                            Size   info_size = TextRenderer.MeasureText(info, f);

                                            GraphicsPath pt = new GraphicsPath();

                                            pt.AddPolygon(new Point[] { new Point(s_first.X - info_size.Width / 2 - 5, s_first.Y - 25),
                                                                        new Point(s_first.X - info_size.Width / 2 - 5, s_first.Y - 25 - info_size.Height - 10),
                                                                        new Point(s_first.X + info_size.Width / 2 + 5, s_first.Y - 25 - info_size.Height - 10),
                                                                        new Point(s_first.X + info_size.Width / 2 + 5, s_first.Y - 25),
                                                                        new Point(s_first.X + 8, s_first.Y - 25),
                                                                        new Point(s_first.X, s_first.Y - 15),
                                                                        new Point(s_first.X - 8, s_first.Y - 25) });
                                            g.FillPath(Brushes.Wheat, pt);
                                            g.DrawPath(Pens.LightGray, pt);
                                            g.DrawString(info, new Font("微软雅黑", 9), Brushes.Black, new PointF(s_first.X - info_size.Width / 2, s_first.Y - info_size.Height - 25 - 5));

                                            Bitmap b = type == 0 ? Properties.BMap.ico_bybus : Properties.BMap.ico_bysubway; //0公交 1地铁轻轨

                                            g.DrawImage(b, new Rectangle(s_first.X - b.Width / 2, s_first.Y - b.Height / 2, b.Width, b.Height));
                                        }
                                    }
                                    if (i == points.Length - 1)                                                          //终点
                                    {
                                        Bitmap b = type == 0 ? Properties.BMap.ico_bybus : Properties.BMap.ico_bysubway; //0公交 1地铁轻轨

                                        g.DrawImage(b, new Rectangle(s_second.X - b.Width / 2, s_second.Y - b.Height / 2, b.Width, b.Height));
                                    }
                                }
                            }
                        }
                    }
                }
                else if (Type == RouteType.Driving)                              //驾车
                {
                    using (Pen p = new Pen(Color.FromArgb(250, Color.Green), 6)) //绿色
                    {
                        p.StartCap = System.Drawing.Drawing2D.LineCap.Round;     //连接圆滑
                        p.EndCap   = System.Drawing.Drawing2D.LineCap.Round;
                        p.LineJoin = System.Drawing.Drawing2D.LineJoin.Round;
                        foreach (JObject step in DataSource["steps"])
                        {
                            first   = new LatLngPoint(double.Parse((string)step["stepOriginLocation"]["lng"]), double.Parse((string)step["stepOriginLocation"]["lat"]));
                            s_first = MapHelper.GetScreenLocationByLatLng(first, center, zoom, screen_size); //第一点

                            string[] points = ((string)step["path"]).Split(';');                             //每一步骤中的点
                            for (int i = 0; i < points.Length; ++i)
                            {
                                if (i == 0) //与前一点连接
                                {
                                    second   = new LatLngPoint(double.Parse(points[i].Split(',')[0]), double.Parse(points[i].Split(',')[1]));
                                    s_second = MapHelper.GetScreenLocationByLatLng(second, center, zoom, screen_size);
                                    if (new Rectangle(new Point(0, 0), screen_size).Contains(s_first) || new Rectangle(new Point(0, 0), screen_size).Contains(s_second)) //在屏幕范围内
                                    {
                                        g.DrawLine(p, s_first, s_second);
                                    }
                                }
                                else
                                {
                                    first    = new LatLngPoint(double.Parse(points[i - 1].Split(',')[0]), double.Parse(points[i - 1].Split(',')[1]));
                                    second   = new LatLngPoint(double.Parse(points[i].Split(',')[0]), double.Parse(points[i].Split(',')[1]));
                                    s_first  = MapHelper.GetScreenLocationByLatLng(first, center, zoom, screen_size);
                                    s_second = MapHelper.GetScreenLocationByLatLng(second, center, zoom, screen_size);
                                    if (new Rectangle(new Point(0, 0), screen_size).Contains(s_first) || new Rectangle(new Point(0, 0), screen_size).Contains(s_second)) //在屏幕范围内
                                    {
                                        g.DrawLine(p, s_first, s_second);
                                    }
                                }
                            }
                            s_first = s_second;

                            second   = new LatLngPoint(double.Parse((string)step["stepDestinationLocation"]["lng"]), double.Parse((string)step["stepDestinationLocation"]["lat"]));
                            s_second = MapHelper.GetScreenLocationByLatLng(second, center, zoom, screen_size);
                            if (new Rectangle(new Point(0, 0), screen_size).Contains(s_first) || new Rectangle(new Point(0, 0), screen_size).Contains(s_second)) //在屏幕范围内
                            {
                                g.DrawLine(p, s_first, s_second);                                                                                                //最后一点
                            }
                        }
                    }
                }
                else //步行
                {
                    using (Pen p = new Pen(Color.FromArgb(250, Color.Gray), 6)) //灰色
                    {
                        p.StartCap = System.Drawing.Drawing2D.LineCap.Round; //连接圆滑
                        p.EndCap   = System.Drawing.Drawing2D.LineCap.Round;
                        p.LineJoin = System.Drawing.Drawing2D.LineJoin.Round;
                        foreach (JObject step in DataSource["steps"])
                        {
                            first   = new LatLngPoint(double.Parse((string)step["stepOriginLocation"]["lng"]), double.Parse((string)step["stepOriginLocation"]["lat"]));
                            s_first = MapHelper.GetScreenLocationByLatLng(first, center, zoom, screen_size); //第一点

                            string[] points = ((string)step["path"]).Split(';');                             //每一步骤中的点
                            for (int i = 0; i < points.Length; ++i)
                            {
                                if (i == 0) //与前一点连接
                                {
                                    second   = new LatLngPoint(double.Parse(points[i].Split(',')[0]), double.Parse(points[i].Split(',')[1]));
                                    s_second = MapHelper.GetScreenLocationByLatLng(second, center, zoom, screen_size);
                                    if (new Rectangle(new Point(0, 0), screen_size).Contains(s_first) || new Rectangle(new Point(0, 0), screen_size).Contains(s_second)) //在屏幕范围内
                                    {
                                        g.DrawLine(p, s_first, s_second);
                                    }
                                }
                                else
                                {
                                    first    = new LatLngPoint(double.Parse(points[i - 1].Split(',')[0]), double.Parse(points[i - 1].Split(',')[1]));
                                    second   = new LatLngPoint(double.Parse(points[i].Split(',')[0]), double.Parse(points[i].Split(',')[1]));
                                    s_first  = MapHelper.GetScreenLocationByLatLng(first, center, zoom, screen_size);
                                    s_second = MapHelper.GetScreenLocationByLatLng(second, center, zoom, screen_size);
                                    if (new Rectangle(new Point(0, 0), screen_size).Contains(s_first) || new Rectangle(new Point(0, 0), screen_size).Contains(s_second)) //在屏幕范围内
                                    {
                                        g.DrawLine(p, s_first, s_second);
                                    }
                                }
                            }
                            s_first = s_second;

                            second   = new LatLngPoint(double.Parse((string)step["stepDestinationLocation"]["lng"]), double.Parse((string)step["stepDestinationLocation"]["lat"]));
                            s_second = MapHelper.GetScreenLocationByLatLng(second, center, zoom, screen_size);
                            if (new Rectangle(new Point(0, 0), screen_size).Contains(s_first) || new Rectangle(new Point(0, 0), screen_size).Contains(s_second)) //在屏幕范围内
                            {
                                g.DrawLine(p, s_first, s_second);                                                                                                //最后一点
                            }
                        }
                    }
                }

                if (HighlightPath != null)
                {
                    using (Pen p3 = new Pen(Color.FromArgb(250, Color.Red), 6))
                    {
                        p3.StartCap = System.Drawing.Drawing2D.LineCap.Round; //连接圆滑
                        p3.EndCap   = System.Drawing.Drawing2D.LineCap.Round;
                        p3.LineJoin = System.Drawing.Drawing2D.LineJoin.Round;
                        string[] points = HighlightPath.Split(';'); //高亮部分中的点
                        for (int i = points.Length - 1; i > 0; --i)
                        {
                            first    = new LatLngPoint(double.Parse(points[i - 1].Split(',')[0]), double.Parse(points[i - 1].Split(',')[1]));
                            second   = new LatLngPoint(double.Parse(points[i].Split(',')[0]), double.Parse(points[i].Split(',')[1]));
                            s_first  = MapHelper.GetScreenLocationByLatLng(first, center, zoom, screen_size);
                            s_second = MapHelper.GetScreenLocationByLatLng(second, center, zoom, screen_size);
                            if (new Rectangle(new Point(0, 0), screen_size).Contains(s_first) || new Rectangle(new Point(0, 0), screen_size).Contains(s_second)) //在屏幕范围内
                            {
                                g.DrawLine(p3, s_first, s_second);
                            }
                        }
                    }
                }
            }
        }
Beispiel #60
0
        public MarqueeDisplay130(LedPictureText pContent)
        {
            System.Drawing.Size size = pContent.GetSize();
            this.content      = pContent;
            this.nowLoopNum   = 1;
            this.nowPositionF = (float)(-(float)size.Width);
            LedElement ledElement = pContent.Elements[0];
            int        num        = 0;
            int        num2;

            if (ledElement.PageCount >= 3)
            {
                num2 = 3;
                ledElement.PageNumber = 3;
            }
            else
            {
                num2 = ledElement.PageCount;
                ledElement.PageNumber = ledElement.PageCount - 1;
            }
            int  num3 = size.Width * num2;
            bool flag = false;
            int  num4 = pContent.EffectiveLength;

            if (num3 > pContent.EffectiveLength)
            {
                num3 = pContent.EffectiveLength;
            }
            if (pContent.EffectiveLength < size.Width)
            {
                if (pContent.EffectiveLength == 0)
                {
                    num3 = size.Width;
                    num4 = size.Width;
                }
                else
                {
                    num3 = (size.Width / pContent.EffectiveLength + 1) * num3;
                    num4 = pContent.EffectiveLength;
                }
                flag = true;
            }
            this.AllBit = new System.Drawing.Bitmap(num3, size.Height);
            System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(this.AllBit);
            for (int i = 0; i < num2; i++)
            {
                System.Drawing.Bitmap bmpFromFile = LedGraphics.GetBmpFromFile(size, i, this.content.GetFileFullPath());
                if (flag)
                {
                    for (int j = 0; j < num3; j += num4)
                    {
                        graphics.DrawImage(bmpFromFile, new System.Drawing.Rectangle(j, 0, num4, size.Height), new System.Drawing.Rectangle(0, 0, num4, size.Height), System.Drawing.GraphicsUnit.Pixel);
                    }
                }
                else
                {
                    graphics.DrawImage(bmpFromFile, new System.Drawing.Point(num, 0));
                    num += bmpFromFile.Width;
                    bmpFromFile.Dispose();
                }
            }
        }