• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# SolidBrush类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中SolidBrush的典型用法代码示例。如果您正苦于以下问题:C# SolidBrush类的具体用法?C# SolidBrush怎么用?C# SolidBrush使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SolidBrush类属于命名空间,在下文中一共展示了SolidBrush类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CreateImage

    private void CreateImage()
    {
        string code = GetRandomText();

        Bitmap bitmap = new Bitmap(200, 50, System.Drawing.Imaging.PixelFormat.Format32bppArgb);

        Graphics g = Graphics.FromImage(bitmap);
        Pen pen = new Pen(Color.Yellow);
        Rectangle rect = new Rectangle(0, 0, 200, 50);

        SolidBrush b = new SolidBrush(Color.Black);
        SolidBrush blue = new SolidBrush(Color.Blue);

        int counter = 0;

        g.DrawRectangle(pen, rect);
        g.FillRectangle(b, rect);

        for (int i = 0; i < code.Length; i++)
        {
            g.DrawString(code[i].ToString(), new Font("Verdena", 10 + rand.Next(14, 18)), blue, new PointF(10 + counter, 10));
            counter += 20;
        }

        DrawRandomLines(g);

        bitmap.Save(Response.OutputStream, ImageFormat.Gif);

        g.Dispose();
        bitmap.Dispose();
    }
开发者ID:karimkhanp,项目名称:Online_Education_Examinations,代码行数:31,代码来源:CaptchaControl.aspx.cs


示例2: Blockchange2

        protected override void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
            RevertAndClearState(p, x, y, z);
            CatchPos cpos = (CatchPos)p.blockchangeObject;
            GetRealBlock(type, extType, p, ref cpos);
            DrawOp drawOp = null;
            Brush brush = new SolidBrush(cpos.type, cpos.extType);
            
            if (y != cpos.y) {
                Player.SendMessage(p, "The two edges of the pyramid must be on the same level");
                return;
            }

            switch (cpos.solid) {
                case SolidType.solid:
                    drawOp = new PyramidSolidDrawOp(); break;
                case SolidType.hollow:
                    drawOp = new PyramidHollowDrawOp(); break;
                case SolidType.reverse:
                    drawOp = new PyramidReverseDrawOp(); break;
            }
            
            ushort x1 = Math.Min(cpos.x, x), x2 = Math.Max(cpos.x, x);
            ushort y1 = Math.Min(cpos.y, y), y2 = Math.Max(cpos.y, y);
            ushort z1 = Math.Min(cpos.z, z), z2 = Math.Max(cpos.z, z);            
            if (!DrawOp.DoDrawOp(drawOp, brush, p, x1, y1, z1, x2, y2, z2))
                return;
            if (p.staticCommands)
                p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
        }
开发者ID:tommyz56,项目名称:MCGalaxy,代码行数:29,代码来源:CmdPyramid.cs


示例3: CreateImage

    /// <summary>
    /// ����ͼƬ
    /// </summary>
    /// <param name="checkCode">�����</param>
    private void CreateImage(string checkCode)
    {
        int iwidth = (int)(checkCode.Length * 11.5);//����������趨ͼƬ���
        Bitmap image = new Bitmap(iwidth, 20);//����һ������
        Graphics g = Graphics.FromImage(image);//�ڻ����϶����ͼ��ʵ��
        Font f = new Font("Arial",10,FontStyle.Bold);//���壬��С����ʽ
        Brush b = new SolidBrush(Color.Black);//������ɫ
        //g.FillRectangle(new System.Drawing.SolidBrush(Color.Blue),0,0,image.Width, image.Height);
        g.Clear(Color.White);//������ɫ
        g.DrawString(checkCode, f, b, 3, 3);

        Pen blackPen = new Pen(Color.Black, 0);
        Random rand = new Random();
        /*�����
        for (int i = 0; i < 5; i++)
        {
            int y = rand.Next(image.Height);
            g.DrawLine(blackPen, 0, y, image.Width, y);
        }
        */
        System.IO.MemoryStream ms = new System.IO.MemoryStream();
        image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
        Response.ClearContent();
        Response.ContentType = "image/Jpeg";
        Response.BinaryWrite(ms.ToArray());
        g.Dispose();
        image.Dispose();
    }
