drawing

C# get good color for label

筅森魡賤 提交于 2019-12-11 08:34:33
问题 I have a random color for my background in my windows forms application. Now I want to display a label. But when the random color is white and the label also then the label is not visible. How can I get a perfect color there is visible on my background color(My backgroundcolor is a random color from System.Drawing.Color) 回答1: There are various ways to ensure a proper contrast. Option one : I usually stick to keeping the text Black or White, depending on the brightness of back color. To get

Paint out of window (and controls)

你离开我真会死。 提交于 2019-12-11 08:25:03
问题 I think that if I use image it would be best: I need that my control could be out of window as datetimepicker calendar. I am using panelKalendar = new PanelDoubleBuffer(); then in method: void panelKalendar_Paint(object sender, PaintEventArgs e) I paint everything. But it´s painting to window and belov all other controls. How can I get "effect" that is use in DateTimePicker? 回答1: The drop-down list of a combo box (and also possibly the drop-down panel of a calendar control) is a child window

Save Image from user Drawn PictureBox whose SizeMode=stretch in C# winforms

六眼飞鱼酱① 提交于 2019-12-11 08:18:53
问题 Im drawing an image on picture box which is in stretch mode,I translate the mouse coordinates on the mouse click event by using a function to obtain the real coordinates and draw the image by overriding the on-paint event and using the paint event Graphics. Since the picture box is set to stretch i only obtain a small size image when i try to save the image by using picturebox.DrawtoBitmap Function.The extra parts are padded with Black colour.Please help me out. 回答1: You can try this: using

Drawing line “slowly” programmatically with wpf

随声附和 提交于 2019-12-11 07:57:12
问题 I have multiple points and I want to draw lines connecting that points with WPF, but I want to see them drawing slowly, and I need to do that programmatically, how can I do that? Thanks. 回答1: You can try something like this: <Grid> <Grid.Triggers> <EventTrigger RoutedEvent="MouseDown"> <EventTrigger.Actions> <BeginStoryboard> <Storyboard TargetName="MyLine"> <DoubleAnimation Storyboard.TargetProperty="X2" To="100" Duration="0:0:5"/> <DoubleAnimation Storyboard.TargetProperty="Y2" To="100"

Crop image to be circular swift 3

断了今生、忘了曾经 提交于 2019-12-11 07:34:48
问题 So I have this issue I have been trying to solve for the past few days however, cannot find a solution to the problem. My issue is very simple I am trying to crop a image so that it becomes a circle. From research done, I have found a few methods that can be used to achieve this and the main one which seemed to pop up a lot is to simply crop the UIImageView so that it becomes a circular frame. The code which I used to do this can be seen below. imageView.layer.masksToBounds = false imageView

drawing rectangle

徘徊边缘 提交于 2019-12-11 07:07:03
问题 I am writing a program that accepts coordinates from the user and drawing some shapes on the screen with stars(*) e.g Rectangle i.e rectangle=100,150,50,50 as x,y,width,height. how can I do it?? 回答1: I think that this tutorial is very useful for you: http://download.oracle.com/javase/tutorial/2d/geometry/primitives.html 回答2: What 'drawing with stars' is? If this is text mode with monospaced font, you'll need to print it in horizontal lines of stars, calculating right lengths. For rectangles

How to use ControlPaint.DrawGrid To Draw To a PictureBox

浪尽此生 提交于 2019-12-11 06:46:55
问题 I am attempting to draw a graph paper like grid to a picture box and then printing it out. I figured my best route of attack for this would be the DrawGrid function. I got some stuff down and then it fell apart after I got to the control paint part. How can I convert a Painting to drawing. Please explain, as of now I am fairly confused. Rectangle rect = new Rectangle(); rect.Location = new System.Drawing.Point(0,0); rect.Height = (int)numericUpDown1.Value; rect.Width = (int)numericUpDown2

how to draw smoothly with a flat nib pen / traped brush effect like Instagram using core graphics..?

淺唱寂寞╮ 提交于 2019-12-11 06:35:24
问题 I tried some code to calculate control points between start and end point of bezier path with touch move , add lines to bezier path and fill with colour to give flat pen effect like Instagram but unable to get smooth curved lines with fast finger move. from the below code I am able to get angled lines not smooth like instagram in image if (_bezierPath == nil || _brushType == BrushTypeNeon) { _bezierPath = [UIBezierPath new]; } [_bezierPath moveToPoint:(CGPoint){self.controlPoint1.x + self

QPainter how draw texture with special color

馋奶兔 提交于 2019-12-11 06:30:00
问题 I have some patterns which are black with alpha and have some points that I want to draw line with patterns. I find QBrush can be constructed by texture, but I don't know how to draw it with difference colors. This answer show a way here in C# code, but I don't know how to change patterns color with ColorMatrix. 回答1: The modification of RGBA values of an image using a 5×5 color matrix reminds me to the transformation of homogeneous coordinates how it is often used in computer graphics. If you

How to Adjust the Text Size according to image size while Drawing String on an Image in C#

偶尔善良 提交于 2019-12-11 06:09:32
问题 I'm using the Drawstring method of the Graphics Class to Draw a Text on an Image.The Font is Specified before drawing. G.DrawString(mytext, font, brush, 0, 0) The Problem arises when the same text is drawn on an image with smaller size.The Text drawn appears to be larger.I'm looking for a solution to alter the font size according to the image size so that the text don't appear larger or smaller when drawn on images of different sizes. I'm attaching the images with different sizes with the