void OnEnable() { Undo.undoRedoPerformed += UndoRedo; EditorSceneManager.sceneClosed += SceneClosed; if (onSceneFunc == null) { onSceneFunc = new System.Action <SceneView>(OnSceneGUI); } GameObject g = new GameObject("RobBossTarget"); g.hideFlags = HideFlags.HideAndDontSave; raycastTarget = g.AddComponent <MeshCollider>(); colliderMesh = new Mesh(); colliderMesh.name = "RobBossColliderMesh"; colliderMesh.hideFlags = HideFlags.HideAndDontSave; raycastTarget.sharedMesh = colliderMesh; pressureType = (PressureType)EditorPrefs.GetInt("RobBoss.PressureType", 0); paintType = (PaintType)EditorPrefs.GetInt("RobBoss.PaintType", 0); colorMask = (ColorMask)EditorPrefs.GetInt("RobBoss.ColorMask", 15); string colorString = EditorPrefs.GetString("RobBoss.Color", "FFFFFFFF"); ColorUtility.TryParseHtmlString("#" + colorString, out color); radius = EditorPrefs.GetFloat("RobBoss.Radius", 0.5f); blend = EditorPrefs.GetFloat("RobBoss.Blend", 0.1f); if (paintTarget != null) { SetPaintTarget(paintTarget); } }
protected override void OnMouseEnter(EventArgs e) { base.OnMouseEnter(e); toolTip.SetToolTip(this, toolTipText); paintType = PaintType.MouseOver; this.Invalidate(); }
private static ulong UpdateVoxelShape(MySyncVoxel sync, PaintType type, MyShape Shape, byte Material) { var voxel = sync.Entity as MyVoxelBase; ulong changedVoxelAmount = 0; if (voxel != null) { switch (type) { case PaintType.Paint: MyVoxelGenerator.PaintInShape(voxel, Shape, Material); break; case PaintType.Fill: changedVoxelAmount = MyVoxelGenerator.FillInShape(voxel, Shape, Material); break; case PaintType.Cut: changedVoxelAmount = MyVoxelGenerator.CutOutShape(voxel, Shape); break; } } return(changedVoxelAmount); }
protected void SetSplatMaps(PaintType paintType) { TerrainLayer[] terrainLayers = GetTerrainLayerArray((int)paintType); float[,,] alphaMaps = null; switch (paintType) { case PaintType.Splat: alphaMaps = Splat.MapArray; break; case PaintType.Biome: alphaMaps = Biome.MapArray; break; case PaintType.Alpha: alphaMaps = Alpha.MapArray; break; case PaintType.Topology: alphaMaps = Topology.GetArray(SelectedTopology); break; } PaintMode = paintType; Terrain.terrainData.terrainLayers = terrainLayers; Terrain.terrainData.SetAlphamaps(0, 0, alphaMaps); Terrain.terrainData.SetBaseMapDirty(); }
void CollectData(PaintType paint, Vector2 coord) { switch (paint) { case PaintType.Empty: emptyPaintCoord.Add(coord); break; case PaintType.Wall: wallPaintCoord.Add(coord); break; case PaintType.Box: boxPaintCoord.Add(coord); break; case PaintType.Player: playerPaintCoord.Add(coord); break; case PaintType.Exit: exitPaintCoord.Add(coord); break; default: break; } }
/// <summary> /// /// </summary> /// <param name="type"></param> /// <param name="defColor"></param> /// <param name="pensize"></param> /// <param name="startp"></param> public PCmdData_2p(PaintType type, Color defColor, float pensize = 5, PointF startp = default(PointF)) { this.Start = startp; ColorAlpha = defColor.A; Type = type; Pen = new Pen(defColor, pensize); switch (Type) { case PaintType.Rectangle: Pen.DashStyle = DashStyle.Solid; break; case PaintType.Ellipse: Pen.DashStyle = DashStyle.Solid; break; case PaintType.Arrow: Pen = getArrowPen(Pen); break; case PaintType.StraightLine: Pen.DashStyle = DashStyle.Solid; break; case PaintType.Dashed: Pen = getDashPen(Pen); break; } }
void Translate() { for (int i = 0; i < width * height; i++) { int x = ConvertCoordTo2D(i).x; int y = ConvertCoordTo2D(i).y; PaintType paint = blueprintGameboard[x, y].GetComponent <PaintTile>().PaintTileType; CollectData(paint, ConvertCoordTo2D(i)); } if (HaveObstaclesOnBoard()) { DeployGameEntity(PaintType.Exit, ref boxPaintCoord); } if (HaveEmptyTileOnBoard()) { DeployGameEntity(PaintType.Player, ref emptyPaintCoord); } for (int i = 0; i < width * height; i++) { CreateTile(i); } if (OnSendTranslation != null) { OnSendTranslation(); } }
protected override void OnMouseLeave(EventArgs e) { toolTip.RemoveAll(); base.OnMouseLeave(e); paintType = PaintType.Normal; this.Invalidate(); }
public static ShipUpgradeDetail GetPaintDetail(PaintType paintUpgrade) { ShipUpgradeDetail upgradeDetail = new ShipUpgradeDetail(); upgradeDetail.m_UpgradeType = UpgradeType.Paint; switch (paintUpgrade) { case PaintType.DarkGrey: upgradeDetail.m_UpgradeName = "Dark Grey"; upgradeDetail.GumpCollectionId = "DarkGreyShipPaintUpgrade"; upgradeDetail.PaintHue = 1105; upgradeDetail.PaintTextHue = 1105; upgradeDetail.m_SpecialEffects.Add(new KeyValuePair <string, ShipUpgradeDetail.UpgradeEffectType>("Changes the color of the ship (Hue 1105)", ShipUpgradeDetail.UpgradeEffectType.Paint)); break; } if (upgradeDetail.m_UpgradeName == "") { return(null); } else { return(upgradeDetail); } }
private void OnEnable() { TerrainManager instance = (TerrainManager)target; paintType = instance.PaintMode; topologyType = instance.SelectedTopology; }
public void Paint(Vector3 position, Quaternion rotation, PaintType type) { GameObject obj = Instantiate(paintProjector) as GameObject; obj.transform.SetParent(this.transform, false); obj.GetComponent <PaintProjectorController> ().Init(position, rotation, type); }
public override void OnInspectorGUI() { TerrainManager instance = (TerrainManager)target; if (!TerrainManager.HasValidTerrain()) { GUILayout.Label("Create or load a map to continue..."); return; } GUILayout.Label("Paint Controls", EditorStyles.boldLabel); GUILayout.Space(5f); paintType = (PaintType)EditorGUILayout.EnumPopup("Paint Mode", paintType); if (paintType != instance.PaintMode) { instance.ChangePaintType(paintType); return; } if (paintType == PaintType.Topology) { topologyType = (TerrainTopology.Enum)EditorGUILayout.EnumPopup("Topology Layer", topologyType); if (topologyType != instance.SelectedTopology) { instance.ChangeTopologyLayer(topologyType); } } }
private void ButtonPaintRect_Click(object sender, RoutedEventArgs e) { paintType = PaintType.Rect; ButtonPaintPen.Background = Brushes.LightGray; ButtonPaintRect.Background = Brushes.White; editCanvas.Cursor = Cursors.Cross; }
void Erase() { Ray mouseRay = Camera.main.ScreenPointToRay(Input.mousePosition); Debug.DrawRay(mouseRay.origin, mouseRay.direction, Color.red, int.MaxValue); RaycastHit hit; if (Physics.Raycast(mouseRay, out hit, int.MaxValue, maskCanvas)) { PaintType brushType = EraseBrush.GetComponent <PaintTile>().PaintTileType; GameObject objectToDestroy = GetGameObject(hit); Vector3 position = GetPosition(hit); Vector2 PositionInArray = GetPositionInArray(objectToDestroy); GameObject Ink = Instantiate(EraseBrush, position, Quaternion.identity, gameObject.transform); Ink.GetComponent <PaintTile>().PositionX = (int)PositionInArray.x; Ink.GetComponent <PaintTile>().PositionY = (int)PositionInArray.y; Ink.GetComponent <PaintTile>().PaintTileType = brushType; gameBuilder.AddElemntToPaint((int)PositionInArray.x, (int)PositionInArray.y, Ink); Destroy(hit.collider.gameObject); if (onPlayerPaint != null) { onPlayerPaint(); } } }
/// <summary> /// 画标签左侧图标的时钟,加载动画 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void tmAnimation_Tick(object sender, EventArgs e) { iCurFrame = (iCurFrame) % iFrameCount + 1; if ((mCurFrame + mCutStepWidth >= mCutMax)) { mCurFrame = 0; } else { mCurFrame = mCurFrame + mCutStepWidth; } if ((mCutStyle == CutStyle.XAxis)) { mCutRect.X = mCurFrame; mCutRect.Y = 0; mCutRect.Width = mCutStepWidth; mCutRect.Height = mCutStepHeight; } else if ((mCutStyle == CutStyle.YAxis)) { mCutRect.X = 0; mCutRect.Y = mCurFrame; mCutRect.Width = mCutStepWidth; mCutRect.Height = mCutStepHeight; } this.paintType = PaintType.PaintHeaerIcon; paintRequest(); }
protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); if (!this.IsSelected) { this.PaintingType = PaintType.Pressed; } }
protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); if (!this.IsSelected && e.Button == MouseButtons.Left) { this.PaintingType = PaintType.Pressed; } }
protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); if (e.Button == MouseButtons.Left) { this.PaintingType = PaintType.Normal; } }
static Painter() { Extensions = new string[] { ".png", ".jpg" }; Size = 32; Span = 0.01f; Opacity = 1.0f; Type = PaintType.paint; }
protected override void OnLostFocus(EventArgs e) { base.OnLostFocus(e); if (!this.IsArrowButton) { this.PaintingType = PaintType.Normal; toolTip.RemoveAll(); } }
protected override void OnGotFocus(EventArgs e) { base.OnGotFocus(e); if (!this.IsArrowButton) { this.PaintingType = PaintType.MouseOver; toolTip.SetToolTip(this, navigateBarButton.ToolTipText); } }
void CreatePaint(PaintType type) { mapController.Paint(firstPerson.m_chaTrans.position, firstPerson.m_chaTrans.rotation, type); CurrentLevelMessage.ProjectorMessage pm = new CurrentLevelMessage.ProjectorMessage(); pm.position = firstPerson.m_chaTrans.position; pm.rotation = firstPerson.m_chaTrans.rotation; pm.type = type; CurrentLevelMessage.Instance.projectorMessageList.Add(pm); }
private void FrmDrawing_Load(object sender, EventArgs e) { mPaintType = PaintType.None; mBrushColor = new MCvScalar(0, 0, 255); BtnCustomColor.BackColor = Color.Red; InitPictureBox(); CaculateParams(); }
private void FrmMain_Load(object sender, EventArgs e) { paintType = PaintType.None; this.WindowState = FormWindowState.Maximized; graphics = pnPaint.CreateGraphics(); // MessageBox.Show(graphics.PageUnit.ToString()); graphics.SmoothingMode = SmoothingMode.AntiAlias; this.DoubleBuffered = true; }
void DeployGameEntity(PaintType type, ref List <Vector2> sourceList) { Vector2 coord; do { coord = ChooseRandomPosition(sourceList); } while (!ValidChosenPosition(coord)); SetGameEntity(coord, type, ref sourceList); }
public void PaintFilled(int paintType, int attackerID) { PaintType paint = (PaintType)paintType; ResetPaint(paint); ObjectPooler.instance.GrabFromPool("TeleportParticle", myEntity.transform.position, myEntity.transform.rotation); // I'm the attacker. if (attackerID == PlayerManager.instance.photonView.ViewID) { // This is my entity. I killed myself. if (myEntity == PlayerManager.instance.entity) { NotificationManager.instance.NewNotification("<color=#" + GameManager.personalColorString + "> " + PhotonNetwork.NickName + "</color> has killed himself!"); } // This not my entity. else { // I don't have a mark, give me one. if (PlayerManager.instance.entity.paintController.CurrentPaintMark == null) { PlayerManager.instance.entity.paintController.CurrentPaintMark = new PaintMark { markType = paint, markValue = 100 }; NotificationManager.instance.NewNotification("<color=#" + GameManager.personalColorString + "> " + PhotonNetwork.NickName + "</color> has claimed a mark!", NotificationManager.NotificationType.MarkGained); SaveManager.instance.SaveStat(SaveManager.SavedStat.MarksGained); } SaveManager.instance.SaveStat(SaveManager.SavedStat.Kills); } } // I'm not the attacker. else { // Find that attacker and give him a mark. PhotonView pv = PhotonView.Find(attackerID); if (pv) { PlayerManager playerManager = pv.GetComponent <PlayerManager>(); if (playerManager && playerManager.entity.paintController.CurrentPaintMark == null) { playerManager.entity.paintController.CurrentPaintMark = new PaintMark { markType = paint, markValue = 100 }; } } } // If this is my entity whos paint bar got filled. Die. if (myEntity == PlayerManager.instance.entity) { GameManager.CurrentGameSate = GameManager.GameState.Respawning; } }
public void PaintOn(DrawingContext dc) { if (PaintType is PaintSpray) { PaintType.PaintOn(dc, ((PaintSpray)PaintType).SpraySize); } else { PaintType.PaintOn(dc, size); } }
/// <summary>This paints the current destructible with the specified paint type, at the specified matrix, with the specified shape.</summary> public void Paint(PaintType paint, Matrix4x4 matrix, Texture2D shape, Color color) { switch (paint) { case PaintType.Cut: Cut(matrix, shape, color); break; case PaintType.Heal: Heal(matrix, shape, color); break; case PaintType.Subtract: Subtract(matrix, shape, color); break; } }
public EditWindow(Image image) { InitializeComponent(); editCanvas.Children.Add(image); ConfigurateWindowSize(image); paintType = PaintType.Pencil; ButtonPaintPen.Background = Brushes.White; ButtonPaintRect.Background = Brushes.LightGray; }
public GlossaryItem GetGlossaryItem(PaintType paint) { foreach (var item in glossaryItems) { if (item.paintType == paint) { return(item); } } return(null); }
protected override void OnKeyUp(KeyEventArgs e) { if (e.KeyData == Keys.Enter || e.KeyData == Keys.Space) { if (!this.IsArrowButton) { e.Handled = true; isSelected = true; this.PaintingType = PaintType.Selected; NavigateBarButton.PerformClick(); } } else base.OnKeyUp(e); }
protected override void OnMouseLeave(EventArgs e) { base.OnMouseLeave(e); this.PaintingType = PaintType.Normal; toolTip.RemoveAll(); }
protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); if (!this.IsSelected) this.PaintingType = PaintType.Pressed; }
private void _PaintRooms(Graphics g, IEnumerable<LevelRulesFile.Room> rooms, PointF offset, Color color, PaintType paintType) { int i = 0; foreach (LevelRulesFile.Room room in rooms) { float yPos = room.X * _graphicsScale + offset.X + _graphicsOffsetX; float xPos = room.Y * _graphicsScale + offset.Y + _graphicsOffsetY; if (_flipXYOffsets) { yPos = room.Y * _graphicsScale + offset.X + _graphicsOffsetX; xPos = room.X * _graphicsScale + offset.Y + _graphicsOffsetY; } String roomPathName = _GetRoomPathName(room.RoomDesc); RoomDefinitionFile roomDefinition = _roomDefinitions[roomPathName]; float roomWidth = roomDefinition.RoomDefinition.FileHeader.UnknownFloat1 * _graphicsScale; float roomHeight = roomDefinition.RoomDefinition.FileHeader.MinX * _graphicsScale; if (_flipWidthHeight) { roomWidth = roomDefinition.RoomDefinition.FileHeader.MinX * _graphicsScale; roomHeight = roomDefinition.RoomDefinition.FileHeader.UnknownFloat1 * _graphicsScale; } Matrix myMatrix = new Matrix(); float rotateDeg = -room.Rotation * 180.0f / (float)Math.PI; if (_reverseRotation) rotateDeg *= -1; if (roomWidth < 0) { roomWidth *= -1; if (!_disableWidthOffset) { if (_flipWidthHeightOffset) { xPos -= roomWidth; } else { yPos -= roomWidth; } } } if (roomHeight < 0) { roomHeight *= -1; if (!_disableWidthOffset) { if (_flipWidthHeightOffset) { xPos -= roomHeight; } else { yPos -= roomHeight; } } } myMatrix.RotateAt(rotateDeg, new PointF(xPos, yPos)); g.Transform = myMatrix; if (paintType == PaintType.Block) { g.FillRectangle(new SolidBrush(color), xPos, yPos, roomWidth, roomHeight); // g.Transform = new Matrix(); //g.FillRectangle(new SolidBrush(Color.MistyRose), xPos, yPos, roomWidth, roomHeight); //g.DrawString(rotateDeg.ToString(), _font, new SolidBrush(Color.Black), xPos, yPos); } if (paintType == PaintType.Outline) { g.DrawRectangle(new Pen(Color.Black), xPos, yPos, roomWidth, roomHeight); } if (paintType == PaintType.DashedOutline) { Pen pen = new Pen(Color.Black) { DashStyle = DashStyle.DashDot, DashOffset = 20 }; g.DrawRectangle(pen, xPos, yPos, roomWidth, roomHeight); } float strX = xPos; float strY = yPos; //if (i % 2 == 0) //{ // strY += roomHeight; //} //else //{ // strY -= (_font.Size + 6); //} //g.Transform = new Matrix(); if (paintType == PaintType.Text && !_disableRoomNames) { g.DrawString(room.RoomDesc, _font, new SolidBrush(Color.Black), strX, strY); } i++; } }
private clsLabel LabelGenerator(string MessageId, string Text,int Width, bool IsBlank,int colWidth, PaintType type,BorderType _BorderType) { try { clsLabel _Label = new clsLabel(); _Label.TypeOfPaint = type; _Label.TypeOfBorder = _BorderType; _Label.BackColor = System.Drawing.Color.Transparent; _Label.Dock = System.Windows.Forms.DockStyle.Left; _Label.FieldType = ICTEAS.WinForms.Controls.LabelType.Optional; //if (!IsBlank) // _Label.BorderStyle = BorderStyle.FixedSingle; //else // _Label.BorderStyle = BorderStyle.FixedSingle; _Label.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; _Label.Location = new System.Drawing.Point(0, 0); _Label.MessageID = MessageId; _Label.Name = "lbl" + Text; _Label.NormalFont = true; _Label.ResourceName = ""; _Label.Size = new Size(colWidth, this.Height); //if (!IsBlank) // _Label.Size = new System.Drawing.Size(Width, this.Height); //else // _Label.Size = new Size(colWidth, this.Height); _Label.TabIndex = 6; _Label.Text = Text; if (!IsBlank) SetMessageForLabel(_Label, MessageId); else _Label.Text = ""; _Label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; return _Label; } catch { return null; } }
public Boolean Updated(PaintType Type, ConsoleColor ShouldBeColor) { if (Type.Equals(PaintType.ForeColor)) { return CurrentForeColor.CompareTo(ShouldBeColor) > 0; } else { return CurrentBackColor.CompareTo(ShouldBeColor) > 0; } }
/// <summary> /// Paint Gradient /// </summary> /// <param name="tControl">Painting control</param> /// <param name="tGraphics">Graphic object</param> /// <param name="tColorTable">NavigataBarColorTable inherited object</param> /// <param name="tPaintType">Paint type</param> public static void PaintGradientBack(Control tControl, Graphics tGraphics, NavigateBarColorTable tColorTable, PaintType tPaintType) { if (tControl.ClientRectangle.IsEmpty) return; #region Color Select Color cTopColorBegin = tColorTable.ButtonNormalBegin; Color cTopColorEnd = tColorTable.ButtonNormalMiddleBegin; Color cBottomColorBegin = tColorTable.ButtonNormalMiddleEnd; Color cBottomColorEnd = tColorTable.ButtonNormalEnd; switch (tPaintType) { case PaintType.Selected: { cTopColorBegin = tColorTable.ButtonSelectedBegin; cTopColorEnd = tColorTable.ButtonSelectedMiddleBegin; cBottomColorBegin = tColorTable.ButtonSelectedMiddleEnd; cBottomColorEnd = tColorTable.ButtonSelectedEnd; break; } case PaintType.MouseOver: { cTopColorBegin = tColorTable.ButtonMouseOverBegin; cTopColorEnd = tColorTable.ButtonMouseOverMiddleBegin; cBottomColorBegin = tColorTable.ButtonMouseOverMiddleEnd; cBottomColorEnd = tColorTable.ButtonMouseOverEnd; break; } case PaintType.Pressed: { cTopColorBegin = tColorTable.ButtonSelectedEnd; cTopColorEnd = tColorTable.ButtonSelectedMiddleBegin; cBottomColorBegin = tColorTable.ButtonSelectedMiddleEnd; cBottomColorEnd = tColorTable.ButtonSelectedMiddleEnd; break; } } #endregion NavigateBarHelper.PaintGradientControl(tControl, tGraphics, cTopColorBegin, cTopColorEnd, cBottomColorBegin, cBottomColorEnd, tColorTable.PaintAngle, tColorTable.PaintRatio); }
protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); if (e.Button != MouseButtons.Left) return; paintType = PaintType.MouseOver; this.Invalidate(); }
private static bool CanPlaceInArea(PaintType type, MyShape Shape) { if (type == PaintType.Fill) { m_foundElements.Clear(); BoundingBoxD box = Shape.GetWorldBoundaries(); MyEntities.GetElementsInBox(ref box, m_foundElements); foreach (var entity in m_foundElements) { if (IsForbiddenEntity(entity)) { if (entity.PositionComp.WorldAABB.Intersects(box)) { return false; } } } } return true; }
private static ulong UpdateVoxelShape(MySyncVoxel sync, PaintType type, MyShape Shape, byte Material) { var voxel = sync.Entity as MyVoxelBase; ulong changedVoxelAmount = 0; if (voxel != null) { switch (type) { case PaintType.Paint: MyVoxelGenerator.PaintInShape(voxel, Shape, Material); break; case PaintType.Fill: changedVoxelAmount = MyVoxelGenerator.FillInShape(voxel, Shape, Material); break; case PaintType.Cut: changedVoxelAmount = MyVoxelGenerator.CutOutShape(voxel, Shape); break; } } return changedVoxelAmount; }
protected override void OnMouseClick(MouseEventArgs e) { base.OnMouseClick(e); toolTip.RemoveAll(); // Only left click if (e.Button == MouseButtons.Left && !this.IsArrowButton) // Sadece sol click ile button seçilebilmeli { this.IsSelected = true; this.PaintingType = PaintType.Selected; NavigateBarButton.PerformClick(); } else { if (!this.IsArrowButton) { Point p = this.PointToScreen(new Point(this.Location.X - this.Left + this.Width, this.Location.Y)); NavigateBarButton.ButtonMenu.Show(p); } } }
public void PaintScreen(ConsoleColor Color, PaintType Type) { lock (PaintLogger) { if (Type.Equals(PaintType.ForeColor)) { PaintLogger.UpdateForePaint(Color); } else { PaintLogger.UpdateBackPaint(Color); } } }
protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); if (e.Button == MouseButtons.Left) this.PaintingType = PaintType.Normal; }
protected override void OnMouseEnter(EventArgs e) { base.OnMouseEnter(e); toolTip.SetToolTip(this, navigateBarButton.ToolTipText); this.PaintingType = PaintType.MouseOver; }
protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); if (!this.IsSelected && e.Button == MouseButtons.Left) this.PaintingType = PaintType.Pressed; }
/// <summary> /// Paint NavigateBarButton /// </summary> /// <param name="LightColor"></param> /// <param name="DarkColor"></param> /// <param name="paintType"></param> void PaintThisControl(PaintType tPaintType) { NavigateBarTheme theme = navigateBar.Theme; Color lightColor = theme.LightColor; Color darkColor = theme.DarkColor; Image imageButton = null; switch (tPaintType) { case PaintType.Normal: { imageButton = isSelected ? SelectedImage : Image; lightColor = isSelected ? theme.SelectedLightColor : theme.LightColor; darkColor = isSelected ? theme.SelectedDarkColor : theme.DarkColor; break; } case PaintType.Selected: { imageButton = SelectedImage; lightColor = isSelected ? theme.SelectedLightColor : theme.LightColor; darkColor = isSelected ? theme.SelectedDarkColor : theme.DarkColor; break; } case PaintType.MouseOver: { lightColor = isSelected ? theme.SelectedLightColor : theme.MouseOverLightColor; darkColor = isSelected ? theme.SelectedDarkColor : theme.MouseOverDarkColor; imageButton = isSelected ? SelectedImage : MouseOverImage; break; } } // Gradient olarak boyama işlemi // Paint gradient NavigateBarHelper.PaintGradientControl(this, lightColor, darkColor, navigateBar.NavigateBarPaintAngle); Graphics g = this.CreateGraphics(); // Yazıyı yazma // Draw caption text if (!string.IsNullOrEmpty(Caption)) { Brush brushText; if (this.Enabled) brushText = new SolidBrush(this.ForeColor); else brushText = SystemBrushes.GrayText; // Disable color g.DrawString(Caption.Equals("..") ? "" : Caption, Font, brushText, LIT_WIDTH + (imageButton == null ? 0 : imageButton.Width) + (imageButton != null ? LIT_WIDTH : 0), this.Height / 2 - Font.Height / 2); } // Resmi gösterme // Draw Image if (imageButton != null) { Image img = null; if (this.Enabled) // Orjinal resmi kullan // use orjinal picture img = imageButton; else img = image; if (!this.Enabled) img = disableImage; int leftPos = LIT_WIDTH; // Eğer button metni gözükmüyorsa sadece image gözükecek şekilde ortala // if cannot display button text then set image position center button if (caption.Equals("..")) { leftPos = (int)((Width - img.Width) / 2) - 2; leftPos = leftPos <= 0 ? 1 : leftPos; } g.DrawImage(img, new Rectangle(leftPos, (int)((Height - img.Height) / 2), img.Width, img.Height > Height ? Height : img.Height)); } // Dış Çizgi // Draw rectangle g.DrawRectangle(new Pen(theme.DarkDarkColor), new Rectangle(0, 0, Width - 1, Height)); // g.Dispose(); }
public void RequestVoxelPaintSphere(Vector3D center, float radius, byte material,PaintType Type) { var msg = new PaintSphereMessage(); msg.EntityId = Entity.EntityId; msg.Center = center; msg.Radius = radius; msg.Type = Type; msg.Material = material; Sync.Layer.SendMessageToServer(ref msg, MyTransportMessageEnum.Request); }
protected override void OnMouseClick(MouseEventArgs e) { if (e.Button == MouseButtons.Left) // Select Button { this.IsSelected = true; this.PaintingType = PaintType.Selected; this.PerformClick(); } else if (e.Button == MouseButtons.Right) // Show context menu { menu.Show(); } base.OnMouseClick(e); }
public void RequestVoxelPaintRamp(BoundingBoxD box, Vector3D rampNormal,double rampNormalW, MatrixD Transformation, byte material, PaintType Type) { var msg = new PaintRampMessage(); msg.EntityId = Entity.EntityId; msg.Min = box.Min; msg.Max = box.Max; msg.RampNormal = rampNormal; msg.RampNormalW = rampNormalW; msg.Type = Type; msg.Material = material; msg.Transformation = Transformation; Sync.Layer.SendMessageToServer(ref msg, MyTransportMessageEnum.Request); }
protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); this.PaintingType = PaintType.Normal; }
public void RequestVoxelPaintEllipsoid(Vector3 radius, MatrixD Transformation, byte material, PaintType Type) { var msg = new PaintEllipsoidMessage(); msg.EntityId = Entity.EntityId; msg.Radius = radius; msg.Type = Type; msg.Material = material; msg.Transformation = Transformation; Sync.Layer.SendMessageToServer(ref msg, MyTransportMessageEnum.Request); }
protected override void OnGotFocus(EventArgs e) { base.OnGotFocus(e); this.PaintingType = PaintType.MouseOver; if (!Caption.Equals(captionString)) toolTip.SetToolTip(this, ToolTipText); else toolTip.RemoveAll(); }
protected override void OnLostFocus(EventArgs e) { base.OnLostFocus(e); this.PaintingType = PaintType.Normal; toolTip.RemoveAll(); }
protected override void OnKeyUp(KeyEventArgs e) { if (e.KeyData == Keys.Enter || e.KeyData == Keys.Space) { e.Handled = true; this.IsSelected = true; this.PaintingType = PaintType.Selected; this.PerformClick(); } else base.OnKeyUp(e); }
void PaintThisControl(PaintType paintType) { NavigateBarTheme theme = navigateBarButton.NavigateBar.Theme; Color lightColor = theme.LightColor; Color darkColor = theme.DarkColor; Image imageButton = null; switch (paintType) { case PaintType.Normal: { imageButton = isSelected ? navigateBarButton.SelectedImage : navigateBarButton.Image; lightColor = isSelected ? theme.SelectedLightColor : theme.LightColor; darkColor = isSelected ? theme.SelectedDarkColor : theme.DarkColor; break; } case PaintType.Selected: { imageButton = NavigateBarButton.SelectedImage; lightColor = isSelected ? theme.SelectedLightColor : theme.LightColor; darkColor = isSelected ? theme.SelectedDarkColor : theme.DarkColor; break; } case PaintType.MouseOver: { lightColor = isSelected ? theme.SelectedLightColor : theme.MouseOverLightColor; darkColor = isSelected ? theme.SelectedDarkColor : theme.MouseOverDarkColor; imageButton = isSelected ? navigateBarButton.SelectedImage : navigateBarButton.MouseOverImage; break; } } // Gradient olarak boyama işlemi // Paint gradient NavigateBarHelper.PaintGradientControl(this, lightColor, darkColor, navigateBarButton.NavigateBar.NavigateBarPaintAngle); Graphics g = this.CreateGraphics(); // Image // OverFlowPanelde mutlaka bir image gösterilmeli // Image must display on panel if (imageButton == null) imageButton = SoftLogik.Properties.Resources.NoImage; if (!this.Enabled) imageButton = navigateBarButton.DisableImage; Rectangle recImage; if (this.Tag.Equals("BUTTON")) // Normal button daha küçük görünmeli recImage = new Rectangle((Width - imageButton.Width + 6) / 2, (Height - imageButton.Height + 6) / 2, imageButton.Width - 6, imageButton.Height - 6); else // OK için olduğu gibi kullan recImage = new Rectangle((Width - imageButton.Width) / 2, (Height - imageButton.Height) / 2, imageButton.Width, imageButton.Height); g.DrawImage(imageButton, recImage); // g.Dispose(); }