开发者ID:vtmer,项目名称:NewStudent,代码行数:32,代码来源:checkCode.aspx.cs


示例4: LetterWatermark

    /// <summary>
    /// 文字水印处理方法
    /// </summary>
    /// <param name="path">图片路径(绝对路径)</param>
    /// <param name="size">字体大小</param>
    /// <param name="letter">水印文字</param>
    /// <param name="color">颜色</param>
    /// <param name="location">水印位置</param>
    public static string LetterWatermark(string path, int size, string letter, Color color, string location)
    {
        #region

        string kz_name = Path.GetExtension(path);
        if (kz_name == ".jpg" || kz_name == ".bmp" || kz_name == ".jpeg")
        {
            DateTime time = DateTime.Now;
            string filename = "" + time.Year.ToString() + time.Month.ToString() + time.Day.ToString() + time.Hour.ToString() + time.Minute.ToString() + time.Second.ToString() + time.Millisecond.ToString();
            Image img = Bitmap.FromFile(path);
            Graphics gs = Graphics.FromImage(img);
            ArrayList loca = GetLocation(location, img, size, letter.Length);
            Font font = new Font("宋体", size);
            Brush br = new SolidBrush(color);
            gs.DrawString(letter, font, br, float.Parse(loca[0].ToString()), float.Parse(loca[1].ToString()));
            gs.Dispose();
            string newpath = Path.GetDirectoryName(path) + filename + kz_name;
            img.Save(newpath);
            img.Dispose();
            File.Copy(newpath, path, true);
            if (File.Exists(newpath))
            {
                File.Delete(newpath);
            }
        }
        return path;

        #endregion
    }
开发者ID:kcly3027,项目名称:knowledge,代码行数:37,代码来源:ImageClass.cs


示例5: Paint

        protected override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle clipBounds, System.Drawing.Rectangle cellBounds, int rowIndex, 
            DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle,
            DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
        {
            if (null == value) value = 0;
             int progressVal;
            if (value != null)
                progressVal = (int) value;
            else
                progressVal = 1;

            float percentage = ((float)progressVal / 100.0f); // Need to convert to float before division; otherwise C# returns int which is 0 for anything but 100%.
            Brush backColorBrush = new SolidBrush(cellStyle.BackColor);
            Brush foreColorBrush = new SolidBrush(cellStyle.ForeColor);
            // Draws the cell grid
            base.Paint(g, clipBounds, cellBounds,
             rowIndex, cellState, value, formattedValue, errorText,
             cellStyle, advancedBorderStyle, (paintParts & ~DataGridViewPaintParts.ContentForeground));
            if (percentage > 0.0) {
                // Draw the progress bar and the text
                g.FillRectangle(new SolidBrush(Color.FromArgb(163, 189, 242)), cellBounds.X + 2, cellBounds.Y + 2, Convert.ToInt32((percentage * cellBounds.Width - 4)), cellBounds.Height - 4);
                g.DrawString(progressVal.ToString() + "%", cellStyle.Font, foreColorBrush, cellBounds.X + 6, cellBounds.Y + 4);
            } else {
                // draw the text
                if (null != this.DataGridView.CurrentRow && this.DataGridView.CurrentRow.Index == rowIndex)
                    g.DrawString(progressVal.ToString() + "%", cellStyle.Font, new SolidBrush(cellStyle.SelectionForeColor), cellBounds.X + 6, cellBounds.Y + 4);
                else
                    g.DrawString(progressVal.ToString() + "%", cellStyle.Font, foreColorBrush, cellBounds.X + 6, cellBounds.Y + 4);
            }
        }
开发者ID:noxdafox,项目名称:clips,代码行数:30,代码来源:DataGridViewProgressColumn.cs


示例6: OnPaint

    protected override void OnPaint(PaintEventArgs pevent)
    {
        var g = pevent.Graphics;
        g.SmoothingMode = SmoothingMode.AntiAlias;
        g.Clear(Parent.BackColor);

        Rectangle BGEllipse = new Rectangle(0, 0, 18, 18);

        EnabledCheckedColor = ColorTranslator.FromHtml(HexColor);
        SolidBrush BG = new SolidBrush(Enabled ? Checked ? EnabledCheckedColor : EnabledUnCheckedColor : DisabledColor);

        //RadioButton BG
        if (Checked)
        {
            g.FillEllipse(new SolidBrush(Color.FromArgb(Alpha, BG.Color)), BGEllipse);
            g.FillEllipse(new SolidBrush(Color.White), new Rectangle(2, 2, 14, 14));
        }
        else
        {
            g.FillEllipse(BG, BGEllipse);
            g.FillEllipse(new SolidBrush(Color.White), new Rectangle(2, 2, 14, 14));
        }       

        g.FillEllipse(BG, new Rectangle(PointAnimationNum, PointAnimationNum, SizeAnimationNum, SizeAnimationNum));       

        //RadioButton Text
        g.DrawString(Text, font.Roboto_Medium10, new SolidBrush(Enabled ? EnabledStringColor : DisabledStringColor), 20, 0);
    }
开发者ID:mr-amini,项目名称:ComU,代码行数:28,代码来源:LollipopRadioButton.cs


示例7: ValidateCode

    private void ValidateCode( string VNum )
    {
        Bitmap Img = null;
        Graphics g = null;
        MemoryStream ms = null;

        int gheight = VNum.Length * 10;
        Img = new Bitmap( gheight, 15 );
        g = Graphics.FromImage( Img );
        //背景颜色
        g.Clear( Color.White );
        //文字字体
        Font f = new Font( "宋体", 10 );
        //文字颜色
        SolidBrush s = new SolidBrush( Color.Red );
        g.DrawString( VNum, f, s, 3, 3 );
        ms = new MemoryStream();
        Img.Save( ms, ImageFormat.Jpeg );
        Response.ClearContent();
        Response.ContentType = "images/Jpeg";
        Response.BinaryWrite( ms.ToArray() );
        g.Dispose();
        Img.Dispose();
        Response.End();
    }
开发者ID:lincoln56,项目名称:robinerp,代码行数:25,代码来源:Getcode.aspx.cs


示例8: AddWatermark

    public void AddWatermark(string filename, ImageFormat imageFormat, Stream outputStream, HttpContext ctx)
    {
        Image bitmap = Image.FromFile(filename);
        Font font = new Font("Arial", 13, FontStyle.Bold, GraphicsUnit.Pixel);
        Random rnd = new Random();
        Color color = Color.FromArgb(200, rnd.Next(255), rnd.Next(255), rnd.Next(255)); //Adds a black watermark with a low alpha value (almost transparent).
        Point atPoint = new Point(bitmap.Width / 2 - 40, bitmap.Height / 2 - 7); //The pixel point to draw the watermark at (this example puts it at 100, 100 (x, y)).
        SolidBrush brush = new SolidBrush(color);

        string watermarkText = "voobrazi.by";

        Graphics graphics;
        try
        {
            graphics = Graphics.FromImage(bitmap);
        }
        catch
        {
            Image temp = bitmap;
            bitmap = new Bitmap(bitmap.Width, bitmap.Height);
            graphics = Graphics.FromImage(bitmap);
            graphics.DrawImage(temp, new Rectangle(0, 0, bitmap.Width, bitmap.Height), 0, 0, bitmap.Width, bitmap.Height, GraphicsUnit.Pixel);
            temp.Dispose();
        }

        graphics.DrawString(watermarkText, font, brush, atPoint);
        graphics.Dispose();

        bitmap.Save(outputStream, imageFormat);
        bitmap.Dispose();
    }
开发者ID:juliakolesen,项目名称:voobrazi.by,代码行数:31,代码来源:ImageHttpHandler.cs


示例9: HexView

	public HexView()
	{
		// Setup drawing objects
		NormalFontBrush = new SolidBrush(Color.Black);
		NormalFont = new Font("Courier New", 10);
        vsAddr.ValueChanged += this.VsAddr_ValueChanged;
	}
开发者ID:danlb2000,项目名称:Atari-Disk-Explorer,代码行数:7,代码来源:HexView.cs


示例10: Blockchange2

        protected override void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
            RevertAndClearState(p, x, y, z);
            CatchPos cpos = (CatchPos)p.blockchangeObject;
            GetRealBlock(type, extType, p, ref cpos);
            DrawOp drawOp = null;
            Brush brush = null;

            switch (cpos.solid) {
                case SolidType.solid:
                    drawOp = new CuboidDrawOp(); break;
                case SolidType.hollow:
                    drawOp = new CuboidHollowsDrawOp(); break;
                case SolidType.walls:
                    drawOp = new CuboidWallsDrawOp(); break;
                case SolidType.holes:
                    drawOp = new CuboidHolesDrawOp(); break;
                case SolidType.wire:
                    drawOp = new CuboidWireframeDrawOp(); break;
                case SolidType.random:
                    drawOp = new CuboidDrawOp();
                    brush = new RandomBrush(cpos.type, cpos.extType); break;
            }
            
            if (brush == null) brush = new SolidBrush(cpos.type, cpos.extType);
            ushort x1 = Math.Min(cpos.x, x), x2 = Math.Max(cpos.x, x);
            ushort y1 = Math.Min(cpos.y, y), y2 = Math.Max(cpos.y, y);
            ushort z1 = Math.Min(cpos.z, z), z2 = Math.Max(cpos.z, z);            
            if (!DrawOp.DoDrawOp(drawOp, brush, p, x1, y1, z1, x2, y2, z2))
                return;
            if (p.staticCommands)
                p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
        }
开发者ID:tommyz56,项目名称:MCGalaxy,代码行数:32,代码来源:CmdCuboid.cs


示例11: DrawBg

            public override void DrawBg(System.Drawing.Graphics g, System.Drawing.Rectangle rect, System.Drawing.Drawing2D.SmoothingMode smooth)
            {
                using (SolidBrush backBrush = new SolidBrush(BgColor))
                    g.FillRectangle(backBrush, rect);

                g.SmoothingMode = smooth;
            }
开发者ID:AndrianDTR,项目名称:Atlantic,代码行数:7,代码来源:Office12Renderer.cs


示例12: OnDrawItem

    protected override void OnDrawItem(DrawItemEventArgs e)
    {
        RectangleF tabFill = (RectangleF)GetTabRect(e.Index);

        if (e.Index == SelectedIndex)
        {
            Brush textBrush = new SolidBrush(Color.Black);
            Brush fillBrush = new SolidBrush(Color.White);
            e.Graphics.FillRectangle(fillBrush, tabFill);
            e.Graphics.DrawString(TabPages[e.Index].Text, Font, textBrush, new Point(e.Bounds.X + 5, e.Bounds.Y + 5));
            int offset = (e.Bounds.Height - 16) / 2;
            e.Graphics.DrawImage(Image.FromFile(pathCloseImg), e.Bounds.X + e.Bounds.Width - 20, e.Bounds.Y + offset);
            textBrush.Dispose();
            fillBrush.Dispose();
        }
        else
        {
            Brush textBrush = new SolidBrush(Color.White);
            Brush fillBrush = new SolidBrush(Color.DimGray);
            e.Graphics.FillRectangle(fillBrush, tabFill);
            fillBrush.Dispose();
            e.Graphics.DrawString(TabPages[e.Index].Text, Font, textBrush, new Point(e.Bounds.X + 5, e.Bounds.Y + 3));
            int offset = (e.Bounds.Height - 16) / 2;
            e.Graphics.DrawImage(Image.FromFile(pathCloseImg), e.Bounds.X + e.Bounds.Width - 20, e.Bounds.Y + offset + 2);
            textBrush.Dispose();
            fillBrush.Dispose();
        }
    }
开发者ID:TylerDev905,项目名称:CSharpCustomTabs,代码行数:28,代码来源:TabControlEx.cs


示例13: TicTacToeClientForm_Load

    private bool done = false; // true when game is over                 

    // initialize variables and thread for connecting to server
    private void TicTacToeClientForm_Load(object sender, EventArgs e)
    {
        board = new Square[3, 3];

        // create 9 Square objects and place them on the board
        board[0, 0] = new Square(board0Panel, ' ', 0);
        board[0, 1] = new Square(board1Panel, ' ', 1);
        board[0, 2] = new Square(board2Panel, ' ', 2);
        board[1, 0] = new Square(board3Panel, ' ', 3);
        board[1, 1] = new Square(board4Panel, ' ', 4);
        board[1, 2] = new Square(board5Panel, ' ', 5);
        board[2, 0] = new Square(board6Panel, ' ', 6);
        board[2, 1] = new Square(board7Panel, ' ', 7);
        board[2, 2] = new Square(board8Panel, ' ', 8);

        // create a SolidBrush for writing on the Squares
        brush = new SolidBrush(Color.Black);

        // make connection to server and get the associated
        // network stream                                  
        connection = new TcpClient("127.0.0.1", 50000);
        stream = connection.GetStream();
        writer = new BinaryWriter(stream);
        reader = new BinaryReader(stream);

        // start a new thread for sending and receiving messages
        outputThread = new Thread(new ThreadStart(Run));
        outputThread.Start();
    } // end method TicTacToeClientForm_Load
开发者ID:Fanarito,项目名称:FOR3A,代码行数:32,代码来源:TicTacToeClient.cs


示例14: CreateImage

    private void CreateImage()
    {
        Session["captcha.guid"] = Guid.NewGuid().ToString ("N");
        string code = GetRandomText();

        Bitmap bitmap = new Bitmap(WIDTH,HEIGHT,System.Drawing.Imaging.PixelFormat.Format32bppArgb);

        Graphics g = Graphics.FromImage(bitmap);
        Pen pen = new Pen(Color.DarkSlateGray);
        Rectangle rect = new Rectangle(0,0,WIDTH,HEIGHT);

        SolidBrush background = new SolidBrush(Color.AntiqueWhite);
        SolidBrush textcolor = new SolidBrush(Color.DarkSlateGray);

        int counter = 0;

        g.DrawRectangle(pen, rect);
        g.FillRectangle(background, rect);

        for (int i = 0; i < code.Length; i++)
        {
            g.DrawString(code[i].ToString(),
                         new Font("Verdana", 10 + rand.Next(6, 14)),
                         textcolor,
                         new PointF(10 + counter, 10));
            counter += 25;
        }

        DrawRandomLines(g);

        bitmap.Save(Response.OutputStream,ImageFormat.Gif);

        g.Dispose();
        bitmap.Dispose();
    }
开发者ID:nageshverma2003,项目名称:TrackProtectSource,代码行数:35,代码来源:CaptchaControl.aspx.cs


示例15: ApplyTextWatermark

    protected override void ApplyTextWatermark(ImageProcessingActionExecuteArgs args, Graphics g)
    {
        // Draw a filled rectangle
        int rectangleWidth = 14;
        using (Brush brush = new SolidBrush(Color.FromArgb(220, Color.Red)))
        {
            g.FillRectangle(brush, new Rectangle(args.Image.Size.Width - rectangleWidth, 0, rectangleWidth, args.Image.Size.Height));
        }

        using (System.Drawing.Drawing2D.Matrix transform = g.Transform)
        {
            using (StringFormat stringFormat = new StringFormat())
            {
                // Vertical text (bottom -> top)
                stringFormat.FormatFlags = StringFormatFlags.DirectionVertical;
                transform.RotateAt(180F, new PointF(args.Image.Size.Width / 2, args.Image.Size.Height / 2));
                g.Transform = transform;

                // Align: top left, +2px displacement 
                // (because of the matrix transformation we have to use inverted values)
                base.ContentAlignment = ContentAlignment.MiddleLeft;
                base.ContentDisplacement = new Point(-2, -2);

                base.ForeColor = Color.White;
                base.Font.Size = 10;

                // Draw the string by invoking the base Apply method
                base.StringFormat = stringFormat;
                base.ApplyTextWatermark(args, g);
                base.StringFormat = null;
            }
        }
    }
开发者ID:Gordon-from-Blumberg,项目名称:Piczard.Examples,代码行数:33,代码来源:MyInheritedFilter.cs


示例16: Paint

        protected override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle clipBounds, System.Drawing.Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
        {
            try
            {
                int progressVal = (int)value;
                float percentage = ((float)progressVal / 100.0f); // Need to convert to float before division; otherwise C# returns int which is 0 for anything but 100%.
                Brush backColorBrush = new SolidBrush(cellStyle.BackColor);
                Brush foreColorBrush = new SolidBrush(cellStyle.ForeColor);
                // Draws the cell grid
                base.Paint(g, clipBounds, cellBounds,
                 rowIndex, cellState, value, formattedValue, errorText,
                 cellStyle, advancedBorderStyle, (paintParts & ~DataGridViewPaintParts.ContentForeground));
                if (percentage > 0.0)
                {
                    // Draw the progress bar and the text
                    g.FillRectangle(new SolidBrush(Color.FromArgb(203, 235, 108)), cellBounds.X + 2, cellBounds.Y + 2, Convert.ToInt32((percentage * cellBounds.Width - 4)), cellBounds.Height - 4);
                    g.DrawString(progressVal.ToString() + "%", cellStyle.Font, foreColorBrush, cellBounds.X + (cellBounds.Width / 2) - 5, cellBounds.Y + 2);

                }
                else
                {
                    g.DrawString("Ожидание...", cellStyle.Font, foreColorBrush, cellBounds.X + (cellBounds.Width / 2) - 25, cellBounds.Y + 2);
                }
            }
            catch (Exception e) { }
        }
开发者ID:tatar1nro,项目名称:KKM_Trash,代码行数:26,代码来源:dataProgress.cs


示例17: save

    private void save()
    {
        //임의의 글자를 난수로 발생시켜 PrintStr에 집어넣기
        string[] RandomStr = new string[] { "자동", "가입", "프로", "그램", "쓰지", "말자" };
        Random r = new Random();
        string PrintStr = RandomStr[r.Next(6)];

        //랜덤으로 그리는 글씨를 ViewState에 저장한다.(나중에 검사할때 사용)
        ViewState["Str"] = PrintStr;

        //비트맵객체를 생성하고 이 객체를 Graphics객체에서 생성한다.
        Bitmap btm = new Bitmap(100, 80);
        Graphics grp = Graphics.FromImage(btm);
        //회색바탕의 사각형을 만들기
        SolidBrush backBrush = new SolidBrush(Color.DarkGray);
        Rectangle rect = new Rectangle(0, 0, 100, 80);//100,80의 사이즈
        grp.FillRectangle(backBrush, rect);//뒷 배경과 사각형 객체를 전달한다.
        //빨간색 글씨를 써서 집어넣는다.
        Font font = new Font("굴림", 20);
        SolidBrush strinBrush = new SolidBrush(Color.Red);
        grp.DrawString(PrintStr, font, strinBrush, 20, 20);
        //이제 만들어진 객체를 저장 시키자.
        string pathStr = MapPath(Request.ApplicationPath) + @"\img\Background.png";
        btm.Save(pathStr, ImageFormat.Png);
    }
开发者ID:Letractively,项目名称:my-project-ryukijoung,代码行数:25,代码来源:AutoRegPreventForm.aspx.cs


示例18: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        string fName = ConfigurationManager.AppSettings["Code39Barcode.FontFamily"];

        PrivateFontCollection fCollection = new PrivateFontCollection();
        fCollection.AddFontFile(ConfigurationManager.AppSettings["Code39Barcode.FontFile"]);
        FontFamily fFamily = new FontFamily(fName, fCollection);
        Font f = new Font(fFamily, FontSize);

        Bitmap bmp = new Bitmap(Width, Height);
        Graphics g = Graphics.FromImage(bmp);
        g.Clear(Color.White);
        Brush b = new SolidBrush(Color.Black);
        g.DrawString("*" + strPortfolioID + "*", f, b, 0, 0);

        //PNG format has no visible compression artifacts like JPEG or GIF, so use this format, but it needs you to copy the bitmap into a new bitmap inorder to display the image properly.  Weird MS bug.
        Bitmap bm = new Bitmap(bmp);
        System.IO.MemoryStream ms = new System.IO.MemoryStream();

        Response.ContentType = "image/png";
        bm.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
        ms.WriteTo(Response.OutputStream);

        b.Dispose();
        bm.Dispose();
        Response.End();
    }
开发者ID:nehawadhwa,项目名称:ccweb,代码行数:27,代码来源:CP_Barcode.ascx.cs


示例19: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Clear();
     Response.ContentType = "image/bmp";
     string st = "",s="";
     Random rnd = new Random();
     Int32 num=0,ch=0;
     for (int i = 0; i < 5; i++)
     {
         ch=rnd.Next(2);
         if (ch == 0)
             num = rnd.Next(65, 91);
         if (ch == 0)
             num = rnd.Next(97, 122);
         else
             num = rnd.Next(48, 57);
         s += (Convert.ToChar(num)).ToString();
         st += (Convert.ToChar(num)).ToString() + " ";
     }
     Session.Add("captcha", s);
     Bitmap bmp = new Bitmap(210, 80);
     Graphics g = Graphics.FromImage(bmp);
     Pen p = new Pen(Color.Aqua);
     HatchBrush br = new HatchBrush(HatchStyle.DottedGrid, Color.Aqua, Color.LightGray);
     SolidBrush b = new SolidBrush(Color.Goldenrod);
     Font f = new Font("Chillar", 36);
     g.FillRectangle(br, new Rectangle(0, 0, 210, 80));
     g.DrawString(st, f, b, new Point(5, 5));
     bmp.Save(Response.OutputStream, ImageFormat.Bmp);
     g.DrawLine(p, 20, 10, 210, 80);
 }
开发者ID:rrumelaroy,项目名称:E-JOURNAL,代码行数:31,代码来源:ejourn_captcha.aspx.cs


示例20: OnPaint

    protected override void OnPaint(PaintEventArgs pevent)
    {
        var g = pevent.Graphics;
        g.SmoothingMode = SmoothingMode.AntiAlias;
        g.Clear(Parent.BackColor);

        var checkMarkLine = new Rectangle(1, 1, 16, 16);
        var checkmarkPath = DrawHelper.CreateRoundRect(1, 1, 17, 17, 1);

        EnabledCheckedColor = HexColor;
        SolidBrush BG = new SolidBrush(Enabled ? Checked ? EnabledCheckedColor : EnabledUnCheckedColor : DisabledColor);
        Pen Pen = new Pen(BG.Color);

        g.FillPath(BG, checkmarkPath);
        g.DrawPath(Pen, checkmarkPath);

        g.SmoothingMode = SmoothingMode.None;
        g.FillRectangle(new SolidBrush(Color.White), PointAnimationNum, PointAnimationNum, SizeAnimationNum, SizeAnimationNum);
        g.SmoothingMode = SmoothingMode.AntiAlias;
      
        //CheckMark
        g.DrawImageUnscaledAndClipped(CheckMarkBitmap(), checkMarkLine);
        
        //CheckBox Text
        g.DrawString(Text, font.Roboto_Medium10, new SolidBrush(Enabled ? EnabledStringColor : DisabledStringColor), 21, 0);
    }
开发者ID:mr-amini,项目名称:ComU,代码行数:26,代码来源:LollipopCheckBox.cs



注:本文中的SolidBrush类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SolidColorBrush类代码示例发布时间:2022-05-24
下一篇:
C# Solid类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap